Skip to content

Commit

Permalink
Place sample blocks in the theme selector
Browse files Browse the repository at this point in the history
  • Loading branch information
sago007 committed Oct 31, 2023
1 parent 5d60106 commit 10a4aa9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
32 changes: 32 additions & 0 deletions source/code/BlockGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,38 @@ bool BlockGame::hasStaticContent() const {
return false; //Return false if no static object found
}

void BlockGame::putSampleBlocks() {
//row 0 (hidden):
board[0][0]=0;
board[1][0]=1;
board[2][0]=2;
board[3][0]=3;
board[4][0]=4;
board[5][0]=5;
//row 1:
board[0][1]=0;
board[1][1]=1;
board[2][1]=2;
board[3][1]=3;
board[4][1]=4;
board[5][1]=5;
//row 2+:
board[0][2]=6;
board[0][3]=1;
board[0][4]=2;
for ( size_t i = 0; i < 4; i++) {
board[i][5]=GARBAGE;
}
for (size_t i = 0; i < 6; i++) {
for (size_t j = 6; j < 9; j++) {
board[i][j] = GARBAGE+1;
}
for (size_t j = 9; j < 12; j++) {
board[i][j] = GARBAGE+2;
}
}
}

void BlockGame::putStartBlocks() {
putStartBlocks(time(0));
}
Expand Down
1 change: 1 addition & 0 deletions source/code/BlockGame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ class BlockGame {
const BlockGameInfo& GetBlockGameInfo() {
return replayInfo;
}
void putSampleBlocks();
private:
void NewGameInternal(unsigned int ticks);
//Test if LineNr is an empty line, returns false otherwise.
Expand Down
1 change: 1 addition & 0 deletions source/code/menudef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ class ThemesMenu : public Menu {
public:
ThemesMenu(SDL_Renderer* screen, const std::string& title, bool submenu) : Menu(screen, title, submenu) {
game = std::make_shared<BlockGameSdl>(1024-500,100,&globalData.spriteHolder->GetDataHolder());
game->putSampleBlocks();
}

void placeButtons() {
Expand Down

0 comments on commit 10a4aa9

Please sign in to comment.