sdl2 now working again I think, but with better cmake

This commit is contained in:
herbglitch 2024-02-08 17:47:32 -07:00
parent c822075173
commit 3e15b6dfd0
16 changed files with 78 additions and 52 deletions

View file

@ -1,4 +1,4 @@
#ifdef ARC_SDL
#ifdef ARC_SDL2_GRAPHICS
#include "arc/graphics/circle.h"
#include "arc/graphics/sdl/renderer.h"
#include <stdlib.h>
@ -49,4 +49,4 @@ void ARC_Circle_RenderFill(ARC_Circle *circle, ARC_Renderer *renderer, ARC_Color
}
}
#endif // ARC_SDL
#endif // ARC_SDL2_GRAPHICS

View file

@ -1,4 +1,4 @@
#ifdef ARC_SDL
#ifdef ARC_SDL2_GRAPHICS
#include "arc/graphics/config.h"
#include <SDL_image.h>
@ -71,7 +71,7 @@ uint8_t ARC_SDL_Texture_Read(ARC_Config* config, ARC_String *string, void **valu
}
ARC_String *tempStr, *textureStr;
ARC_String_StripEndsWhitespace(string, &tempStr);
ARC_String_StripEndsWhitespace(&tempStr, string);
ARC_String_CopySubstring(&textureStr, tempStr, 1, tempStr->length - 2);
ARC_String_Destroy(tempStr);
@ -86,7 +86,7 @@ void ARC_Spritesheet_ReadTexture(ARC_Config *config, ARC_String *string, uint32_
SDL_Texture *texture;
ARC_String *tempStr, *textureStr;
ARC_String_StripEndsWhitespace(string, &tempStr);
ARC_String_StripEndsWhitespace(&tempStr, string);
//check for reference
ARC_Config_Get(config, tempStr, (void **)&texture);
@ -125,11 +125,11 @@ uint8_t ARC_Spritesheet_Read(ARC_Config* config, ARC_String *string, void **valu
ARC_String *temp, *textureStr, *sizeStr;
ARC_String_CopySubstring(&temp, string, 1, split - 2);
ARC_String_StripEndsWhitespace(temp, &textureStr);
ARC_String_StripEndsWhitespace(&textureStr, temp);
ARC_String_Destroy(temp);
ARC_String_CopySubstring(&temp, string, split + 1, string->length - (split + 1));
ARC_String_StripEndsWhitespace(temp, &sizeStr);
ARC_String_StripEndsWhitespace(&sizeStr, temp);
ARC_String_Destroy(temp);
uint32_t *size;
@ -169,11 +169,11 @@ uint8_t ARC_Sprite_Read(ARC_Config* config, ARC_String *string, void **value){
ARC_String *temp, *spritesheetStr, *framesStr;
ARC_String_CopySubstring(&temp, string, 1, split - 2);
ARC_String_StripEndsWhitespace(temp, &spritesheetStr);
ARC_String_StripEndsWhitespace(&spritesheetStr, temp);
ARC_String_Destroy(temp);
ARC_String_CopySubstring(&temp, string, split + 1, string->length - (split + 2));
ARC_String_StripEndsWhitespace(temp, &framesStr);
ARC_String_StripEndsWhitespace(&framesStr, temp);
ARC_String_Destroy(temp);
//spritesheet
@ -253,11 +253,11 @@ void ARC_Spritesheet_Delete(ARC_Config* config, ARC_String *string, void *value)
//check if texture and size are references
ARC_String *tempStr, *textureStr, *sizeStr;
ARC_String_CopySubstring(&tempStr, string, 1, split - 1);
ARC_String_StripEndsWhitespace(tempStr, &textureStr);
ARC_String_StripEndsWhitespace(&textureStr, tempStr);
ARC_String_Destroy(tempStr);
ARC_String_CopySubstring(&tempStr, string, split + 1, string->length - (split + 1));
ARC_String_StripEndsWhitespace(tempStr, &sizeStr);
ARC_String_StripEndsWhitespace(&sizeStr, tempStr);
ARC_String_Destroy(tempStr);
ARC_Config_Get(config, sizeStr, (void **)&temp);
@ -289,11 +289,11 @@ void ARC_Sprite_Delete(ARC_Config* config, ARC_String *string, void *value){
//check if texture and size are references
ARC_String *tempStr, *spritesheetStr, *framesStr;
ARC_String_CopySubstring(&tempStr, string, 1, split - 1);
ARC_String_StripEndsWhitespace(tempStr, &spritesheetStr);
ARC_String_StripEndsWhitespace(&spritesheetStr, tempStr);
ARC_String_Destroy(tempStr);
ARC_String_CopySubstring(&tempStr, string, split + 1, string->length - (split + 1));
ARC_String_StripEndsWhitespace(tempStr, &framesStr);
ARC_String_StripEndsWhitespace(&framesStr, tempStr);
ARC_String_Destroy(tempStr);
ARC_Config_Get(config, spritesheetStr, (void **)&temp);
@ -311,4 +311,4 @@ void ARC_Sprite_Delete(ARC_Config* config, ARC_String *string, void *value){
free(spriteValue);
}
#endif //ARC_SDL
#endif //ARC_SDL2_GRAPHICS

View file

@ -1,4 +1,4 @@
#ifdef ARC_SDL
#ifdef ARC_SDL2_GRAPHICS
#include "arc/graphics/line.h"
#include "arc/graphics/sdl/renderer.h"
#include <stdlib.h>
@ -8,4 +8,4 @@ void ARC_Line_Render(int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2, ARC_Ren
SDL_RenderDrawLine((SDL_Renderer *)renderer, *x1, *y1, *x2, *y2);
}
#endif // ARC_SDL
#endif // ARC_SDL2_GRAPHCIS

View file

@ -1,4 +1,4 @@
#ifdef ARC_SDL
#ifdef ARC_SDL2_GRAPHICS
#include "arc/graphics/obround.h"
#include "arc/graphics/sdl/renderer.h"
#include <stdlib.h>
@ -48,4 +48,4 @@ void ARC_FObround_Render(ARC_FObround *obround, ARC_Renderer *renderer, ARC_Colo
ARC_Obround_Render(&casted, renderer, color);
}
#endif // ARC_SDL
#endif // ARC_SDL2_GRAPHICS

View file

@ -1,4 +1,4 @@
#ifdef ARC_SDL
#ifdef ARC_SDL2_GRAPHICS
#include "arc/graphics/rectangle.h"
#include "arc/graphics/sdl/renderer.h"
#include <stdlib.h>
@ -23,4 +23,4 @@ void ARC_FRect_RenderFill(ARC_FRect *rect, ARC_Renderer *renderer, ARC_Color *co
ARC_Rect_RenderFill(&casted, renderer, color);
}
#endif // ARC_SDL
#endif // ARC_SDL2_GRAPHICS

View file

@ -1,4 +1,4 @@
#ifdef ARC_SDL
#ifdef ARC_SDL2_WINDOW
#include "arc/graphics/renderer.h"
#include "arc/graphics/sdl/renderer.h"
@ -38,4 +38,4 @@ void ARC_Renderer_Render(ARC_Renderer *renderer){
SDL_RenderPresent((SDL_Renderer *)renderer);
}
#endif //ARC_SDL
#endif //ARC_SDL2_WINDOW

View file

@ -1,4 +1,4 @@
#ifdef ARC_SDL
#ifdef ARC_SDL2_GRAPHICS
#include "arc/graphics/sprite.h"
#include "arc/graphics/sdl/sprite.h"
#include "arc/graphics/sdl/spritesheet.h"
@ -89,4 +89,4 @@ ARC_Array *ARC_Sprite_GetAllBounds(ARC_Sprite *sprite){
return sprite->frames;
}
#endif // ARC_SDL
#endif // ARC_SDL2_GRAPHICS

View file

@ -1,4 +1,4 @@
#ifdef ARC_SDL
#ifdef ARC_SDL2_GRAPHICS
#include "arc/graphics/spritesheet.h"
#include "arc/graphics/sdl/spritesheet.h"
#include "arc/graphics/sdl/renderer.h"
@ -18,4 +18,5 @@ ARC_Point ARC_Spritesheet_GetSize(ARC_Spritesheet *spritesheet){
uint32_t *ARC_Spritesheet_GetTileSize(ARC_Spritesheet *spritesheet){
return spritesheet->size;
}
#endif //ARC_SDL
#endif //ARC_SDL2_GRAPHICS

View file

@ -1,3 +1,4 @@
#ifdef ARC_SDL2_GRAPHICS
#include "arc/graphics/text.h"
#include "arc/graphics/sdl/text.h"
#include "arc/graphics/color.h"
@ -53,4 +54,6 @@ void ARC_Text_Render(ARC_Text *text, ARC_Renderer *renderer){
void ARC_Text_SetPos(ARC_Text *text, ARC_Point pos){
text->bounds.x = pos.x;
text->bounds.y = pos.y;
}
}
#endif //ARC_SDL2_GRAPHICS

View file

@ -1,3 +1,4 @@
#ifdef ARC_SDL2_GRAPHICS
#include "arc/graphics/view.h"
#include "arc/std/errno.h"
@ -33,3 +34,5 @@ void ARC_View_Render(ARC_View *view, ARC_View_RenderFn renderFn, void *data){
ARC_Rect ARC_View_GetBounds(ARC_View *view){
return view->bounds;
}
#endif //ARC_SDL2_GRAPHICS

View file

@ -1,4 +1,4 @@
#ifdef ARC_SDL
#ifdef ARC_SDL2_WINDOW
#include "arc/graphics/window.h"
#include "arc/graphics/sdl/window.h"
@ -31,4 +31,4 @@ void ARC_Window_Destroy(ARC_Window *window){
SDL_DestroyWindow((SDL_Window *) window);
}
#endif //ARC_SDL
#endif //ARC_SDL2_WINDOW