colysis/alyson/includes/alyson.h

118 lines
2.5 KiB
C

#pragma once
#ifndef ALYSON_HPP
#define ALYSON_HPP
#ifndef ASSETS_PATH
#define ASSETS_PATH "./assets/"
#endif
#define MANGLE_RES_PATH(path) ASSETS_PATH "/" path
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include "types.h"
#define ALYSIS_ENGINE_WINDOW_TITLE "Alyson Engine"
typedef struct {
char type[4 + 1];
char group[26 + 1];
char* name;
char* path;
} alyson_path_t, *ALPath;
/*
* @function: demangle_path
* @description: Demangles a path
* @param path: path to resource
* @return: ALPath
*/
ALPath al_demangle_path(const char* path);
char* al_mangle_path(const ALPath path);
ALPath al_create_path(
const char* type,
const char* path,
const char* name,
const char* group
);
void al_destroy_path(ALPath path);
typedef struct {
int argc;
char** argv;
} alyson_args_t, *ALArgs;
ALArgs al_args_create(int argc, char** argv);
void al_args_destroy(ALArgs args);
typedef struct {
usx id;
alyson_path_t path;
} alyson_resource_t, *ALResource;
ALResource al_resource_create(ALPath path);
ALResource al_resource_create_from_file(char* name, char* path);
void al_resource_destroy(ALResource resource);
/* TODO : implement
typedef struct {
ALResource* resources;
usx count;
usx capacity;
} alyson_resource_manager_t, *ALResourceManager;
ALResourceManager al_resource_manager_create();
void al_resource_manager_destroy(ALResourceManager manager);
void al_resource_manager_add(ALResourceManager manager, ALResource resource);
void al_resource_manager_remove(ALResourceManager manager, usx id);
void al_resource_manager_clear(ALResourceManager manager);
typedef struct {
ALResourceManager resources_manager;
usx id;
char* name;
usx width;
usx height;
} alyson_window_t, *ALWindow;
ALWindow al_window_create(char* name, int width, int height);
void al_window_destroy(ALWindow window);
#include <flecs.h>
typedef struct {
ALWindow wnd;
ecs_world_t* engine;
ecs_world_t* ui;
} alyson_engine_t, *ALEngine;
ALEngine al_engine_create(ALArgs args, ALWindow wnd = NULL);
void al_engine_destroy(ALEngine engine);
void al_engine_run(ALEngine engine);
void al_engine_stop(ALEngine engine);
bool al_engine_is_running(ALEngine engine);
bool al_engine_is_stopped(ALEngine engine);
void al_engine_update(ALEngine engine);
void al_engine_draw(ALEngine engine);
void al_engine_draw_ui(ALEngine engine);
void al_engine_set_window(ALEngine engine, ALWindow wnd);
ALWindow al_engine_get_window(ALEngine engine);
*/
#ifdef __cplusplus
}
#endif
#endif // ALYSON_HPP