start menu

This commit is contained in:
2023-01-21 12:13:59 +01:00
parent 8a93d29021
commit 1fdcc41801
6 changed files with 78 additions and 20 deletions
+21 -18
View File
@@ -1,5 +1,6 @@
#include "renderer.h"
#include "text.h"
#include "menu.h"
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_surface.h>
@@ -15,12 +16,12 @@ int main(void) {
}
Mix_Music *music = Mix_LoadMUS("./assets/music/pet.mp3");
if(Mix_PlayMusic(music, -1) != 0){
printf("Music sound could not be played!\n"
"SDL_Error: %s\n", Mix_GetError());
Mix_FreeMusic(music);
return 0;
}
// if(Mix_PlayMusic(music, -1) != 0){
// printf("Music sound could not be played!\n"
// "SDL_Error: %s\n", Mix_GetError());
// Mix_FreeMusic(music);
// return 0;
// }
RenderObject_t text;
SDL_Color white = {255, 255, 255, 255};
@@ -30,23 +31,25 @@ int main(void) {
exit(1);
}
SDL_Surface* img = IMG_Load("./assets/img/pp.png");
RenderObject_t duck = {
0.2,
0.2,
0,
0.50,
0.50,
0,
img
};
// SDL_Surface* img = IMG_Load("./assets/img/pp.png");
// RenderObject_t duck = {
// 0.2,
// 0.2,
// 0,
// 0.50,
// 0.50,
// 0,
// img
// };
MonitorSize_t monitorSize = renderer_getMonitorSize();
menu_render(monitorSize.width, monitorSize.height);
renderer_renderObject(text);
renderer_renderObject(duck);
// renderer_renderObject(duck);
while(1);
Mix_FreeMusic(music);
Mix_CloseAudio();
menu_remove();
text_freeFontCache();
}