diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/C.includecache b/cmake-build-debug/CMakeFiles/nhf.dir/C.includecache index 0f13909ce3eb18e43f07a4a9ec0a7fa2d6a20e57..6e6c6b29532213b112d1357e03df79374cc8f7de 100644 --- a/cmake-build-debug/CMakeFiles/nhf.dir/C.includecache +++ b/cmake-build-debug/CMakeFiles/nhf.dir/C.includecache @@ -6,15 +6,19 @@ #IncludeRegexTransform: -/home/blint/projects/nhf/move.c -move.h -/home/blint/projects/nhf/move.h +/home/blint/projects/nhf/main.c view.h /home/blint/projects/nhf/view.h -SDL.h +move.h +/home/blint/projects/nhf/move.h +SDL2/SDL_image.h +- +SDL2/SDL2_gfxPrimitives.h - stdbool.h - +time.h +- /home/blint/projects/nhf/move.h view.h diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/main.c.o b/cmake-build-debug/CMakeFiles/nhf.dir/main.c.o index 937f613e8dfa9beeaf63356f2de276d025152ff3..a7b19ad917827e44aaedb98d61eae92b60d44803 100644 Binary files a/cmake-build-debug/CMakeFiles/nhf.dir/main.c.o and b/cmake-build-debug/CMakeFiles/nhf.dir/main.c.o differ diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/move.c.o b/cmake-build-debug/CMakeFiles/nhf.dir/move.c.o index 8642abc57b1f6afb45319f16aef62e8b9de0106b..8ec42e5df3bc807c2e89cfeb16174a8330aacf94 100644 Binary files a/cmake-build-debug/CMakeFiles/nhf.dir/move.c.o and b/cmake-build-debug/CMakeFiles/nhf.dir/move.c.o differ diff --git a/cmake-build-debug/CMakeFiles/nhf.dir/view.c.o b/cmake-build-debug/CMakeFiles/nhf.dir/view.c.o index d95ecabd79fd87936e4f2c19181fbff2ad575fae..a6570638896d438a1c41a6c37dc6a680bc808063 100644 Binary files a/cmake-build-debug/CMakeFiles/nhf.dir/view.c.o and b/cmake-build-debug/CMakeFiles/nhf.dir/view.c.o differ diff --git a/cmake-build-debug/nhf b/cmake-build-debug/nhf index 566aafcd60e6603288529b0651bcfc1e2124c402..f61f202e0da126917764444518761fc7f181e585 100755 Binary files a/cmake-build-debug/nhf and b/cmake-build-debug/nhf differ diff --git a/main.c b/main.c index 7f958401b7b16fcbb8d05b11a2dff4478ed8a6ca..362f45a114e7231e73fd4738a53002fa9a740d51 100644 --- a/main.c +++ b/main.c @@ -38,6 +38,7 @@ int main(int argc, char *argv[]) { bool quit = false; bool moving = false; bool loading = false; + bool scoring = false; int elozo_x = 0; int elozo_y = W - 2*owl; @@ -67,10 +68,19 @@ int main(int argc, char *argv[]) { load.click = false; Button scoreboard; - scoreboard.x = 0; - scoreboard.y = 0; - scoreboard.w = 300; - scoreboard.h = owl; + scoreboard.x = W/6; + scoreboard.y = (3*H/9 + 2*(H/18)); + scoreboard.w = (W - W/6) - load.x; + scoreboard.h = (3*H/9 + H/18) - load.y; + strcpy(scoreboard.title, "Dicsőség tábla"); + scoreboard.over = false; + scoreboard.click = false; + + Button scoretitle; + scoretitle.x = 0; + scoretitle.y = 0; + scoretitle.w = 300; + scoretitle.h = owl; Color green = (Color){0, 255, 0}; Color white = (Color){255, 255, 255}; @@ -91,20 +101,20 @@ int main(int argc, char *argv[]) { if (moving){ move_draw(ev, bagoly, &elozo_x, &elozo_y, platf, itemke); - sprintf(scoreboard.title, "Score: %6d", max_score); - draw_button(scoreboard, green, white); + sprintf(scoretitle.title, "Score: %6d", max_score); + draw_button(scoretitle, green, white); } else { - menu(ev, &start, &load, &moving, &loading); + menu(ev, &start, &load, &scoreboard, &moving, &loading, &scoring); } SDL_RenderPresent(renderer); } - printf("Final score: %d\n", score); SDL_DestroyTexture(bagoly); freeing(platf); + freeing(itemke); SDL_Quit(); return 0; diff --git a/move.c b/move.c index bdab82364002223d44441397f4a1022cb8315685..af7c1ab4090b634fe746cbe93b16bb439cab1a09 100644 --- a/move.c +++ b/move.c @@ -199,7 +199,7 @@ Button clickwatcher(SDL_Event ev, Button button) return button; } -void menu(SDL_Event ev, Button *start, Button *load, bool *moving, bool *loading) +void menu(SDL_Event ev, Button *start, Button *load, Button *scoreboard, bool *moving, bool *loading, bool *scoring) { Color red = (Color){255, 0, 0}; Color green = (Color){0, 255, 0}; @@ -208,6 +208,7 @@ void menu(SDL_Event ev, Button *start, Button *load, bool *moving, bool *loading *start = clickwatcher(ev, *start); *load = clickwatcher(ev, *load); + *scoreboard = clickwatcher(ev, *scoreboard); if (start->over) draw_button(*start, green, white); @@ -219,6 +220,12 @@ void menu(SDL_Event ev, Button *start, Button *load, bool *moving, bool *loading else draw_button(*load, red, white); + if (scoreboard->over) + draw_button(*scoreboard, green, white); + else + draw_button(*scoreboard, red, white); + + if (start->click) *moving = true; else @@ -228,4 +235,9 @@ void menu(SDL_Event ev, Button *start, Button *load, bool *moving, bool *loading *loading = true; else *loading = false; + + if (scoreboard->click) + *scoring = true; + else + *scoring = false; } \ No newline at end of file diff --git a/move.h b/move.h index a5da186bab74639f7b8c9393eff3655d62a09434..e6cbe6291930a55335a5f6db0957dd899103df83 100644 --- a/move.h +++ b/move.h @@ -28,6 +28,6 @@ Palyaelem *palyamozgat(Palyaelem *eleje, int x); Button clickwatcher(SDL_Event ev, Button button); -void menu(SDL_Event ev, Button *start, Button *load, bool *moving, bool *loading); +void menu(SDL_Event ev, Button *start, Button *load, Button *scoreboard, bool *moving, bool *loading, bool *scoring); #endif //NHF_MOVE_H \ No newline at end of file