summaryrefslogtreecommitdiff
path: root/include/state.h
blob: 3e7836d0a4cbdd6bb24a329139f120859ca7f4d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once

#if defined PLATFORM_DESKTOP_SDL2 || defined PLATFORM_DESKTOP_SDL3
	#define PLATFORM_SDL_EVENT_QUEUE_LEN 128
#endif

typedef struct {
	char* basePath;
	bool run;
	bool hasWindow;
	bool gcUnload;
	bool customFontLoaded;
	Vector2 resolution;
	int lineSpacing; /* We need to store copy here since raylib has it in static. */
	Vector2 mouseOffset;
	Vector2 mouseScale;
	lua_State* luaState;
	int logLevelInvalid;
	Font defaultFont;
	Font guiFont;
	Material defaultMaterial;
	Texture defaultTexture;
	Texture shapesTexture;
	int* RLGLcurrentShaderLocs;
	/* Events. */
#ifdef PLATFORM_DESKTOP
	/* Window events. */
	GLFWwindowsizefun raylibWindowSizeCallback;
	GLFWwindowmaximizefun raylibWindowMaximizeCallback;
	GLFWwindowiconifyfun raylibWindowIconifyCallback;
	GLFWwindowfocusfun raylibWindowFocusCallback;
	GLFWdropfun raylibWindowDropCallback;
	/* Input events. */
	GLFWkeyfun raylibKeyCallback;
	GLFWcharfun raylibCharCallback;
	GLFWmousebuttonfun raylibMouseButtonCallback;
	GLFWcursorposfun raylibMouseCursorPosCallback;
	GLFWscrollfun raylibMouseScrollCallback;
	GLFWcursorenterfun raylibCursorEnterCallback;
	GLFWjoystickfun raylibJoystickCallback;
	/* NOTE! Experimental. Needs glfw PR https://github.com/glfw/glfw/pull/1445 */
	GLFWpentabletdatafun glfwTabletDataCallback;
	GLFWpentabletcursorfun glfwTabletCursorCallback;
	GLFWpentabletproximityfun glfwTabletProximityCallback;
#elif defined PLATFORM_DESKTOP_SDL2 || defined PLATFORM_DESKTOP_SDL3
	int SDL_eventQueueLen;
	SDL_Event* SDL_eventQueue;
#endif
} State;

extern State* state;

bool stateInit( int argn, const char** argc, const char* basePath );
void stateContextInit();
void stateInitInterpret( int argn, const char** argc );
void stateFree();