git repos / blockattack-game

commit 7d649ca8

sago007 · 2016-10-02 16:43
7d649ca819af31e28a380543dc658a34846d799a patch · browse files
parent fd1a6361309caf2d9bd3c7de1fabede42c366de8

Now moves the two fields around when resizeing

Changed files

M source/code/BlockGameSdl.inc before
M source/code/main.cpp before
diff --git a/source/code/BlockGameSdl.inc b/source/code/BlockGameSdl.inc index be07f29..4865972 100644 --- a/source/code/BlockGameSdl.inc +++ b/source/code/BlockGameSdl.inc
@@ -30,6 +30,7 @@ public:
topx = tx;
topy = ty;
}
+
void DrawImgBoard(const sago::SagoSprite& img, int x, int y) const {
DrawIMG(img, screen, x+topx, y+topy);
@@ -46,6 +47,11 @@ public:
void PrintIntRightAlignedBoard(int x, int y, int number) {
nf_button_font.draw(screen, x+topx+60, y+topy+10, NFont::RIGHT, "%d", number);
}
+
+ void SetTopXY(int tx, int ty) {
+ topx = tx;
+ topy = ty;
+ }
int GetTopX() const {
return topx;
diff --git a/source/code/main.cpp b/source/code/main.cpp index ea10c6f..4899bdb 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp
@@ -1165,6 +1165,11 @@ static void ClampResolution(SDL_Window* win) {
}
#endif
+static void MoveBlockGameSdls( BlockGameSdl& game1, BlockGameSdl& game2 ) {
+ game1.SetTopXY(50, 100);
+ game2.SetTopXY(xsize-500,100);
+}
+
struct globalConfig {
string savepath;
vector<string> search_paths;
@@ -1480,6 +1485,7 @@ int main(int argc, char* argv[]) {
theGame.NewGame(s);
}
DrawBackground(screen);
+ MoveBlockGameSdls(theGame, theGame2);
DrawEverything(xsize,ysize,&theGame,&theGame2);
SDL_RenderPresent(screen);
if (singlePuzzle) {
@@ -1652,6 +1658,7 @@ int runGame(Gametype gametype, int level) {
};
mustsetupgame = false;
DrawBackground(screen);
+ MoveBlockGameSdls(theGame, theGame2);
DrawEverything(xsize,ysize,&theGame,&theGame2);
SDL_RenderPresent(screen);
}
@@ -2093,6 +2100,7 @@ int runGame(Gametype gametype, int level) {
}
//Once evrything has been checked, update graphics
+ MoveBlockGameSdls(theGame, theGame2);
DrawEverything(xsize,ysize,&theGame,&theGame2);
SDL_GetMouseState(&mousex,&mousey);
//Draw the mouse: