Graphics

The graphics functions are only available if the user is using graphics mode 4 or 5. Use graphics_funcs_available to check; it returns 1 if you can use them or 0 if you can’t. Calling graphics functions when graphics_funcs_available returns 0 will do nothing.

Functions


activate_shader

void activate_shader(int ID)

deactivate_shader

void deactivate_shader(int ID)

force_graphics_refresh

void force_graphics_refresh(bool enabled)

Forces the screen to redraw at times when it normally wouldn’t. If you’re using animated shader, turning this option on is recommended.


free_shader

void free_shader(int ID)

get_screen_height

int get_screen_height()

get_screen_width

int get_screen_width()

get_shader_texture

int get_shader_texture(int ID, int texture)

get_shader_version

int get_shader_version

Gives you the highest shader version supported by the player’s graphics cards. Possible return values are 11, 12, 13, 14, 20, 21 and 30.


graphics_funcs_available

bool graphics_funcs_available

load_shader

int load_shader(string path)

Takes a path relative to the <GameRoot>\<master_patches>\shaders\ directory as an argument and returns a shader ID. That ID should be passed as the first argument to all other shader functions, and is valid until free_shader is called on the ID, the player loads a saved game or the player quits to the main menu.


set_palette

void set_palette(string path)

set_shader_float

void set_shader_float(int ID, string param, float value)

set_shader_int

void set_shader_int(int ID, string param, int value)

set_shader_mode

void set_shader_mode(int mode)

Tells sfall when to use a shader. The parameter is a set of 32 flags which specify the screens on which the shader will be disabled, unless bit 32 is set, in which case the shader will only be active on those screens. Remember that screens are displayed on top of each other; if the player opens the character menu which in combat, the game still considers the player to be in combat. See sfall.h for a list of defines.


set_shader_texture

void set_shader_texture(int ID, string param, int texID)

set_shader_vector

void set_shader_vector(int ID, string param, float f1, float f2, float f3, float f4)