88 lines
1.7 KiB
C
88 lines
1.7 KiB
C
#ifndef ENGINE_H
|
|
#define ENGINE_H
|
|
|
|
#include "GLFW/glfw3.h"
|
|
#include "gpu.h"
|
|
#include "ui.h"
|
|
#include "hex.h"
|
|
|
|
typedef struct ClientContextStruct ClientContext;
|
|
|
|
typedef bool (*app_text_callback)(
|
|
ClientContext* context,
|
|
unsigned int codepoint);
|
|
|
|
typedef bool (*app_key_callback)(
|
|
ClientContext* context,
|
|
int key,
|
|
int action,
|
|
int mods);
|
|
|
|
typedef bool (*app_button_callback)(
|
|
ClientContext* context,
|
|
float x,
|
|
float y,
|
|
int button,
|
|
int action,
|
|
int mods);
|
|
|
|
typedef bool (*app_scroll_callback)(
|
|
ClientContext* context,
|
|
double x,
|
|
double y);
|
|
|
|
typedef bool (*app_cursor_callback)(
|
|
ClientContext* context,
|
|
float x,
|
|
float y);
|
|
|
|
typedef void (*app_frame_function)(
|
|
ClientContext* context);
|
|
|
|
typedef void (*app_startup_function)(
|
|
ClientContext* context);
|
|
|
|
struct ClientContextStruct {
|
|
GLFWwindow* window;
|
|
|
|
RenderContext render;
|
|
UIContext ui;
|
|
HexContext hex;
|
|
|
|
vec3 position;
|
|
vec3 velocity;
|
|
|
|
vec2 rotation;
|
|
int32_t key_spin[2];
|
|
vec2 cur_spin;
|
|
|
|
double distance;
|
|
int32_t zoom;
|
|
|
|
bool camera_mode;
|
|
float key_spin_speed;
|
|
float cur_spin_speed;
|
|
float zoom_speed;
|
|
float move_speed;
|
|
|
|
void* app_data;
|
|
app_frame_function app_frame;
|
|
app_text_callback app_text;
|
|
app_key_callback app_key;
|
|
app_button_callback app_button;
|
|
app_scroll_callback app_scroll;
|
|
app_cursor_callback app_cursor;
|
|
};
|
|
|
|
int run_app(
|
|
void* app_data,
|
|
app_startup_function app_startup,
|
|
app_frame_function app_frame,
|
|
app_text_callback app_text,
|
|
app_key_callback app_key,
|
|
app_button_callback app_button,
|
|
app_scroll_callback app_scroll,
|
|
app_cursor_callback app_cursor);
|
|
|
|
#endif
|