2022-01-19 16:43:21 -06:00
|
|
|
#include "engine.h"
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-02-04 11:36:24 -06:00
|
|
|
#define STB_DS_IMPLEMENTATION
|
2022-02-07 08:50:34 -06:00
|
|
|
#include <stb_ds.h>
|
2022-02-04 11:36:24 -06:00
|
|
|
|
2022-06-30 10:31:23 -05:00
|
|
|
#define STB_TRUETYPE_IMPLEMENTATION
|
|
|
|
#include <stb_truetype.h>
|
2022-06-21 12:48:19 -05:00
|
|
|
|
2022-07-03 00:43:42 -05:00
|
|
|
#define STB_IMAGE_IMPLEMENTATION
|
|
|
|
#include "stb_image.h"
|
|
|
|
|
2022-06-23 02:34:51 -05:00
|
|
|
#define PL_MPEG_IMPLEMENTATION
|
|
|
|
#include <pl_mpeg.h>
|
|
|
|
|
2022-07-28 14:07:20 -05:00
|
|
|
#define STB_
|
|
|
|
|
2021-11-30 21:29:18 -06:00
|
|
|
#ifdef EDITOR
|
|
|
|
#include "editor.h"
|
|
|
|
#endif
|
|
|
|
|
2022-02-06 10:14:57 -06:00
|
|
|
#include "render.h"
|
|
|
|
|
2021-11-30 21:29:18 -06:00
|
|
|
#include "openglrender.h"
|
|
|
|
#include "window.h"
|
|
|
|
#include "camera.h"
|
|
|
|
#include "input.h"
|
|
|
|
#include "sprite.h"
|
|
|
|
#include "2dphysics.h"
|
|
|
|
#include "gameobject.h"
|
|
|
|
#include "registry.h"
|
2022-01-19 16:43:21 -06:00
|
|
|
#include "log.h"
|
|
|
|
#include "resources.h"
|
2022-02-06 10:14:57 -06:00
|
|
|
#include "timer.h"
|
|
|
|
#include "script.h"
|
2022-08-26 09:19:17 -05:00
|
|
|
|
2022-02-06 10:14:57 -06:00
|
|
|
#include "sound.h"
|
2022-01-19 16:43:21 -06:00
|
|
|
|
|
|
|
// TODO: Init on the heap
|
2022-02-04 11:36:24 -06:00
|
|
|
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-01-19 16:43:21 -06:00
|
|
|
#include "engine.h"
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-02-06 10:14:57 -06:00
|
|
|
void error_callback(int error, const char *description)
|
2021-11-30 21:29:18 -06:00
|
|
|
{
|
2022-02-06 10:14:57 -06:00
|
|
|
fprintf(stderr, "Error: %s\n", description);
|
|
|
|
}
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-02-06 10:14:57 -06:00
|
|
|
void engine_init()
|
|
|
|
{
|
2022-06-22 23:04:35 -05:00
|
|
|
glfwSetErrorCallback(error_callback);
|
2022-02-06 10:14:57 -06:00
|
|
|
/* Initialize GLFW */
|
|
|
|
if (!glfwInit()) {
|
|
|
|
printf("Could not init GLFW\n");
|
2022-01-19 16:43:21 -06:00
|
|
|
}
|
2022-06-22 23:04:35 -05:00
|
|
|
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-02-06 10:14:57 -06:00
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
|
|
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
2022-02-01 14:50:25 -06:00
|
|
|
|
|
|
|
|
|
|
|
resources_init();
|
|
|
|
script_init();
|
2022-01-19 16:43:21 -06:00
|
|
|
registry_init();
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-08-26 09:19:17 -05:00
|
|
|
//stbi_set_flip_vertically_on_load(1);
|
2021-11-30 21:29:18 -06:00
|
|
|
phys2d_init();
|
2022-01-19 16:43:21 -06:00
|
|
|
gui_init();
|
|
|
|
sound_init();
|
|
|
|
}
|
2021-11-30 21:29:18 -06:00
|
|
|
|
2022-01-19 16:43:21 -06:00
|
|
|
void engine_stop()
|
|
|
|
{
|
2022-02-06 10:14:57 -06:00
|
|
|
glfwTerminate();
|
|
|
|
}
|