basic sdl init graphics and engine implementaiton
This commit is contained in:
parent
db1adbb838
commit
685364929b
18 changed files with 257 additions and 7 deletions
0
include/arc/engine/ecs.h
Normal file
0
include/arc/engine/ecs.h
Normal file
27
include/arc/engine/engine.h
Normal file
27
include/arc/engine/engine.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef ARC_ENGINE_H_
|
||||
#define ARC_ENGINE_H_
|
||||
|
||||
#include "arc/graphics/window.h"
|
||||
#include "arc/graphics/renderer.h"
|
||||
|
||||
typedef struct ARC_EngineData {
|
||||
ARC_Window *window;
|
||||
ARC_Renderer *renderer;
|
||||
|
||||
} ARC_EngineData;
|
||||
|
||||
//NOTE: most work below is temp, and will change once I figure out a better way to write this header
|
||||
|
||||
void ARC_EngineData_Create(ARC_EngineData **data);
|
||||
void ARC_EngineData_Destroy(ARC_EngineData *data);
|
||||
|
||||
/**
|
||||
* @brief runs ARC_Engine
|
||||
*
|
||||
* @param data engine data that will be used
|
||||
* data must be created before this function
|
||||
* and must be destroyed after this function
|
||||
*/
|
||||
void ARC_Engine_Run(ARC_EngineData *data);
|
||||
|
||||
#endif // !ARC_ENGINE_H_
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
|
||||
#ifndef ARC_GRAPHICS_DATA_H_
|
||||
#define ARC_GRAPHICS_DATA_H_
|
||||
|
||||
#endif //ARC_GRAPHICS_DATA_H_
|
||||
24
include/arc/graphics/renderer.h
Normal file
24
include/arc/graphics/renderer.h
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef ARC_GRAPHICS_RENDERER_H_
|
||||
#define ARC_GRAPHICS_RENDERER_H_
|
||||
|
||||
typedef struct ARC_Renderer ARC_Renderer;
|
||||
|
||||
typedef struct ARC_RenderInfo ARC_RenderInfo;
|
||||
|
||||
/**
|
||||
* @brief creates ARC_Renderer type
|
||||
*
|
||||
* @note the parameter data is determined by which graphics library you are using
|
||||
* please refer to the graphics library section to see what needs to be passed
|
||||
*
|
||||
* @param renderer ARC_Window to initialize
|
||||
* @param data Data to create ARC_Window
|
||||
*/
|
||||
void ARC_Renderer_Create(ARC_Renderer **renderer, void *data);
|
||||
|
||||
/**
|
||||
* @brief destroys ARC_Renderer type
|
||||
*/
|
||||
void ARC_Renderer_Destroy(ARC_Renderer *renderer);
|
||||
|
||||
#endif // !ARC_GRAPHICS_RENDERER_H_
|
||||
22
include/arc/graphics/sdl/renderer.h
Normal file
22
include/arc/graphics/sdl/renderer.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#ifndef ARC_SDL_RENDERER_H_
|
||||
#define ARC_SDL_RENDERER_H_
|
||||
|
||||
#ifdef ARC_SDL
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
/**
|
||||
* @brief struct for info needed to create SDL_Renderer
|
||||
*
|
||||
* @note this is what needs to be passed into the data parameter for ARC_Renderer_Create
|
||||
*/
|
||||
|
||||
struct ARC_RenderInfo {
|
||||
ARC_Window *window;
|
||||
int index;
|
||||
Uint32 flags;
|
||||
} ARC_RenderInfo;
|
||||
|
||||
#endif // ARC_SDL
|
||||
|
||||
#endif // ARC_SDL_RENDERER_H_
|
||||
25
include/arc/graphics/sdl/window.h
Normal file
25
include/arc/graphics/sdl/window.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef ARC_SDL_RENDERER_H_
|
||||
#define ARC_SDL_RENDERER_H_
|
||||
|
||||
#ifdef ARC_SDL
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
/**
|
||||
* @brief struct for info needed to create SDL_Window
|
||||
*
|
||||
* @note this is what needs to be passed into the data parameter for ARC_Window_Create
|
||||
*/
|
||||
|
||||
struct ARC_WindowInfo {
|
||||
char *title;
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
Uint32 flags;
|
||||
} ARC_WindowInfo;
|
||||
|
||||
#endif // ARC_SDL
|
||||
|
||||
#endif // ARC_SDL_RENDERER_H_
|
||||
24
include/arc/graphics/window.h
Normal file
24
include/arc/graphics/window.h
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef ARC_GRAPHICS_WINDOW_H_
|
||||
#define ARC_GRAPHICS_WINDOW_H_
|
||||
|
||||
typedef struct ARC_Window ARC_Window;
|
||||
|
||||
typedef struct ARC_WindowInfo ARC_WindowInfo;
|
||||
|
||||
/**
|
||||
* @brief creates ARC_Window type
|
||||
*
|
||||
* @note the parameter data is determined by which graphics library you are using
|
||||
* please refer to the graphics library section to see what needs to be passed
|
||||
*
|
||||
* @param window ARC_Window to initialize
|
||||
* @param data Data to create ARC_Window
|
||||
*/
|
||||
void ARC_Window_Create(ARC_Window **window, void *data);
|
||||
|
||||
/**
|
||||
* @brief destroys ARC_Window type
|
||||
*/
|
||||
void ARC_Window_Destroy(ARC_Window *window);
|
||||
|
||||
#endif // !ARC_GRAPHICS_WINDOW_H_
|
||||
0
include/arc/math/rectangle.h
Normal file
0
include/arc/math/rectangle.h
Normal file
30
include/arc/math/vector2.h
Normal file
30
include/arc/math/vector2.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef ARC_MATH_VECTOR2_H_
|
||||
#define ARC_MATH_VECTOR2_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct ARC_Vector2 {
|
||||
int32_t x, y;
|
||||
} ARC_Vector2;
|
||||
|
||||
typedef struct ARC_UVector2 {
|
||||
uint32_t x, y;
|
||||
} ARC_UVector2;
|
||||
|
||||
typedef struct ARC_FVector2 {
|
||||
float x, y;
|
||||
} ARC_FVector2;
|
||||
|
||||
typedef struct ARC_DVector2 {
|
||||
double x, y;
|
||||
} ARC_DVector2;
|
||||
|
||||
typedef struct ARC_LVector2 {
|
||||
int64_t x, y;
|
||||
} ARC_LVector2;
|
||||
|
||||
typedef struct ARC_ULVector2 {
|
||||
uint64_t x, y;
|
||||
} ARC_ULVector2;
|
||||
|
||||
#endif // ARC_MATH_VECTOR2_H_
|
||||
0
include/arc/math/vector3.h
Normal file
0
include/arc/math/vector3.h
Normal file
|
|
@ -138,4 +138,4 @@ void *ARC_Config_GetReference(ARC_Config *config, char *data, ARC_StringSubstr *
|
|||
|
||||
#ifdef ARC_DEFAULT_CONFIG
|
||||
#include "defaults/config.h"
|
||||
#endif //ARC_DEFAULT_CONFIG
|
||||
#endif //ARC_DEFAULT_CONFIG
|
||||
|
|
|
|||
|
|
@ -27,8 +27,10 @@ extern "C" {
|
|||
#ifdef ARC_DEBUG
|
||||
# include <stdio.h>
|
||||
# define ARC_DEBUG_LOG(ERR, STR, ...) printf("[ERROR %d] " STR "\n", ERR, __VA_ARGS__)
|
||||
# define ARC_DEBUG_ERR(STR) printf("[ERROR %d]" STR "\n", ERR)
|
||||
#else
|
||||
# define ARC_DEBUG_LOG(ERR, STR, ...)
|
||||
# define ARC_DEBUG_ERR(STR)
|
||||
#endif
|
||||
|
||||
#define ARC_ERR_CHECK(FUNC) FUNC; if(arc_errno){ ARC_DEBUG_LOG(arc_errno, "%s", #FUNC); return; }
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ typedef int8_t (* ARC_Vector_CompareDataFn)(void *a, void *b);
|
|||
/**
|
||||
* @brief creates ARC_Vector type
|
||||
*
|
||||
* @param config ARC_Vector to initialize
|
||||
* @param vector ARC_Vector to initialize
|
||||
* @param dataSize size of type the vector will store
|
||||
*/
|
||||
void ARC_Vector_Create(ARC_Vector **vector, uint32_t dataSize);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue