mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-13 12:33:42 +00:00
startscreen implemented
This commit is contained in:
parent
317dc9d3bc
commit
643e312983
BIN
assets/startscreen.png
Normal file
BIN
assets/startscreen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
44
src/Game.cpp
44
src/Game.cpp
@ -59,6 +59,48 @@ void Game::init(const char* title, int xpos, int ypos, int width, int height, bo
|
||||
return;
|
||||
}
|
||||
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
|
||||
|
||||
SDL_Texture* backgroundTexture = TextureManager::get().loadTexture("assets/startscreen.png");
|
||||
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderCopy(renderer, backgroundTexture, NULL, NULL);
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
SDL_Event event;
|
||||
bool hasQuit = false;
|
||||
|
||||
while (!hasQuit)
|
||||
{
|
||||
SDL_PollEvent(&event);
|
||||
|
||||
if (event.type == SDL_QUIT)
|
||||
{
|
||||
hasQuit = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (event.type == SDL_KEYDOWN)
|
||||
{
|
||||
if (event.key.keysym.scancode == SDL_SCANCODE_RETURN)
|
||||
{
|
||||
std::cout << "Enter pressed > Game start..." << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
if (event.key.keysym.scancode == SDL_SCANCODE_ESCAPE)
|
||||
{
|
||||
std::cout << "Escape pressed > Game quit..." << std::endl;
|
||||
hasQuit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasQuit)
|
||||
{
|
||||
this->isRunning = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this->isRunning = true;
|
||||
|
||||
map = new Map();
|
||||
@ -68,7 +110,7 @@ void Game::init(const char* title, int xpos, int ypos, int width, int height, bo
|
||||
|
||||
assets->addTexture("player1", "assets/chicken_neutral_knight.png");
|
||||
assets->addTexture("player2", "assets/chicken_neutral.png");
|
||||
assets->addTexture("bigEgg", "assets/bigger_egg.png");
|
||||
//assets->addTexture("bigEgg", "assets/bigger_egg.png"); // commented out cause png wasn't in assets
|
||||
|
||||
|
||||
//ecs implementation
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user