diff options
| author | realtradam <[email protected]> | 2022-12-31 02:07:46 -0500 |
|---|---|---|
| committer | realtradam <[email protected]> | 2022-12-31 02:07:46 -0500 |
| commit | bebf2cefe734d154ffaae44fb7c1bb557f2e1bfa (patch) | |
| tree | 8c4abb74251e1ed67156a2f53b23380d7068cb72 /src | |
| download | RodeoKit-bebf2cefe734d154ffaae44fb7c1bb557f2e1bfa.tar.gz RodeoKit-bebf2cefe734d154ffaae44fb7c1bb557f2e1bfa.zip | |
init
Diffstat (limited to 'src')
| -rw-r--r-- | src/compile_flags.txt | 2 | ||||
| -rw-r--r-- | src/lib/lib.c | 6 | ||||
| -rw-r--r-- | src/lib/lib.h | 3 | ||||
| -rw-r--r-- | src/main.c | 69 |
4 files changed, 80 insertions, 0 deletions
diff --git a/src/compile_flags.txt b/src/compile_flags.txt new file mode 100644 index 0000000..268f070 --- /dev/null +++ b/src/compile_flags.txt @@ -0,0 +1,2 @@ +-I./ +-I../external/SDL/include diff --git a/src/lib/lib.c b/src/lib/lib.c new file mode 100644 index 0000000..4de4456 --- /dev/null +++ b/src/lib/lib.c @@ -0,0 +1,6 @@ +#include "lib.h" + +int add(int a, int b) +{ + return a + b; +} diff --git a/src/lib/lib.h b/src/lib/lib.h new file mode 100644 index 0000000..77a0e1e --- /dev/null +++ b/src/lib/lib.h @@ -0,0 +1,3 @@ + +int +add(int a, int b); diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..567492f --- /dev/null +++ b/src/main.c @@ -0,0 +1,69 @@ +#include <stdio.h> +#include <stdbool.h> +#include "lib/lib.h" +#include "SDL3/SDL.h" + +const int SCREEN_WIDTH = 640; +const int SCREEN_HEIGHT = 480; + +int +main() +{ + SDL_Window* window = NULL; + + SDL_Surface* screenSurface = NULL; + + if(SDL_Init(SDL_INIT_VIDEO) < 0) + { + printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError()); + } + else + { + window = SDL_CreateWindow( + "SDL Tutorial", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + SCREEN_WIDTH, + SCREEN_HEIGHT, + SDL_WINDOWEVENT_SHOWN + ); + if(window == NULL) + { + printf("Window could not be created! SDL_Error %s\n", SDL_GetError()); + } + else + { + screenSurface = SDL_GetWindowSurface(window); + + SDL_FillSurfaceRect( + screenSurface, + NULL, + SDL_MapRGB(screenSurface->format, 0xFF, 0xFF, 0xFF) + ); + + SDL_UpdateWindowSurface(window); + + SDL_Event e; + bool quit = false; + while(quit == false) + { + while(SDL_PollEvent(&e)) + { + if(e.type == SDL_QUIT) + { + quit = true; + } + } + } + } + } + + SDL_DestroyWindow(window); + + SDL_Quit(); + + printf("number: %d\n", add(1, 3)); + printf("Hello World"); + + return 0; +} |
