2022-10-29 00:22:23 -06:00
|
|
|
#include "arc/engine/engine.h"
|
2022-10-29 16:08:41 -06:00
|
|
|
#include <SDL_video.h>
|
2022-10-29 00:22:23 -06:00
|
|
|
#include <stdlib.h>
|
2022-10-29 16:08:41 -06:00
|
|
|
#include "arc/graphics/window.h"
|
|
|
|
|
#include "arc/graphics/renderer.h"
|
2022-10-29 00:22:23 -06:00
|
|
|
|
|
|
|
|
//NOTE: this is very temp, mostly to get smthn running so I can test out different ideas
|
|
|
|
|
#ifdef ARC_SDL
|
|
|
|
|
#include <SDL.h>
|
2022-10-29 16:08:41 -06:00
|
|
|
#include "arc/graphics/sdl/window.h"
|
|
|
|
|
#include "arc/graphics/sdl/renderer.h"
|
|
|
|
|
#endif // ARC_SDL
|
2022-10-29 00:22:23 -06:00
|
|
|
|
|
|
|
|
void ARC_EngineData_Create(ARC_EngineData **data){
|
|
|
|
|
*data = (ARC_EngineData *)malloc(sizeof(ARC_EngineData));
|
|
|
|
|
(*data)->window = NULL;
|
|
|
|
|
(*data)->renderer = NULL;
|
|
|
|
|
|
|
|
|
|
ARC_WindowInfo windowInfo;
|
|
|
|
|
ARC_RenderInfo renderInfo;
|
|
|
|
|
|
|
|
|
|
#ifdef ARC_SDL
|
|
|
|
|
if(SDL_Init(SDL_INIT_VIDEO) < 0){
|
2022-10-29 16:08:41 -06:00
|
|
|
printf("Error: initializing SDL\nSDL Error: %s\n", SDL_GetError());
|
2022-10-29 00:22:23 -06:00
|
|
|
free(*data);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-29 16:08:41 -06:00
|
|
|
windowInfo = (ARC_WindowInfo){ "title", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 1920, 1080, 0 };
|
2022-10-29 00:22:23 -06:00
|
|
|
#endif // ARC_SDL
|
|
|
|
|
|
|
|
|
|
ARC_Window_Create(&((*data)->window), &windowInfo);
|
|
|
|
|
//TODO: handle arc_errno errors here
|
2022-10-29 16:08:41 -06:00
|
|
|
|
|
|
|
|
#ifdef ARC_SDL
|
|
|
|
|
renderInfo = (ARC_RenderInfo){ (SDL_Window *)(*data)->window->window, -1, SDL_RENDERER_ACCELERATED };
|
|
|
|
|
#endif // ARC_SDL
|
|
|
|
|
|
2022-10-29 00:22:23 -06:00
|
|
|
ARC_Renderer_Create(&((*data)->renderer), &renderInfo);
|
|
|
|
|
//TODO: handle arc_errno errors here
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ARC_EngineData_Destroy(ARC_EngineData *data){
|
|
|
|
|
#ifdef ARC_SDL
|
2022-10-29 16:08:41 -06:00
|
|
|
ARC_Window_Destroy( data->window );
|
2022-10-29 00:22:23 -06:00
|
|
|
ARC_Renderer_Destroy(data->renderer);
|
|
|
|
|
#endif // ARC_SDL
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ARC_Engine_Run(ARC_EngineData *data){
|
|
|
|
|
}
|