removed pointless pointers in rectange, reset background clear color, fixed entity, and added some state functions
This commit is contained in:
parent
dd1f3ca3e0
commit
bd7e3212da
12 changed files with 161 additions and 86 deletions
|
|
@ -12,15 +12,17 @@ extern "C" {
|
|||
#include "arc/input/keyboard.h"
|
||||
#include "arc/math/point.h"
|
||||
#include "arc/std/bool.h"
|
||||
#include "arc/std/entity.h"
|
||||
#include "arc/std/handler.h"
|
||||
|
||||
typedef struct ARC_EngineData {
|
||||
ARC_Window *window;
|
||||
ARC_Renderer *renderer;
|
||||
ARC_Handler *state;
|
||||
ARC_Input *input;
|
||||
ARC_Mouse *mouse;
|
||||
ARC_Keyboard *keyboard;
|
||||
ARC_Window *window;
|
||||
ARC_Renderer *renderer;
|
||||
ARC_Handler *state;
|
||||
ARC_Input *input;
|
||||
ARC_Mouse *mouse;
|
||||
ARC_Keyboard *keyboard;
|
||||
ARC_EntitySystem *entitySystem;
|
||||
|
||||
double dt;
|
||||
ARC_Bool running;
|
||||
|
|
@ -34,7 +36,7 @@ typedef struct ARC_EngineData {
|
|||
* @param cleanFn the state cleanup function
|
||||
* @param windowSIze the size of window to create passed as an ARC_Point
|
||||
*/
|
||||
void ARC_EngineData_Create(ARC_EngineData **data, ARC_Handler_CleanDataFn cleanFn, ARC_Point windowSize);
|
||||
void ARC_EngineData_Create(ARC_EngineData **data, ARC_Point windowSize);
|
||||
|
||||
/**
|
||||
* @breif destroys an ARC_EngineData type
|
||||
|
|
|
|||
|
|
@ -5,20 +5,54 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
typedef void (* ARC_State_UpdateFn)(void *data);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
typedef void (* ARC_State_RenderFn)(void *data);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
typedef void (* ARC_State_DestroyDataFn)(void *data);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
typedef struct ARC_State {
|
||||
ARC_State_UpdateFn updateFn;
|
||||
ARC_State_RenderFn renderFn;
|
||||
|
||||
void *data;
|
||||
ARC_State_DestroyDataFn *destroyDataFn;
|
||||
} ARC_State;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void ARC_State_Create(ARC_State **state, ARC_State_UpdateFn updateFn, ARC_State_RenderFn renderFn, void *data, ARC_State_DestroyDataFn *destroyDataFn);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void ARC_State_Destroy(ARC_State *state);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void ARC_State_Update(void *data);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void ARC_State_Render(void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // ARC_ENGINE_STATE_H_
|
||||
#endif // ARC_ENGINE_STATE_H_
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ extern "C" {
|
|||
#include "arc/math/rectangle.h"
|
||||
#include <stdint.h>
|
||||
|
||||
void ARC_Rect_Render(ARC_Rect *rect, ARC_Renderer *renderer, ARC_Color *color);
|
||||
void ARC_Rect_Render(ARC_Rect rect, ARC_Renderer *renderer, ARC_Color color);
|
||||
|
||||
void ARC_Rect_RenderFill(ARC_Rect *rect, ARC_Renderer *renderer, ARC_Color *color);
|
||||
void ARC_Rect_RenderFill(ARC_Rect rect, ARC_Renderer *renderer, ARC_Color color);
|
||||
|
||||
void ARC_FRect_Render(ARC_FRect *rect, ARC_Renderer *renderer, ARC_Color *color);
|
||||
void ARC_FRect_Render(ARC_FRect rect, ARC_Renderer *renderer, ARC_Color color);
|
||||
|
||||
void ARC_FRect_RenderFill(ARC_FRect *rect, ARC_Renderer *renderer, ARC_Color *color);
|
||||
void ARC_FRect_RenderFill(ARC_FRect rect, ARC_Renderer *renderer, ARC_Color color);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <stdint.h>
|
||||
#include "point.h"
|
||||
#include "vector2.h"
|
||||
#include "arc/std/bool.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -53,7 +54,7 @@ void ARC_FRect_CenterOn(ARC_FRect *rect, ARC_FRect *bounds);
|
|||
*
|
||||
* @return ARC_FRect
|
||||
*/
|
||||
ARC_FRect ARC_Rect_CastToFRect(ARC_Rect *rect);
|
||||
ARC_FRect ARC_Rect_CastToFRect(ARC_Rect rect);
|
||||
|
||||
/**
|
||||
* @brief casts FRect to Rect
|
||||
|
|
@ -62,7 +63,7 @@ ARC_FRect ARC_Rect_CastToFRect(ARC_Rect *rect);
|
|||
*
|
||||
* @return ARC_Rect
|
||||
*/
|
||||
ARC_Rect ARC_FRect_CastToRect(ARC_FRect *rect);
|
||||
ARC_Rect ARC_FRect_CastToRect(ARC_FRect rect);
|
||||
|
||||
/**
|
||||
* @brief checks if two ARC_Rects intersect
|
||||
|
|
@ -70,9 +71,9 @@ ARC_Rect ARC_FRect_CastToRect(ARC_FRect *rect);
|
|||
* @param rect1 ARC_Rect that will be checked against rect2
|
||||
* @param rect2 ARC_Rect that will be checked against rect1
|
||||
*
|
||||
* @return 1 if they intersect, 0 if they don't intersect
|
||||
* @return ARC_True if they intersect, ARC_False if they don't intersect
|
||||
*/
|
||||
int32_t ARC_Rect_Intersects(ARC_Rect *rect1, ARC_Rect *rect2);
|
||||
ARC_Bool ARC_Rect_Intersects(ARC_Rect rect1, ARC_Rect rect2);
|
||||
|
||||
/**
|
||||
* @brief checks if two ARC_FRects intersect
|
||||
|
|
@ -80,9 +81,9 @@ int32_t ARC_Rect_Intersects(ARC_Rect *rect1, ARC_Rect *rect2);
|
|||
* @param rect1 ARC_FRect that will be checked against rect2
|
||||
* @param rect2 ARC_FRect that will be checked against rect1
|
||||
*
|
||||
* @return 1 if they intersect, 0 if they don't intersect
|
||||
* @return ARC_True if they intersect, ARC_False if they don't intersect
|
||||
*/
|
||||
int32_t ARC_FRect_Intersects(ARC_FRect *rect1, ARC_FRect *rect2);
|
||||
ARC_Bool ARC_FRect_Intersects(ARC_FRect rect1, ARC_FRect rect2);
|
||||
|
||||
/**
|
||||
* @brief checks if ARC_Rect intersects with point
|
||||
|
|
@ -90,9 +91,9 @@ int32_t ARC_FRect_Intersects(ARC_FRect *rect1, ARC_FRect *rect2);
|
|||
* @param rect ARC_Rect that will be checked against point
|
||||
* @param point ARC_Point that will be checked against rect
|
||||
*
|
||||
* @return 1 if they intersect, 0 if they don't intersect
|
||||
* @return ARC_True if they intersect, ARC_False if they don't intersect
|
||||
*/
|
||||
int32_t ARC_Rect_IntersectsPoint(ARC_Rect *rect, ARC_Point *point);
|
||||
ARC_Bool ARC_Rect_IntersectsPoint(ARC_Rect rect, ARC_Point point);
|
||||
|
||||
/**
|
||||
* @brief checks if ARC_FRect intersects with point
|
||||
|
|
@ -100,9 +101,9 @@ int32_t ARC_Rect_IntersectsPoint(ARC_Rect *rect, ARC_Point *point);
|
|||
* @param rect ARC_FRect that will be checked against point
|
||||
* @param point ARC_Point that will be checked against rect
|
||||
*
|
||||
* @return 1 if they intersect, 0 if they don't intersect
|
||||
* @return ARC_True if they intersect, ARC_False if they don't intersect
|
||||
*/
|
||||
int32_t ARC_FRect_IntersectsPoint(ARC_FRect *rect, ARC_Point *point);
|
||||
ARC_Bool ARC_FRect_IntersectsPoint(ARC_FRect rect, ARC_Point point);
|
||||
|
||||
/**
|
||||
* @brief checks if ARC_Rect intersects a line
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue