LCGE  v0.3.0-alpha
A Lightweight C game engine built with OpenGL
lcge.h File Reference

Header file to include when using the LCGE engine. More...

Go to the source code of this file.

Data Structures

struct  LCGE_cursor_pos
 

Macros

#define LCGE_IMPORT
 
#define LCGE_WINDOW_OPEN   1
 
#define LCGE_WINDOW_CLOSED   0
 
#define LCGE_INIT_ERR   -1
 
#define LCGE_INIT_OK   0
 
#define LCGE_RESIZEABLE   1
 
#define LCGE_NON_RESIZEABLE   0
 
#define LCGE_CONTEXT_ERR   -1
 
#define LCGE_CONTEXT_OK   1
 
#define LCGE_KEY_SPACE   32
 
#define LCGE_KEY_APOSTROPHE   39 /* ' */
 
#define LCGE_KEY_COMMA   44 /* , */
 
#define LCGE_KEY_MINUS   45 /* - */
 
#define LCGE_KEY_PERIOD   46 /* . */
 
#define LCGE_KEY_SLASH   47 /* / */
 
#define LCGE_KEY_0   48
 
#define LCGE_KEY_1   49
 
#define LCGE_KEY_2   50
 
#define LCGE_KEY_3   51
 
#define LCGE_KEY_4   52
 
#define LCGE_KEY_5   53
 
#define LCGE_KEY_6   54
 
#define LCGE_KEY_7   55
 
#define LCGE_KEY_8   56
 
#define LCGE_KEY_9   57
 
#define LCGE_KEY_SEMICOLON   59 /* ; */
 
#define LCGE_KEY_EQUAL   61 /* = */
 
#define LCGE_KEY_A   65
 
#define LCGE_KEY_B   66
 
#define LCGE_KEY_C   67
 
#define LCGE_KEY_D   68
 
#define LCGE_KEY_E   69
 
#define LCGE_KEY_F   70
 
#define LCGE_KEY_G   71
 
#define LCGE_KEY_H   72
 
#define LCGE_KEY_I   73
 
#define LCGE_KEY_J   74
 
#define LCGE_KEY_K   75
 
#define LCGE_KEY_L   76
 
#define LCGE_KEY_M   77
 
#define LCGE_KEY_N   78
 
#define LCGE_KEY_O   79
 
#define LCGE_KEY_P   80
 
#define LCGE_KEY_Q   81
 
#define LCGE_KEY_R   82
 
#define LCGE_KEY_S   83
 
#define LCGE_KEY_T   84
 
#define LCGE_KEY_U   85
 
#define LCGE_KEY_V   86
 
#define LCGE_KEY_W   87
 
#define LCGE_KEY_X   88
 
#define LCGE_KEY_Y   89
 
#define LCGE_KEY_Z   90
 
#define LCGE_KEY_LEFT_BRACKET   91 /* [ */
 
#define LCGE_KEY_BACKSLASH   92 /* \ */
 
#define LCGE_KEY_RIGHT_BRACKET   93 /* ] */
 
#define LCGE_KEY_GRAVE_ACCENT   96 /* ` */
 
#define LCGE_KEY_WORLD_1   161 /* non-US #1 */
 
#define LCGE_KEY_WORLD_2   162 /* non-US #2 */
 
#define LCGE_KEY_ESCAPE   256
 
#define LCGE_KEY_ENTER   257
 
#define LCGE_KEY_TAB   258
 
#define LCGE_KEY_BACKSPACE   259
 
#define LCGE_KEY_INSERT   260
 
#define LCGE_KEY_DELETE   261
 
#define LCGE_KEY_RIGHT   262
 
#define LCGE_KEY_LEFT   263
 
#define LCGE_KEY_DOWN   264
 
#define LCGE_KEY_UP   265
 
#define LCGE_KEY_PAGE_UP   266
 
#define LCGE_KEY_PAGE_DOWN   267
 
#define LCGE_KEY_HOME   268
 
#define LCGE_KEY_END   269
 
#define LCGE_KEY_CAPS_LOCK   280
 
#define LCGE_KEY_SCROLL_LOCK   281
 
#define LCGE_KEY_NUM_LOCK   282
 
#define LCGE_KEY_PRINT_SCREEN   283
 
#define LCGE_KEY_PAUSE   284
 
#define LCGE_KEY_F1   290
 
#define LCGE_KEY_F2   291
 
#define LCGE_KEY_F3   292
 
#define LCGE_KEY_F4   293
 
#define LCGE_KEY_F5   294
 
#define LCGE_KEY_F6   295
 
#define LCGE_KEY_F7   296
 
#define LCGE_KEY_F8   297
 
#define LCGE_KEY_F9   298
 
#define LCGE_KEY_F10   299
 
#define LCGE_KEY_F11   300
 
#define LCGE_KEY_F12   301
 
#define LCGE_KEY_F13   302
 
#define LCGE_KEY_F14   303
 
#define LCGE_KEY_F15   304
 
#define LCGE_KEY_F16   305
 
#define LCGE_KEY_F17   306
 
#define LCGE_KEY_F18   307
 
#define LCGE_KEY_F19   308
 
#define LCGE_KEY_F20   309
 
#define LCGE_KEY_F21   310
 
#define LCGE_KEY_F22   311
 
#define LCGE_KEY_F23   312
 
#define LCGE_KEY_F24   313
 
#define LCGE_KEY_F25   314
 
#define LCGE_KEY_KP_0   320
 
#define LCGE_KEY_KP_1   321
 
#define LCGE_KEY_KP_2   322
 
#define LCGE_KEY_KP_3   323
 
#define LCGE_KEY_KP_4   324
 
#define LCGE_KEY_KP_5   325
 
#define LCGE_KEY_KP_6   326
 
#define LCGE_KEY_KP_7   327
 
#define LCGE_KEY_KP_8   328
 
#define LCGE_KEY_KP_9   329
 
#define LCGE_KEY_KP_DECIMAL   330
 
#define LCGE_KEY_KP_DIVIDE   331
 
#define LCGE_KEY_KP_MULTIPLY   332
 
#define LCGE_KEY_KP_SUBTRACT   333
 
#define LCGE_KEY_KP_ADD   334
 
#define LCGE_KEY_KP_ENTER   335
 
#define LCGE_KEY_KP_EQUAL   336
 
#define LCGE_KEY_LEFT_SHIFT   340
 
#define LCGE_KEY_LEFT_CONTROL   341
 
#define LCGE_KEY_LEFT_ALT   342
 
#define LCGE_KEY_LEFT_SUPER   343
 
#define LCGE_KEY_RIGHT_SHIFT   344
 
#define LCGE_KEY_RIGHT_CONTROL   345
 
#define LCGE_KEY_RIGHT_ALT   346
 
#define LCGE_KEY_RIGHT_SUPER   347
 
#define LCGE_KEY_MENU   348
 
#define LCGE_KEY_PRESSED   1
 
#define LCGE_KEY_RELEASED   -1
 
#define LCGE_MOUSE_BUTTON_1   0
 
#define LCGE_MOUSE_BUTTON_2   1
 
#define LCGE_MOUSE_BUTTON_3   2
 
#define LCGE_MOUSE_BUTTON_4   3
 
#define LCGE_MOUSE_BUTTON_5   4
 
#define LCGE_MOUSE_BUTTON_6   5
 
#define LCGE_MOUSE_BUTTON_7   6
 
#define LCGE_MOUSE_BUTTON_8   7
 
#define LCGE_MOUSE_BUTTON_LAST   LCGE_MOUSE_BUTTON_8
 
#define LCGE_MOUSE_BUTTON_LEFT   LCGE_MOUSE_BUTTON_1
 
#define LCGE_MOUSE_BUTTON_RIGHT   LCGE_MOUSE_BUTTON_2
 
#define LCGE_MOUSE_BUTTON_MIDDLE   LCGE_MOUSE_BUTTON_3
 
#define LCGE_MOUSE_BUTTON_PRESSED   1
 
#define LCGE_MOUSE_BUTTON_RELEASED   -1
 

Typedefs

typedef struct LCGE_rect LCGE_rect
 A 2D rectangle. More...
 
typedef struct LCGE_image LCGE_image
 A 2D image. More...
 
typedef struct LCGE_clock LCGE_clock
 Basic FPS clock. More...
 
typedef struct LCGE_cursor_pos LCGE_cursor_pos
 
typedef struct LCGE_font LCGE_font
 A true type font. More...
 
typedef struct LCGE_text LCGE_text
 2D text. More...
 
typedef struct LCGE_line LCGE_line
 

Functions

LCGE_IMPORT int lcge_init (const char *lcge_res_dir)
 Initializes LCGE. More...
 
LCGE_IMPORT int lcge_create_context (unsigned int width, unsigned int height, const char *title, int resizable)
 Create a window and get back a handle. More...
 
LCGE_IMPORT int lcge_window_is_open ()
 Returns whether or not the window is still open. More...
 
LCGE_IMPORT void lcge_exit ()
 Exits lcge. More...
 
LCGE_IMPORT void lcge_window_clear ()
 Clears the window. More...
 
LCGE_IMPORT void lcge_window_update ()
 Updates the window and polls for events. More...
 
LCGE_IMPORT LCGE_rectlcge_rect_load (float x, float y, float width, float height)
 Loads rectangle data and returns a handle. More...
 
LCGE_IMPORT void lcge_rect_delete (LCGE_rect *rect)
 Deletes a rectangle. More...
 
LCGE_IMPORT void lcge_rect_draw (LCGE_rect *rect, float r, float g, float b)
 Draw a loaded rectangle to the screen. More...
 
LCGE_IMPORT void lcge_rect_set (LCGE_rect *rect, float x, float y, float width, float height)
 Updates rectangle data for a loaded rectangle. More...
 
LCGE_IMPORT void lcge_rect_rotate (LCGE_rect *rect, float angle)
 Rotates a loaded rectangle. More...
 
LCGE_IMPORT float lcge_rect_get_x (LCGE_rect *rect)
 Gets the rectangle x value. More...
 
LCGE_IMPORT float lcge_rect_get_y (LCGE_rect *rect)
 Gets the rectangle y value. More...
 
LCGE_IMPORT float lcge_rect_get_width (LCGE_rect *rect)
 Gets the rectangle width. More...
 
LCGE_IMPORT float lcge_rect_get_height (LCGE_rect *rect)
 Gets the rectangle height. More...
 
LCGE_IMPORT LCGE_imagelcge_image_load (const char *filepath, float x, float y, float width, float height)
 Loads an image from a file. More...
 
LCGE_IMPORT void lcge_image_delete (LCGE_image *image)
 Deletes an image. More...
 
LCGE_IMPORT void lcge_image_rotate (LCGE_image *image, float angle)
 Rotates an image. More...
 
LCGE_IMPORT void lcge_image_reflect (LCGE_image *image)
 Reflects an image horizontally 180 deg. More...
 
LCGE_IMPORT void lcge_image_set (LCGE_image *image, float x, float y, float width, float height)
 Sets new data for a loaded image. More...
 
LCGE_IMPORT void lcge_image_draw (LCGE_image *image)
 Draws a loaded image to the screen. More...
 
LCGE_IMPORT float lcge_image_get_x (LCGE_image *image)
 Gets image x. More...
 
LCGE_IMPORT float lcge_image_get_y (LCGE_image *image)
 Gets image y. More...
 
LCGE_IMPORT float lcge_image_get_width (LCGE_image *image)
 Gets image width. More...
 
LCGE_IMPORT float lcge_image_get_height (LCGE_image *image)
 Gets image height. More...
 
LCGE_IMPORT LCGE_clocklcge_clock_create (unsigned int fps)
 Creates a clock. More...
 
LCGE_IMPORT void lcge_clock_delete (LCGE_clock *clock)
 Deletes a clock. More...
 
LCGE_IMPORT void lcge_clock_tick (LCGE_clock *clock)
 tickst the clock. More...
 
LCGE_IMPORT int lcge_get_key (int key)
 Gets the input status of a key. More...
 
LCGE_IMPORT int lcge_get_mouse_button (int button)
 Gets input status of a mouse button. More...
 
LCGE_IMPORT LCGE_cursor_pos lcge_get_cursor_position ()
 
LCGE_IMPORT LCGE_fontlcge_font_load (const char *filepath, float height)
 Loads a font. More...
 
LCGE_IMPORT void lcge_font_delete (LCGE_font *font)
 Deletes a font. More...
 
LCGE_IMPORT LCGE_textlcge_text_load (const char *text, float x, float y, LCGE_font *font)
 Loads a 2D text struct. More...
 
LCGE_IMPORT void lcge_text_delete (LCGE_text *text)
 Deletes a text struct. More...
 
LCGE_IMPORT void lcge_text_draw (LCGE_text *text, float r, float g, float b)
 Draws 2D text. More...
 
LCGE_IMPORT void lcge_text_set (LCGE_text *text, const char *n_text, float x, float y)
 Set new data for text. More...
 
LCGE_IMPORT float lcge_text_get_x (LCGE_text *text)
 Gets x value of text. More...
 
LCGE_IMPORT float lcge_text_get_y (LCGE_text *text)
 Gets y value of text. More...
 
LCGE_IMPORT float lcge_text_get_width (LCGE_text *text)
 Gets the width of the text. More...
 
LCGE_IMPORT float lcge_text_get_height (LCGE_text *text)
 Gets the height of the text. More...
 
LCGE_IMPORT LCGE_linelcge_line_load (float x0, float y0, float x1, float y1)
 
LCGE_IMPORT void lcge_line_delete (LCGE_line *line)
 
LCGE_IMPORT void lcge_line_draw (LCGE_line *line, float r, float g, float b)
 
LCGE_IMPORT void lcge_line_set (LCGE_line *line, float x0, float y0, float x1, float y1)
 

Detailed Description

Header file to include when using the LCGE engine.

Author
Satvik Reddy

LCGE is a 2D game engine written in C that uses the OpenGL graphics API.

Macro Definition Documentation

◆ LCGE_IMPORT

#define LCGE_IMPORT

◆ LCGE_WINDOW_OPEN

#define LCGE_WINDOW_OPEN   1

◆ LCGE_WINDOW_CLOSED

#define LCGE_WINDOW_CLOSED   0

◆ LCGE_INIT_ERR

#define LCGE_INIT_ERR   -1

◆ LCGE_INIT_OK

#define LCGE_INIT_OK   0

◆ LCGE_RESIZEABLE

#define LCGE_RESIZEABLE   1

◆ LCGE_NON_RESIZEABLE

#define LCGE_NON_RESIZEABLE   0

◆ LCGE_CONTEXT_ERR

#define LCGE_CONTEXT_ERR   -1

◆ LCGE_CONTEXT_OK

#define LCGE_CONTEXT_OK   1

◆ LCGE_KEY_SPACE

#define LCGE_KEY_SPACE   32

◆ LCGE_KEY_APOSTROPHE

#define LCGE_KEY_APOSTROPHE   39 /* ' */

◆ LCGE_KEY_COMMA

#define LCGE_KEY_COMMA   44 /* , */

◆ LCGE_KEY_MINUS

#define LCGE_KEY_MINUS   45 /* - */

◆ LCGE_KEY_PERIOD

#define LCGE_KEY_PERIOD   46 /* . */

◆ LCGE_KEY_SLASH

#define LCGE_KEY_SLASH   47 /* / */

◆ LCGE_KEY_0

#define LCGE_KEY_0   48

◆ LCGE_KEY_1

#define LCGE_KEY_1   49

◆ LCGE_KEY_2

#define LCGE_KEY_2   50

◆ LCGE_KEY_3

#define LCGE_KEY_3   51

◆ LCGE_KEY_4

#define LCGE_KEY_4   52

◆ LCGE_KEY_5

#define LCGE_KEY_5   53

◆ LCGE_KEY_6

#define LCGE_KEY_6   54

◆ LCGE_KEY_7

#define LCGE_KEY_7   55

◆ LCGE_KEY_8

#define LCGE_KEY_8   56

◆ LCGE_KEY_9

#define LCGE_KEY_9   57

◆ LCGE_KEY_SEMICOLON

#define LCGE_KEY_SEMICOLON   59 /* ; */

◆ LCGE_KEY_EQUAL

#define LCGE_KEY_EQUAL   61 /* = */

◆ LCGE_KEY_A

#define LCGE_KEY_A   65

◆ LCGE_KEY_B

#define LCGE_KEY_B   66

◆ LCGE_KEY_C

#define LCGE_KEY_C   67

◆ LCGE_KEY_D

#define LCGE_KEY_D   68

◆ LCGE_KEY_E

#define LCGE_KEY_E   69

◆ LCGE_KEY_F

#define LCGE_KEY_F   70

◆ LCGE_KEY_G

#define LCGE_KEY_G   71

◆ LCGE_KEY_H

#define LCGE_KEY_H   72

◆ LCGE_KEY_I

#define LCGE_KEY_I   73

◆ LCGE_KEY_J

#define LCGE_KEY_J   74

◆ LCGE_KEY_K

#define LCGE_KEY_K   75

◆ LCGE_KEY_L

#define LCGE_KEY_L   76

◆ LCGE_KEY_M

#define LCGE_KEY_M   77

◆ LCGE_KEY_N

#define LCGE_KEY_N   78

◆ LCGE_KEY_O

#define LCGE_KEY_O   79

◆ LCGE_KEY_P

#define LCGE_KEY_P   80

◆ LCGE_KEY_Q

#define LCGE_KEY_Q   81

◆ LCGE_KEY_R

#define LCGE_KEY_R   82

◆ LCGE_KEY_S

#define LCGE_KEY_S   83

◆ LCGE_KEY_T

#define LCGE_KEY_T   84

◆ LCGE_KEY_U

#define LCGE_KEY_U   85

◆ LCGE_KEY_V

#define LCGE_KEY_V   86

◆ LCGE_KEY_W

#define LCGE_KEY_W   87

◆ LCGE_KEY_X

#define LCGE_KEY_X   88

◆ LCGE_KEY_Y

#define LCGE_KEY_Y   89

◆ LCGE_KEY_Z

#define LCGE_KEY_Z   90

◆ LCGE_KEY_LEFT_BRACKET

#define LCGE_KEY_LEFT_BRACKET   91 /* [ */

◆ LCGE_KEY_BACKSLASH

#define LCGE_KEY_BACKSLASH   92 /* \ */

◆ LCGE_KEY_RIGHT_BRACKET

#define LCGE_KEY_RIGHT_BRACKET   93 /* ] */

◆ LCGE_KEY_GRAVE_ACCENT

#define LCGE_KEY_GRAVE_ACCENT   96 /* ` */

◆ LCGE_KEY_WORLD_1

#define LCGE_KEY_WORLD_1   161 /* non-US #1 */

◆ LCGE_KEY_WORLD_2

#define LCGE_KEY_WORLD_2   162 /* non-US #2 */

◆ LCGE_KEY_ESCAPE

#define LCGE_KEY_ESCAPE   256

◆ LCGE_KEY_ENTER

#define LCGE_KEY_ENTER   257

◆ LCGE_KEY_TAB

#define LCGE_KEY_TAB   258

◆ LCGE_KEY_BACKSPACE

#define LCGE_KEY_BACKSPACE   259

◆ LCGE_KEY_INSERT

#define LCGE_KEY_INSERT   260

◆ LCGE_KEY_DELETE

#define LCGE_KEY_DELETE   261

◆ LCGE_KEY_RIGHT

#define LCGE_KEY_RIGHT   262

◆ LCGE_KEY_LEFT

#define LCGE_KEY_LEFT   263

◆ LCGE_KEY_DOWN

#define LCGE_KEY_DOWN   264

◆ LCGE_KEY_UP

#define LCGE_KEY_UP   265

◆ LCGE_KEY_PAGE_UP

#define LCGE_KEY_PAGE_UP   266

◆ LCGE_KEY_PAGE_DOWN

#define LCGE_KEY_PAGE_DOWN   267

◆ LCGE_KEY_HOME

#define LCGE_KEY_HOME   268

◆ LCGE_KEY_END

#define LCGE_KEY_END   269

◆ LCGE_KEY_CAPS_LOCK

#define LCGE_KEY_CAPS_LOCK   280

◆ LCGE_KEY_SCROLL_LOCK

#define LCGE_KEY_SCROLL_LOCK   281

◆ LCGE_KEY_NUM_LOCK

#define LCGE_KEY_NUM_LOCK   282

◆ LCGE_KEY_PRINT_SCREEN

#define LCGE_KEY_PRINT_SCREEN   283

◆ LCGE_KEY_PAUSE

#define LCGE_KEY_PAUSE   284

◆ LCGE_KEY_F1

#define LCGE_KEY_F1   290

◆ LCGE_KEY_F2

#define LCGE_KEY_F2   291

◆ LCGE_KEY_F3

#define LCGE_KEY_F3   292

◆ LCGE_KEY_F4

#define LCGE_KEY_F4   293

◆ LCGE_KEY_F5

#define LCGE_KEY_F5   294

◆ LCGE_KEY_F6

#define LCGE_KEY_F6   295

◆ LCGE_KEY_F7

#define LCGE_KEY_F7   296

◆ LCGE_KEY_F8

#define LCGE_KEY_F8   297

◆ LCGE_KEY_F9

#define LCGE_KEY_F9   298

◆ LCGE_KEY_F10

#define LCGE_KEY_F10   299

◆ LCGE_KEY_F11

#define LCGE_KEY_F11   300

◆ LCGE_KEY_F12

#define LCGE_KEY_F12   301

◆ LCGE_KEY_F13

#define LCGE_KEY_F13   302

◆ LCGE_KEY_F14

#define LCGE_KEY_F14   303

◆ LCGE_KEY_F15

#define LCGE_KEY_F15   304

◆ LCGE_KEY_F16

#define LCGE_KEY_F16   305

◆ LCGE_KEY_F17

#define LCGE_KEY_F17   306

◆ LCGE_KEY_F18

#define LCGE_KEY_F18   307

◆ LCGE_KEY_F19

#define LCGE_KEY_F19   308

◆ LCGE_KEY_F20

#define LCGE_KEY_F20   309

◆ LCGE_KEY_F21

#define LCGE_KEY_F21   310

◆ LCGE_KEY_F22

#define LCGE_KEY_F22   311

◆ LCGE_KEY_F23

#define LCGE_KEY_F23   312

◆ LCGE_KEY_F24

#define LCGE_KEY_F24   313

◆ LCGE_KEY_F25

#define LCGE_KEY_F25   314

◆ LCGE_KEY_KP_0

#define LCGE_KEY_KP_0   320

◆ LCGE_KEY_KP_1

#define LCGE_KEY_KP_1   321

◆ LCGE_KEY_KP_2

#define LCGE_KEY_KP_2   322

◆ LCGE_KEY_KP_3

#define LCGE_KEY_KP_3   323

◆ LCGE_KEY_KP_4

#define LCGE_KEY_KP_4   324

◆ LCGE_KEY_KP_5

#define LCGE_KEY_KP_5   325

◆ LCGE_KEY_KP_6

#define LCGE_KEY_KP_6   326

◆ LCGE_KEY_KP_7

#define LCGE_KEY_KP_7   327

◆ LCGE_KEY_KP_8

#define LCGE_KEY_KP_8   328

◆ LCGE_KEY_KP_9

#define LCGE_KEY_KP_9   329

◆ LCGE_KEY_KP_DECIMAL

#define LCGE_KEY_KP_DECIMAL   330

◆ LCGE_KEY_KP_DIVIDE

#define LCGE_KEY_KP_DIVIDE   331

◆ LCGE_KEY_KP_MULTIPLY

#define LCGE_KEY_KP_MULTIPLY   332

◆ LCGE_KEY_KP_SUBTRACT

#define LCGE_KEY_KP_SUBTRACT   333

◆ LCGE_KEY_KP_ADD

#define LCGE_KEY_KP_ADD   334

◆ LCGE_KEY_KP_ENTER

#define LCGE_KEY_KP_ENTER   335

◆ LCGE_KEY_KP_EQUAL

#define LCGE_KEY_KP_EQUAL   336

◆ LCGE_KEY_LEFT_SHIFT

#define LCGE_KEY_LEFT_SHIFT   340

◆ LCGE_KEY_LEFT_CONTROL

#define LCGE_KEY_LEFT_CONTROL   341

◆ LCGE_KEY_LEFT_ALT

#define LCGE_KEY_LEFT_ALT   342

◆ LCGE_KEY_LEFT_SUPER

#define LCGE_KEY_LEFT_SUPER   343

◆ LCGE_KEY_RIGHT_SHIFT

#define LCGE_KEY_RIGHT_SHIFT   344

◆ LCGE_KEY_RIGHT_CONTROL

#define LCGE_KEY_RIGHT_CONTROL   345

◆ LCGE_KEY_RIGHT_ALT

#define LCGE_KEY_RIGHT_ALT   346

◆ LCGE_KEY_RIGHT_SUPER

#define LCGE_KEY_RIGHT_SUPER   347

◆ LCGE_KEY_MENU

#define LCGE_KEY_MENU   348

◆ LCGE_KEY_PRESSED

#define LCGE_KEY_PRESSED   1

◆ LCGE_KEY_RELEASED

#define LCGE_KEY_RELEASED   -1

◆ LCGE_MOUSE_BUTTON_1

#define LCGE_MOUSE_BUTTON_1   0

◆ LCGE_MOUSE_BUTTON_2

#define LCGE_MOUSE_BUTTON_2   1

◆ LCGE_MOUSE_BUTTON_3

#define LCGE_MOUSE_BUTTON_3   2

◆ LCGE_MOUSE_BUTTON_4

#define LCGE_MOUSE_BUTTON_4   3

◆ LCGE_MOUSE_BUTTON_5

#define LCGE_MOUSE_BUTTON_5   4

◆ LCGE_MOUSE_BUTTON_6

#define LCGE_MOUSE_BUTTON_6   5

◆ LCGE_MOUSE_BUTTON_7

#define LCGE_MOUSE_BUTTON_7   6

◆ LCGE_MOUSE_BUTTON_8

#define LCGE_MOUSE_BUTTON_8   7

◆ LCGE_MOUSE_BUTTON_LAST

#define LCGE_MOUSE_BUTTON_LAST   LCGE_MOUSE_BUTTON_8

◆ LCGE_MOUSE_BUTTON_LEFT

#define LCGE_MOUSE_BUTTON_LEFT   LCGE_MOUSE_BUTTON_1

◆ LCGE_MOUSE_BUTTON_RIGHT

#define LCGE_MOUSE_BUTTON_RIGHT   LCGE_MOUSE_BUTTON_2

◆ LCGE_MOUSE_BUTTON_MIDDLE

#define LCGE_MOUSE_BUTTON_MIDDLE   LCGE_MOUSE_BUTTON_3

◆ LCGE_MOUSE_BUTTON_PRESSED

#define LCGE_MOUSE_BUTTON_PRESSED   1

◆ LCGE_MOUSE_BUTTON_RELEASED

#define LCGE_MOUSE_BUTTON_RELEASED   -1

Typedef Documentation

◆ LCGE_rect

typedef struct LCGE_rect LCGE_rect

A 2D rectangle.

See also
lcge_rect_load
lcge_rect_draw

◆ LCGE_image

typedef struct LCGE_image LCGE_image

A 2D image.

See also
lcge_image_load
lcge_image_draw

◆ LCGE_clock

typedef struct LCGE_clock LCGE_clock

Basic FPS clock.

See also
lcge_clock_create
lcge_clock_tick

◆ LCGE_cursor_pos

◆ LCGE_font

typedef struct LCGE_font LCGE_font

A true type font.

See also
lcge_font_load

◆ LCGE_text

typedef struct LCGE_text LCGE_text

2D text.

See also
lcge_text_load
lcge_text_draw

◆ LCGE_line

typedef struct LCGE_line LCGE_line

Function Documentation

◆ lcge_init()

LCGE_IMPORT int lcge_init ( const char *  lcge_res_dir)

Initializes LCGE.

This function will setup GLFW, as well as save the LCGE asset directory in memory, which will be used later to load shaders

◆ lcge_create_context()

LCGE_IMPORT int lcge_create_context ( unsigned int  width,
unsigned int  height,
const char *  title,
int  resizable 
)

Create a window and get back a handle.

Takes in width and height in pixels resizeable is either LCGE_RESIZEABLE or LCGE_NON_RESIZEABLE

◆ lcge_window_is_open()

LCGE_IMPORT int lcge_window_is_open ( )

Returns whether or not the window is still open.

Returns LCGE_WINDOW_CLOSED if the window should be closed if not, returns LCGE_WINDOW_OPEN

◆ lcge_exit()

LCGE_IMPORT void lcge_exit ( )

Exits lcge.

Delets any leftover garbage from the engine. this DOES NOT delete user created memory. Delete those yourself.

◆ lcge_window_clear()

LCGE_IMPORT void lcge_window_clear ( )

Clears the window.

This will clear the color buffer and set the screen to all black

◆ lcge_window_update()

LCGE_IMPORT void lcge_window_update ( )

Updates the window and polls for events.

◆ lcge_rect_load()

LCGE_IMPORT LCGE_rect* lcge_rect_load ( float  x,
float  y,
float  width,
float  height 
)

Loads rectangle data and returns a handle.

Takes in x, y coordinates and width and height (0, 0) is considered to be at the top left of the window

Width and height are in pixels.

◆ lcge_rect_delete()

LCGE_IMPORT void lcge_rect_delete ( LCGE_rect rect)

Deletes a rectangle.

◆ lcge_rect_draw()

LCGE_IMPORT void lcge_rect_draw ( LCGE_rect rect,
float  r,
float  g,
float  b 
)

Draw a loaded rectangle to the screen.

Takes r, g, b (0 to 255) color values as input.

◆ lcge_rect_set()

LCGE_IMPORT void lcge_rect_set ( LCGE_rect rect,
float  x,
float  y,
float  width,
float  height 
)

Updates rectangle data for a loaded rectangle.

This function allows you to set new x, y, width, and height values for your rectangle

◆ lcge_rect_rotate()

LCGE_IMPORT void lcge_rect_rotate ( LCGE_rect rect,
float  angle 
)

Rotates a loaded rectangle.

Takes in an angle in degrees. Rotates counterclockwise.

◆ lcge_rect_get_x()

LCGE_IMPORT float lcge_rect_get_x ( LCGE_rect rect)

Gets the rectangle x value.

◆ lcge_rect_get_y()

LCGE_IMPORT float lcge_rect_get_y ( LCGE_rect rect)

Gets the rectangle y value.

◆ lcge_rect_get_width()

LCGE_IMPORT float lcge_rect_get_width ( LCGE_rect rect)

Gets the rectangle width.

◆ lcge_rect_get_height()

LCGE_IMPORT float lcge_rect_get_height ( LCGE_rect rect)

Gets the rectangle height.

◆ lcge_image_load()

LCGE_IMPORT LCGE_image* lcge_image_load ( const char *  filepath,
float  x,
float  y,
float  width,
float  height 
)

Loads an image from a file.

Takes in a filepath, x/y coordinates, and a width and height to use when drawing

◆ lcge_image_delete()

LCGE_IMPORT void lcge_image_delete ( LCGE_image image)

Deletes an image.

◆ lcge_image_rotate()

LCGE_IMPORT void lcge_image_rotate ( LCGE_image image,
float  angle 
)

Rotates an image.

Takes in the angle in degrees.

◆ lcge_image_reflect()

LCGE_IMPORT void lcge_image_reflect ( LCGE_image image)

Reflects an image horizontally 180 deg.

◆ lcge_image_set()

LCGE_IMPORT void lcge_image_set ( LCGE_image image,
float  x,
float  y,
float  width,
float  height 
)

Sets new data for a loaded image.

Lets you set x, y, width, and height values

◆ lcge_image_draw()

LCGE_IMPORT void lcge_image_draw ( LCGE_image image)

Draws a loaded image to the screen.

◆ lcge_image_get_x()

LCGE_IMPORT float lcge_image_get_x ( LCGE_image image)

Gets image x.

◆ lcge_image_get_y()

LCGE_IMPORT float lcge_image_get_y ( LCGE_image image)

Gets image y.

◆ lcge_image_get_width()

LCGE_IMPORT float lcge_image_get_width ( LCGE_image image)

Gets image width.

◆ lcge_image_get_height()

LCGE_IMPORT float lcge_image_get_height ( LCGE_image image)

Gets image height.

◆ lcge_clock_create()

LCGE_IMPORT LCGE_clock* lcge_clock_create ( unsigned int  fps)

Creates a clock.

Takes in an fps. The clock will make sure that your window's fps is as close to the target fps as possible.

◆ lcge_clock_delete()

LCGE_IMPORT void lcge_clock_delete ( LCGE_clock clock)

Deletes a clock.

◆ lcge_clock_tick()

LCGE_IMPORT void lcge_clock_tick ( LCGE_clock clock)

tickst the clock.

Ticks the clock to get as close to the max fps as possible

◆ lcge_get_key()

LCGE_IMPORT int lcge_get_key ( int  key)

Gets the input status of a key.

Takes in a key code, eg. LCGE_KEY_<key_name>

◆ lcge_get_mouse_button()

LCGE_IMPORT int lcge_get_mouse_button ( int  button)

Gets input status of a mouse button.

Takes in LCGE_MOUSE_BUTTON_<1 through 8> OR LCGE_MOUSE_BUTTON_<LAST, LEFT, RIGHT, or MIDDLE>

returns LCGE_MOUSE_BUTTON_<PRESSED or RELEASE>

◆ lcge_get_cursor_position()

LCGE_IMPORT LCGE_cursor_pos lcge_get_cursor_position ( )

◆ lcge_font_load()

LCGE_IMPORT LCGE_font* lcge_font_load ( const char *  filepath,
float  height 
)

Loads a font.

Takes in a path to a .ttf file and the height of characters to be rendered in pixels.

◆ lcge_font_delete()

LCGE_IMPORT void lcge_font_delete ( LCGE_font font)

Deletes a font.

◆ lcge_text_load()

LCGE_IMPORT LCGE_text* lcge_text_load ( const char *  text,
float  x,
float  y,
LCGE_font font 
)

Loads a 2D text struct.

Takes in text as a string, x/y coordinates, and the font the x/y coords point to the BOTTOM LEFT of the text

◆ lcge_text_delete()

LCGE_IMPORT void lcge_text_delete ( LCGE_text text)

Deletes a text struct.

◆ lcge_text_draw()

LCGE_IMPORT void lcge_text_draw ( LCGE_text text,
float  r,
float  g,
float  b 
)

Draws 2D text.

Takes in the loaded text, and r, g, b color values

◆ lcge_text_set()

LCGE_IMPORT void lcge_text_set ( LCGE_text text,
const char *  n_text,
float  x,
float  y 
)

Set new data for text.

Lets you specify new x and y values and new text

◆ lcge_text_get_x()

LCGE_IMPORT float lcge_text_get_x ( LCGE_text text)

Gets x value of text.

x value is the top left.

◆ lcge_text_get_y()

LCGE_IMPORT float lcge_text_get_y ( LCGE_text text)

Gets y value of text.

y value is the top left.

◆ lcge_text_get_width()

LCGE_IMPORT float lcge_text_get_width ( LCGE_text text)

Gets the width of the text.

◆ lcge_text_get_height()

LCGE_IMPORT float lcge_text_get_height ( LCGE_text text)

Gets the height of the text.

◆ lcge_line_load()

LCGE_IMPORT LCGE_line* lcge_line_load ( float  x0,
float  y0,
float  x1,
float  y1 
)

◆ lcge_line_delete()

LCGE_IMPORT void lcge_line_delete ( LCGE_line line)

◆ lcge_line_draw()

LCGE_IMPORT void lcge_line_draw ( LCGE_line line,
float  r,
float  g,
float  b 
)

◆ lcge_line_set()

LCGE_IMPORT void lcge_line_set ( LCGE_line line,
float  x0,
float  y0,
float  x1,
float  y1 
)