summaryrefslogtreecommitdiff
path: root/src/honey.h
blob: 5401a47496f887314a5bc5bfd39d1b231772d3c4 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef HONEY_ENGINE_H
#define HONEY_ENGINE_H

/** @file honey.h
 * 
 * @brief Defines the basic loading and callback functions. 
*/

#include "common.h"

#include "camera.h"
#include "glm_bindings.h"
#include "input.h"
#include "light.h"
#include "mesh.h"
#include "primitives.h"
#include "shader.h"
#include "texture.h"
#include "window.h"

/** @struct Helper struct to wrap command-line options. */
typedef struct {
    bool verbose;
    char* script_directory;
    char* logfile;
} honey_options;

/** @brief Print usage help for honey. */
void honey_print_help();

/** @brief Parse command-line options for honey.
 *
 * This function returns false if the -h option was passed, for simplicity's sake.
 *
 * @param[in] argc The number of arguments passed to honey.
 * @param[in] argv Argument string array.
 * @param[out] options Pointer to the honey_options struct to populate.
 *
 * @returns true if parsing was successful and execution should continue;
 * false otherwise.
 */
bool honey_parse_options(honey_options* options, int argc, char** argv);

/** @brief Initialize Honey and set up lua bindings.
 *
 * @param[out] L The lua state with honey configured.
 * @param[out] window The GLFW window configured by honey. 
 * Also accessible from lua as honey.window.glfw_window.
 *
 * @returns true on a success; false otherwise.
 */
bool honey_setup(lua_State** L);

/** @brief The main game loop.
 *
 * @param[in] L The lua state honey was initialized in.
 * @param[in] opts The honey_options struct previously populated by honey_parse_options().
 */
bool honey_run(lua_State* L, honey_options opts);

/** @brief Get a registry reference to a given honey callback.
 *
 * @param[in] L The lua state to find the reference in.
 * @param[in] callback Name of the callback to find.
 *
 * @returns Registry reference to the function if it exists;
 * LUA_NOREF otherwise.
 */
int honey_get_callback(lua_State* L, char* callback);

/** @brief Set the current render target.
 *
 * @param[in] framebuffer The framebuffer to target, or 0 to target the window's framebuffer.
 *
 * @returns Nothing.
 */
int honey_set_framebuffer(lua_State* L);

#endif