stuff to get shooty to work, might be temp
This commit is contained in:
parent
d4731d3961
commit
12a28fea88
8 changed files with 102 additions and 3 deletions
|
|
@ -18,7 +18,7 @@
|
|||
#include "arc/input/sdl/keyboard.h"
|
||||
#endif // ARC_SDL
|
||||
|
||||
void ARC_EngineData_Create(ARC_EngineData **data, ARC_Handler_CleanDataFn cleanfn){
|
||||
void ARC_EngineData_Create(ARC_EngineData **data, ARC_Handler_CleanDataFn cleanfn, ARC_Point windowSize){
|
||||
*data = (ARC_EngineData *)malloc(sizeof(ARC_EngineData));
|
||||
(*data)->window = NULL;
|
||||
(*data)->renderer = NULL;
|
||||
|
|
@ -31,7 +31,7 @@ void ARC_EngineData_Create(ARC_EngineData **data, ARC_Handler_CleanDataFn cleanf
|
|||
ARC_MouseInfo mouseInfo;
|
||||
ARC_KeyboardInfo keyboardInfo;
|
||||
|
||||
(*data)->windowSize = (ARC_Point){ 2560, 1440 };
|
||||
(*data)->windowSize = windowSize;
|
||||
|
||||
#ifdef ARC_SDL
|
||||
windowInfo = (ARC_WindowInfo){ "title", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, (*data)->windowSize.x, (*data)->windowSize.y, 0 };
|
||||
|
|
|
|||
11
src/graphics/sdl/line.c
Normal file
11
src/graphics/sdl/line.c
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#include "arc/graphics/line.h"
|
||||
#ifdef ARC_SDL
|
||||
#include "arc/graphics/sdl/renderer.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void ARC_Line_Render(int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2, ARC_Renderer *renderer, ARC_Color *color){
|
||||
SDL_SetRenderDrawColor(renderer->renderer, color->r, color->g, color->b, color->a);
|
||||
SDL_RenderDrawLine(renderer->renderer, *x1, *y1, *x2, *y2);
|
||||
}
|
||||
|
||||
#endif // ARC_SDL
|
||||
23
src/graphics/sdl/rect.c
Normal file
23
src/graphics/sdl/rect.c
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include "arc/graphics/rect.h"
|
||||
#ifdef ARC_SDL
|
||||
#include "arc/graphics/sdl/renderer.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void ARC_Rect_Render(ARC_Rect *rect, ARC_Renderer *renderer, ARC_Color *color){
|
||||
SDL_SetRenderDrawColor(renderer->renderer, color->r, color->g, color->b, color->a);
|
||||
SDL_RenderDrawRect(renderer->renderer, (SDL_Rect *) rect);
|
||||
}
|
||||
|
||||
int32_t ARC_Rect_Intersects(ARC_Rect *rect1, ARC_Rect *rect2){
|
||||
if(rect1->x <= rect2->x + rect2->w && rect1->x + rect1->w >= rect2->x &&
|
||||
rect1->y <= rect2->y + rect2->h && rect1->y + rect1->h >= rect2->y){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t ARC_Rect_LineIntersects(ARC_Rect *rect, int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2){
|
||||
return SDL_IntersectRectAndLine((SDL_Rect *) rect, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
#endif // ARC_SDL
|
||||
Loading…
Add table
Add a link
Reference in a new issue