summaryrefslogtreecommitdiff
path: root/src/honey.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/honey.h')
-rw-r--r--src/honey.h50
1 files changed, 35 insertions, 15 deletions
diff --git a/src/honey.h b/src/honey.h
index c134894..b349475 100644
--- a/src/honey.h
+++ b/src/honey.h
@@ -17,28 +17,38 @@
#include "shader/shader.h"
#include "texture/texture.h"
-/** @brief Initialize Honey.
- *
- * @param[in] screen_width The desired width of the screen in pixels
- * @param[in] screen_height The desired height of the screen in pixels
- * @param[in] window_title Title to use for the window.
- */
-honey_window honey_setup(int screen_width, int screen_height, char* window_title);
+/** @struct Helper struct to wrap command-line options. */
+typedef struct {
+ bool verbose;
+ char* script_directory;
+ char* logfile;
+} honey_options;
-static void (*honey_update_callback)(float dt);
-static void (*honey_draw_callback)();
+/** @brief Print usage help for honey. */
+void honey_print_help();
-/** @brief Set the main update function.
+/** @brief Parse command-line options for honey.
+ *
+ * This function returns false if the -h option was passed, for simplicity's sake.
*
- * @param[in] update_callback The function to call every loop
+ * @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.
*/
-void honey_set_update_callback(void (*update_callback)(float));
+bool honey_parse_options(honey_options* options, int argc, char** argv);
-/** @brief Set the main draw function
+/** @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.
*
- * @param[in] draw_callback The function to call every draw cycle
+ * @returns true on a success; false otherwise.
*/
-void honey_set_draw_callback(void (*draw_callback)());
+bool honey_setup(lua_State** L, honey_window* window);
/** @brief The main game loop.
*
@@ -46,6 +56,16 @@ void honey_set_draw_callback(void (*draw_callback)());
*/
void honey_run(honey_window window);
+/** @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);
+
#define honey_set_resize_callback glfwSetFramebufferSizeCallback
#define honey_set_mouse_move_callback glfwSetCursorPosCallback