LibGame  v0.4.0
The LG Game Engine - Copyright (C) 2024 ETMSoftware
libgame.c File Reference

Functions

int lg_init (int win_w, int win_h, const char *win_title, const char *app_name, const char *app_cmd, const char *org_name_android, const char *app_name_android, const char *assets_dir, const char *app_wr_dir)
 
Rec2Di lg_get_default_viewport ()
 
void lg_set_new_viewport (Rec2Di viewport)
 
void lg_reset_viewport ()
 
void lg_enable_mouse ()
 
void lg_disable_mouse ()
 
void lg_list_opengl_extensions ()
 
int lg_load_fonts ()
 
void lg_quit (int exit_code)
 
void lg_swap_fb ()
 
void lg_show_lib_info ()
 
void lg_show_sys_info ()
 
void lg_show_extra_sys_info (SDL_Window *w)
 
zboolean sdl2_is_installed ()
 
char * lg_get_sdl_win_flags (SDL_Window *w)
 

Detailed Description

 Libgame-0.4.0 - Copyright (C) 2011-2024 Emmanuel Thomas-Maurin < [email protected] > - All rights reserved

 LibGame is a SDL2/OpenGL ES 2.0 2D/3D minimalist game engine, which doesn't
 attempt to do *everything* but does only certain things and does them *well*,
 while not preventing you from doing other things (huh ?)

 This version supports both Linux Desktop and Android (with NDK).

Function Documentation

◆ lg_init()

int lg_init ( int  win_w,
int  win_h,
const char *  win_title,
const char *  app_name,
const char *  app_cmd,
const char *  org_name_android,
const char *  app_name_android,
const char *  assets_dir,
const char *  app_wr_dir 
)

Init Libgame

Initialize SDL, OpenGL ES 2.0, LG_Renderer2D instance, and some other stuff. Window dims are mandatory - in fullscreen mode, they defined the env logical size. First 'reset' members of current instance of LG_Env struct. The fullscreen flag (lg_get_game_env()->fullscreen) must be set by calling code. On Android, orientation is/must always be landscape.

Special app dirs:

  • assets_dir = app data dir, always app assets on Android
  • app_wr_dir = app home dir on Linux, app-specific writable persistent dir on Android (Use SDL_GetPrefPath(org_name, app_name))
Parameters
win_w
win_h
win_title
app_name
app_cmd
org_name_android
app_name_android
assets_dir
app_wr_dir
Returns
LG_OK if OK

◆ lg_get_default_viewport()

Rec2Di lg_get_default_viewport ( )

Get default viewport rect

Returns
The default viewport as a Rec2Di

◆ lg_set_new_viewport()

void lg_set_new_viewport ( Rec2Di  viewport)

Set a new viewport

Parameters
viewportA new viewport as a Rec2Di

◆ lg_reset_viewport()

void lg_reset_viewport ( )

Reset viewport to its default values

◆ lg_enable_mouse()

void lg_enable_mouse ( )

Enable mouse support: mouse inputs will be read in lg_get_user_input()

◆ lg_disable_mouse()

void lg_disable_mouse ( )

Disable mouse support: mouse inputs will be ignored in lg_get_user_input()

◆ lg_list_opengl_extensions()

void lg_list_opengl_extensions ( )

(self explanatory)

◆ lg_load_fonts()

int lg_load_fonts ( )

(self explanatory)

◆ lg_quit()

void lg_quit ( int  exit_code)

Make a 'clean' exit, ie release all allocated resources and quit

◆ lg_swap_fb()

void lg_swap_fb ( )

Swap framebuffer

NOTE: if a complete swap is needed, you may want to use glFinish() afterwards

◆ lg_show_lib_info()

void lg_show_lib_info ( )

(self explanatory)

◆ lg_show_sys_info()

void lg_show_sys_info ( )

(self explanatory)

◆ lg_show_extra_sys_info()

void lg_show_extra_sys_info ( SDL_Window *  w)

(self explanatory)

◆ sdl2_is_installed()

zboolean sdl2_is_installed ( )

(self explanatory)

◆ lg_get_sdl_win_flags()

char* lg_get_sdl_win_flags ( SDL_Window *  w)

Must be freed afterwards