summary refs log tree commit diff stats
path: root/titlestate.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-11-02 20:11:53 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-11-02 20:11:53 -0400
commit84c305819930713603124d984acb51df87761246 (patch)
tree435bbb75392311eea42d5d46d6b00caa36b35a8a /titlestate.cpp
parenta59fcafb2e81f3cb40ff320b106030e8fed4bd66 (diff)
downloadmazeoflife-84c305819930713603124d984acb51df87761246.tar.gz
mazeoflife-84c305819930713603124d984acb51df87761246.tar.bz2
mazeoflife-84c305819930713603124d984acb51df87761246.zip
emscripten port emscripten
Diffstat (limited to 'titlestate.cpp')
-rw-r--r--titlestate.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/titlestate.cpp b/titlestate.cpp index b68e8fa..95bba6b 100644 --- a/titlestate.cpp +++ b/titlestate.cpp
@@ -14,10 +14,21 @@ std::unique_ptr<State> TitleState::operator()(Game& game) {
14 14
15 SDL_RenderClear(game.renderer.get()); 15 SDL_RenderClear(game.renderer.get());
16 SDL_RenderCopy(game.renderer.get(), background_.get(), NULL, NULL); 16 SDL_RenderCopy(game.renderer.get(), background_.get(), NULL, NULL);
17
18#ifdef __EMSCRIPTEN__
19 applyTexture(game.renderer.get(), pointer_.get(), 136,
20 selection_ == 0 ? 316 : (selection_ == 1 ? 350 : 381));
21
22 SDL_Rect eSpace = {164, 412, 79, 33};
23 SDL_SetRenderDrawColor(game.renderer.get(), 255, 255, 255, 255);
24 SDL_RenderFillRect(game.renderer.get(), &eSpace);
25#else
17 applyTexture(game.renderer.get(), pointer_.get(), 136, 26 applyTexture(game.renderer.get(), pointer_.get(), 136,
18 selection_ == 0 27 selection_ == 0
19 ? 316 28 ? 316
20 : (selection_ == 1 ? 350 : (selection_ == 2 ? 381 : 417))); 29 : (selection_ == 1 ? 350 : (selection_ == 2 ? 381 : 417)));
30#endif
31
21 SDL_RenderPresent(game.renderer.get()); 32 SDL_RenderPresent(game.renderer.get());
22 33
23 while (SDL_PollEvent(&e)) { 34 while (SDL_PollEvent(&e)) {
@@ -27,7 +38,11 @@ std::unique_ptr<State> TitleState::operator()(Game& game) {
27 } else if (e.type == SDL_KEYDOWN) { 38 } else if (e.type == SDL_KEYDOWN) {
28 if ((e.key.keysym.sym == SDLK_UP) && (selection_ != 0)) { 39 if ((e.key.keysym.sym == SDLK_UP) && (selection_ != 0)) {
29 selection_--; 40 selection_--;
41#ifdef __EMSCRIPTEN__
42 } else if ((e.key.keysym.sym == SDLK_DOWN) && (selection_ != 2)) {
43#else
30 } else if ((e.key.keysym.sym == SDLK_DOWN) && (selection_ != 3)) { 44 } else if ((e.key.keysym.sym == SDLK_DOWN) && (selection_ != 3)) {
45#endif
31 selection_++; 46 selection_++;
32 } else if (e.key.keysym.sym == SDLK_RETURN) { 47 } else if (e.key.keysym.sym == SDLK_RETURN) {
33 switch (selection_) { 48 switch (selection_) {