Added function headers.
This commit is contained in:
parent
6192a8f819
commit
c69f260790
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd $(dirname "$(pwd)/$0")
|
||||
REPOSITORY_FOLDER=$(pwd)
|
||||
|
@ -7,13 +8,17 @@ PROJECT_NAME="maintree"
|
|||
DEBUG_CC_OPTIONS="-g2 -Wall -Wextra -Wpedantic"
|
||||
RELEASE_CC_OPTIONS="-O3 -Wall"
|
||||
|
||||
MAIN_OBJECTS_FOLDER=".build/objects/"
|
||||
MAIN_OBJECTS_FOLDER="$REPOSITORY_FOLDER/.build/objects/"
|
||||
CONFIG_FILE_INCLUDE_PATHS="build-config/include_paths.txt"
|
||||
|
||||
function clone_dependencies {
|
||||
echo "================ Cloning Dependencies! ================"
|
||||
mkdir -p .build/depends/libRR
|
||||
cd .build/depends/libRR/
|
||||
if [[ -d "Core" ]]
|
||||
then
|
||||
rm -rf Core
|
||||
fi
|
||||
git clone --depth=1 https://git.nerdcult.net/libRR/Core/
|
||||
|
||||
cd "$REPOSITORY_FOLDER"
|
||||
|
@ -132,7 +137,7 @@ case $1 in
|
|||
echo "[ d | dbg | debug ]: Build in the debug profile; build with debug symbols."
|
||||
echo "[ r | release ]: Build for a release, with speed optimizations."
|
||||
echo "[ c | clone-dependencies]: Clone the dependencies using Git (network required)."
|
||||
echo "[ c | build-dependencies]: Build the dependencies (which must have been cloned first!)."
|
||||
echo "[ b | build-dependencies]: Build the dependencies (which must have been cloned first!)."
|
||||
echo "[ h | help ]: Display this message."
|
||||
echo ""
|
||||
echo "Note: Before being able to build (debug-profile / release-profile), cloning and building the dependencies is required!"
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
// Exported functions of MainTree
|
||||
|
||||
#ifndef MAINTREE_H
|
||||
#define MAINTREE_H
|
||||
|
||||
#include <librr/types.h>
|
||||
#include <librr/linear_algebra.h>
|
||||
|
||||
typedef void * MtType;
|
||||
typedef void * MtEntity;
|
||||
|
||||
/// @brief: An MtTask is a piece of functionality with an own state/context which will be executed on the same thread or set of threads.
|
||||
typedef void * MtTask;
|
||||
typedef void * MtState;
|
||||
|
||||
|
||||
|
||||
typedef void (*mt_type_effector_fn) (MtType type);
|
||||
typedef void (*mt_entity_effector_fn) (MtEntity entity);
|
||||
typedef void (*mt_task_type_effector_fn) (MtTask task, MtType type, void *userdata);
|
||||
typedef void (*mt_task_entity_effector_fn) (MtTask task, MtEntity entity, void *userdata);
|
||||
typedef void (*mt_task_main_fn) (MtTask task, void *userdata);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *task_name;
|
||||
usz_t min_num_threads;
|
||||
usz_t max_num_threads;
|
||||
void *userdata;
|
||||
|
||||
} MtTaskCreationInfo;
|
||||
|
||||
|
||||
|
||||
MtState mt_create_state(char *app_name);
|
||||
void mt_cleanup(MtState state);
|
||||
void mt_start(MtState state);
|
||||
|
||||
MtType mt_register_type(char *identifier);
|
||||
void mt_forget_type(MtType type);
|
||||
|
||||
MtEntity mt_make(MtType type);
|
||||
void mt_add_registration_effector(MtState state, char *effector_name, mt_type_effector_fn function);
|
||||
void mt_add_create_effector(MtType type, char *effector_name, mt_entity_effector_fn function);
|
||||
void mt_add_delete_effector(MtType type, char *effector_name, mt_entity_effector_fn function);
|
||||
void mt_add_item_tick_effector(MtType type, char *effector_name, usz_t ticks_delta, mt_entity_effector_fn function);
|
||||
void mt_add_tick_effector(MtState state, char *effector_name, usz_t ticks_delta, mt_entity_effector_fn function);
|
||||
void mt_task_remove_effector(MtState task, const char *effector_name);
|
||||
|
||||
/// @brief Adds a tick effector which only acts upon entitys with certain tags.
|
||||
/// @param type The type for which to add the tick effector.
|
||||
/// @param effector_name The name of the effector. This will be copied into the effector's structure.
|
||||
/// @param ticks_delta The wanted number of ticks between two invocations of the effector
|
||||
/// @param function The function to call for an entity if it contains all necessary tags.
|
||||
/// @param tag_names A nullpointer-terminated list of tag-ids that must be present in an entity for that entity to be effected.
|
||||
void mt_add_tagged_tick_effector(MtType type, char *effector_name, usz_t ticks_delta, mt_entity_effector_fn function, char **tag_names);
|
||||
|
||||
void mt_tag_i64(MtEntity entity, char *name, i64_t integer);
|
||||
void mt_tag_f64(MtEntity entity, char *name, f64_t real);
|
||||
void mt_tag_str(MtEntity entity, char *name, char *string);
|
||||
void mt_tag_ptr(MtEntity entity, char *name, void *pointer);
|
||||
void mt_tag_vec2(MtEntity entity, char *name, rr_vec2f_s vector);
|
||||
void mt_tag_vec3(MtEntity entity, char *name, rr_vec2f_s vector);
|
||||
void mt_tag_vec4(MtEntity entity, char *name, rr_vec4f_s vector);
|
||||
|
||||
i64_t mt_untag_i64(MtEntity entity, char *name);
|
||||
f64_t mt_untag_f64(MtEntity entity, char *name);
|
||||
char * mt_untag_str(MtEntity entity, char *name);
|
||||
void * mt_untag_ptr(MtEntity entity, char *name);
|
||||
rr_vec2f_s mt_untag_vec2(MtEntity entity, char *name);
|
||||
rr_vec3f_s mt_untag_vec3(MtEntity entity, char *name);
|
||||
rr_vec4f_s mt_untag_vec4(MtEntity entity, char *name);
|
||||
|
||||
|
||||
|
||||
MtTask mt_create_task(MtState state, MtTaskCreationInfo creation_info);
|
||||
void mt_delete_task(MtTask task);
|
||||
|
||||
void mt_task_add_registration_effector(MtTask task, char *effector_name, mt_task_type_effector_fn function);
|
||||
void mt_task_add_create_effector(MtTask task, MtType type, char *effector_name, mt_task_entity_effector_fn function);
|
||||
void mt_task_add_delete_effector(MtTask task, MtType type, char *effector_name, mt_task_entity_effector_fn function);
|
||||
void mt_task_add_tick_effector(MtTask task, MtType type, char *effector_name, usz_t ticks_delta, mt_task_entity_effector_fn function);
|
||||
void mt_task_add_entity_tick_effector(MtTask task, MtType type, char *effector_name, usz_t ticks_delta, mt_task_entity_effector_fn function);
|
||||
void mt_task_add_tagged_tick_effector(MtTask task, MtType type, char *effector_name, usz_t ticks_delta, mt_task_entity_effector_fn function, char **tag_names);
|
||||
void mt_task_add_main_function(MtTask task, mt_task_main_fn function);
|
||||
void mt_task_remove_effector(MtTask task, const char *effector_name);
|
||||
|
||||
#endif // MAINTREE_H
|
Reference in New Issue