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

Functions

zboolean lg_bg_new (const char *path, int scale_x, int scale_y)
 
zboolean lg_bg_draw (int shift_x, int shift_y)
 
void lg_bg_clear (uint8_t red, uint8_t green, uint8_t blue)
 
void lg_bg_clear_full (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha, GLbitfield mask)
 
zboolean lg_bg_free ()
 
void lg_bg_info ()
 
zboolean lg_read_and_render_screen_back ()
 

Detailed Description

 === Draw background, and these sorts of things ===

 So far:
 - Background is unique
 - background texture is env->bg_uniq_tex

Function Documentation

◆ lg_bg_new()

zboolean lg_bg_new ( const char *  path,
int  scale_x,
int  scale_y 
)

Load background texture with scaling

Parameters
scale_x
scale_y
pathPath to image file
Returns
TRUE if OK, FALSE otherwise

◆ lg_bg_draw()

zboolean lg_bg_draw ( int  shift_x,
int  shift_y 
)

Draw background with shifting

Parameters
shift_x
shift_y
pathPath to image file
Returns
TRUE if OK, FALSE otherwise

◆ lg_bg_clear()

void lg_bg_clear ( uint8_t  red,
uint8_t  green,
uint8_t  blue 
)

Clear background with RGB color

NOTE: if followed by lg_swap_fb() without delay, and if a complete swap is needed, you may want to use glFinish() afterwards

Parameters
red
green
blue

◆ lg_bg_clear_full()

void lg_bg_clear_full ( uint8_t  red,
uint8_t  green,
uint8_t  blue,
uint8_t  alpha,
GLbitfield  mask 
)

Clear background with RGBA colors and mask

NOTE: if followed by lg_swap_fb() without delay, and if a complete swap is needed, you may want to use glFinish() afterwards

GLbitfield is 32-bit

Parameters
red
green
blue
alpha
maskBitwise OR of GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT

◆ lg_bg_free()

zboolean lg_bg_free ( )

Free background texture

◆ lg_bg_info()

void lg_bg_info ( )

Print out background texture info

◆ lg_read_and_render_screen_back()

zboolean lg_read_and_render_screen_back ( )

(Self-explanatory enough)

WARNING: Doesn't swap framebuffer

Returns
TRUE if OK, FALSE otherwise