small fixes for config, entity, and some physics functions for vector2
This commit is contained in:
parent
017629872f
commit
21a66f7fe6
5 changed files with 60 additions and 3 deletions
|
|
@ -28,6 +28,30 @@ void ARC_Vector2_Normalize(ARC_Vector2 *vector);
|
|||
*/
|
||||
void ARC_Vector2_RotateDegree(ARC_Vector2 *vector, float angle);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param vector1
|
||||
* @param vector2
|
||||
*/
|
||||
float ARC_Vector2_CrossProduct(ARC_Vector2 vector1, ARC_Vector2 vector2);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param vector
|
||||
* @param scalar
|
||||
*/
|
||||
ARC_Vector2 ARC_Vector2_CrossProductScalar(ARC_Vector2 vector, float scalar);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param scalar
|
||||
* @param vector
|
||||
*/
|
||||
ARC_Vector2 ARC_Vector2_ScalarCrossProduct(float scalar, ARC_Vector2 vector);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -221,7 +221,17 @@ void ARC_Config_UnloadFromString(ARC_Config *config, ARC_String **string);
|
|||
* @breif config the config to unload the file from
|
||||
* @breif path the location of the .chemical file to unload
|
||||
*/
|
||||
void ARC_Config_UnloadFromFile(ARC_Config *config, ARC_String *data);
|
||||
void ARC_Config_UnloadFromFile(ARC_Config *config, ARC_String *path);
|
||||
|
||||
/**
|
||||
* @brief takes a given file path and unloads it into the config
|
||||
*
|
||||
* @note this path will be based on wherever the executable is run from
|
||||
*
|
||||
* @breif config the config to unload the file from
|
||||
* @breif path the location of the .chemical file to unload
|
||||
*/
|
||||
void ARC_Config_UnloadFromFileWithCStr(ARC_Config *config, const char *path);
|
||||
|
||||
/**
|
||||
* @{
|
||||
|
|
|
|||
|
|
@ -16,3 +16,15 @@ void ARC_Vector2_RotateDegree(ARC_Vector2 *vector, float angle){
|
|||
vector->x = (temp.x * cos(angle)) - (temp.y * sin(angle));
|
||||
vector->y = (temp.x * sin(angle)) + (temp.y * cos(angle));
|
||||
}
|
||||
|
||||
float ARC_Vector2_CrossProduct(ARC_Vector2 vector1, ARC_Vector2 vector2){
|
||||
return (vector1.x * vector2.y) - (vector1.y * vector2.x);
|
||||
}
|
||||
|
||||
ARC_Vector2 ARC_Vector2_CrossProductScalar(ARC_Vector2 vector, float scalar){
|
||||
return (ARC_Vector2){ scalar * vector.y, -scalar * vector.x };
|
||||
}
|
||||
|
||||
ARC_Vector2 ARC_Vector2_ScalarCrossProduct(float scalar, ARC_Vector2 vector){
|
||||
return (ARC_Vector2){ -scalar * vector.y, scalar * vector.x };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1046,6 +1046,17 @@ void ARC_Config_UnloadFromFile(ARC_Config *config, ARC_String *path){
|
|||
ARC_Parser_ParseFile(config->parser, path);
|
||||
}
|
||||
|
||||
void ARC_Config_UnloadFromFileWithCStr(ARC_Config *config, const char *path){
|
||||
config->load = ARC_False;
|
||||
|
||||
ARC_String *pathString;
|
||||
ARC_String_CreateWithStrlen(&pathString, (char *)path);
|
||||
|
||||
ARC_Parser_ParseFile(config->parser, pathString);
|
||||
|
||||
ARC_String_Destroy(pathString);
|
||||
}
|
||||
|
||||
void ARC_Config_InitStd(ARC_Config *config){
|
||||
ARC_Config_RegisterTypeWithCStr(config, "bool" , (ARC_ConfigType){ sizeof(ARC_Bool) , ARC_ConfigType_BoolCopyFn , ARC_ConfigType_BoolDestroyFn , NULL });
|
||||
ARC_Config_RegisterTypeWithCStr(config, "int8" , (ARC_ConfigType){ sizeof(int8_t) , ARC_ConfigType_Int8CopyFn , ARC_ConfigType_Int8DestroyFn , NULL });
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ uint32_t ARC_EntitySystem_RegisterComponent(ARC_EntitySystem *entitySystem, uint
|
|||
uint32_t offsetEndIndex = ARC_VectorInline_GetSize(entitySystem->offsetVector);
|
||||
uint32_t totalSize = 0;
|
||||
if(ARC_VectorInline_GetSize(entitySystem->offsetVector) != 0){
|
||||
totalSize = *(uint32_t *)ARC_VectorInline_Get(entitySystem->offsetVector, offsetEndIndex);
|
||||
totalSize = *(uint32_t *)ARC_VectorInline_Get(entitySystem->offsetVector, offsetEndIndex - 1);
|
||||
}
|
||||
|
||||
//if the new component size would overflow, throw an error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue