never gonna give you up

This commit is contained in:
2023-01-21 10:21:56 +01:00
parent 2d62bfc599
commit a5db6e3337
5 changed files with 21 additions and 2 deletions
+1 -1
View File
@@ -28,6 +28,6 @@ set(SRC
# add the executable
add_executable(FLOPPE_FION ${SRC})
target_link_libraries(FLOPPE_FION SDL2 SDL_image SDL2_ttf pthread m)
target_link_libraries(FLOPPE_FION SDL2 SDL_image SDL2_ttf SDL2_mixer pthread m)
set_property(TARGET FLOPPE_FION PROPERTY C_STANDARD 23)
Binary file not shown.
Binary file not shown.
Binary file not shown.
+20 -1
View File
@@ -1,17 +1,36 @@
#include "renderer.h"
#include "text.h"
#include <SDL2/SDL_mixer.h>
int main(void) {
renderer_main();
Mix_Init(MIX_INIT_MP3);
if(Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 4096) != 0){
printf("Music sound could not be open!\n"
"SDL_Error: %s\n", Mix_GetError());
return 0;
}
Mix_Music *music = Mix_LoadMUS("../assets/music/test.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;
}
RenderObject_t text;
SDL_Color white = {128, 128, 128, 128};
TTF_Init();
if(text_renderText(&text, 0.f, 0.f, 1, white, "/home/gryf/.local/share/fonts/ARIAL.TTF", 25, "Hello World") < 0){
if(text_renderText(&text, 0.f, 0.f, 1, white, "ARIAL.TTF", 25, "Hello World") < 0){
printf("error");
exit(1);
}
renderer_renderObject(text);
while(1);
Mix_FreeMusic(music);
Mix_CloseAudio();
text_freeFontCache();
}