diff options
-rw-r--r-- | README.md | 18 | ||||
-rw-r--r-- | src/disk.c | 1 | ||||
-rw-r--r-- | src/entity.h | 2 | ||||
-rw-r--r-- | src/flier.c | 1 | ||||
-rw-r--r-- | src/loader.c | 4 | ||||
-rw-r--r-- | src/loader.h | 2 | ||||
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/main.h | 3 | ||||
-rw-r--r-- | src/pacer.c | 2 | ||||
-rw-r--r-- | src/particles.c | 2 | ||||
-rw-r--r-- | src/particles.h | 2 | ||||
-rw-r--r-- | src/player.c | 2 | ||||
-rw-r--r-- | src/tilemap.c | 7 | ||||
-rw-r--r-- | src/walker.c | 2 | ||||
-rw-r--r-- | src/warp.c | 2 |
15 files changed, 37 insertions, 16 deletions
diff --git a/README.md b/README.md index 904a6a2..8244643 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,19 @@ # yet another sdl project -## libraries +platformer game thats stuck in dev hell since 2024 -heres a list of what i DIDNT write, and what its licensed under +## credits -- libplum is public domain +### source code modules (libraries included in the repo) -- cJSON is MIT licensed +- [libplum](<https://github.com/aaaaaa123456789/libplum>) (`src/libplum.[ch]`) is public domain (unlicense) + +- [cJSON](<https://github.com/DaveGamble/cJSON>) (`utl/json2map/cJSON.[ch]`) is MIT licensed + +### external libraries (not included in the repo but required to build the game) + +- [SDL2](<https://libsdl.org/>) is zlib licensed + +- [zlib](<https://www.zlib.net/>) is zlib licensed + +anything not mentioned above was probably written/drawn by me, sylvie diff --git a/src/disk.c b/src/disk.c index 084533f..7469337 100644 --- a/src/disk.c +++ b/src/disk.c @@ -6,6 +6,7 @@ #include "util.h" #include "save.h" #include <string.h> +#include <stdlib.h> #include <stdio.h> enum { diff --git a/src/entity.h b/src/entity.h index 038b62a..614d15f 100644 --- a/src/entity.h +++ b/src/entity.h @@ -1,6 +1,6 @@ #pragma once -#include <SDL2/SDL.h> +#include <SDL2/SDL_rect.h> #define from_fixed(a) ((a) / 16) #define to_fixed(a) ((a) * 16) diff --git a/src/flier.c b/src/flier.c index c507bd2..4adf9ab 100644 --- a/src/flier.c +++ b/src/flier.c @@ -3,6 +3,7 @@ #include "loader.h" #include "tilemap.h" #include <stdbool.h> +#include <stdlib.h> #include <math.h> #include <string.h> #include "particles.h" diff --git a/src/loader.c b/src/loader.c index 54425d9..fed2a7c 100644 --- a/src/loader.c +++ b/src/loader.c @@ -4,13 +4,11 @@ #include <zlib.h> #include <stdbool.h> -#include <SDL2/SDL.h> - #include "libplum.h" #include "zip.h" #include "loader.h" #include "util.h" -#include "main.h" +#include "main.h" // renderer #include "collision.h" static void *inflateWrapped(void *const restrict data, uint32_t const outsize); diff --git a/src/loader.h b/src/loader.h index 800ef0b..44f9d9f 100644 --- a/src/loader.h +++ b/src/loader.h @@ -2,7 +2,7 @@ #include <stddef.h> #include "entity.h" -#include "main.h" +#include "main.h" // struct entities typedef char * name_T; diff --git a/src/main.c b/src/main.c index ce94712..09c5425 100644 --- a/src/main.c +++ b/src/main.c @@ -384,12 +384,15 @@ int main(int const argc, char *const *const argv) { window = SDL_CreateWindow(":3", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WINDOW_WIDTH * scale, WINDOW_HEIGHT * scale, flags | SDL_WINDOW_HIDDEN); if (window == NULL) { + fprintf(stderr, "failed to create the game window: %s\n", SDL_GetError()); goto end; } + SDL_SetWindowMinimumSize(window, WINDOW_WIDTH, WINDOW_HEIGHT); SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl"); // hack, i dont wanna deal with windows discarding render textures renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_TARGETTEXTURE | SDL_RENDERER_PRESENTVSYNC); if (renderer == NULL) { + fprintf(stderr, "failed to create a rendering context: %s\n", SDL_GetError()); goto end; } SDL_RenderSetLogicalSize(renderer, WINDOW_WIDTH, WINDOW_HEIGHT); diff --git a/src/main.h b/src/main.h index ecd8250..2766a84 100644 --- a/src/main.h +++ b/src/main.h @@ -1,6 +1,7 @@ #pragma once -#include <SDL2/SDL.h> +#include <SDL2/SDL_video.h> +#include <SDL2/SDL_render.h> #include "entity.h" extern SDL_Window *window; extern SDL_Renderer *renderer; diff --git a/src/pacer.c b/src/pacer.c index 9bbcfb6..de9a94d 100644 --- a/src/pacer.c +++ b/src/pacer.c @@ -3,6 +3,8 @@ #include "loader.h" #include "tilemap.h" #include <stdbool.h> +#include <stdlib.h> +#include <string.h> #include <math.h> #include "particles.h" #include "gun.h" diff --git a/src/particles.c b/src/particles.c index 3655f23..4432780 100644 --- a/src/particles.c +++ b/src/particles.c @@ -1,4 +1,4 @@ -#include <SDL2/SDL.h> +#include "particles.h" SDL_Rect const particle_gray = {0, 0, 4, 4}; SDL_Rect const particle_red = {4, 0, 4, 4}; diff --git a/src/particles.h b/src/particles.h index c841817..bcfa6fe 100644 --- a/src/particles.h +++ b/src/particles.h @@ -1,5 +1,5 @@ #pragma once -#include <SDL2/SDL.h> +#include <SDL2/SDL_rect.h> extern SDL_Rect const particle_gray; extern SDL_Rect const particle_red; diff --git a/src/player.c b/src/player.c index 83720e6..3605a6d 100644 --- a/src/player.c +++ b/src/player.c @@ -4,6 +4,8 @@ #include "input.h" #include "tilemap.h" #include <stdbool.h> +#include <stdlib.h> +#include <string.h> #include <math.h> #include "particles.h" diff --git a/src/tilemap.c b/src/tilemap.c index 4819053..8a74d9c 100644 --- a/src/tilemap.c +++ b/src/tilemap.c @@ -1,11 +1,10 @@ #include <stdio.h> +#include <stdlib.h> #include <stdint.h> #include <string.h> -#include <SDL2/SDL.h> - #include "loader.h" -#include "main.h" +#include "main.h" // renderer #include "tilemap.h" #include "collision.h" @@ -185,7 +184,7 @@ struct tilemap *tilemap_load(void *data, size_t size) { struct blob col = res_get_collision(str); SDL_RenderCopy(renderer, tex, &(SDL_Rect) {0, 0, 128, height}, &(SDL_Rect) {0, y, 128, height}); - if (col.data != NULL) { // silence -fsanitize=undefined + if (col.data != NULL) { // col.data is only NULL when col.size is 0 but -fsanitize=undefined doesnt know that if (col.size + y * 2 > 0xf0) { fprintf(stderr, "warn: '%s' overflows tile properties\n", str); col.size = 0xf0 - y * 2; diff --git a/src/walker.c b/src/walker.c index 6441909..b3dc680 100644 --- a/src/walker.c +++ b/src/walker.c @@ -3,6 +3,8 @@ #include "loader.h" #include "tilemap.h" #include <stdbool.h> +#include <stdlib.h> +#include <string.h> #include <math.h> #include "particles.h" diff --git a/src/warp.c b/src/warp.c index 3556ef3..c9bb1b4 100644 --- a/src/warp.c +++ b/src/warp.c @@ -2,6 +2,8 @@ #include "entity.h" #include "loader.h" #include "tilemap.h" +#include <string.h> +#include <stdlib.h> static int warp_update(struct warp *self) { if ( |