85 lines
1.6 KiB
C
85 lines
1.6 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 void (*app_text_callback)(
|
|
ClientContext* context,
|
|
unsigned int codepoint);
|
|
|
|
typedef void (*app_key_callback)(
|
|
ClientContext* context,
|
|
int key,
|
|
int action,
|
|
int mods);
|
|
|
|
typedef void (*app_button_callback)(
|
|
ClientContext* context,
|
|
float x,
|
|
float y,
|
|
int button,
|
|
int action,
|
|
int mods);
|
|
|
|
typedef void (*app_scroll_callback)(
|
|
ClientContext* context,
|
|
double x,
|
|
double y);
|
|
|
|
typedef void (*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 spin[2];
|
|
|
|
double distance;
|
|
int32_t zoom;
|
|
|
|
float 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
|