Claude Chappe' Curse - A C Game
Logo Institut d'Informatique Claude Chappe Logo Université de Le Mans Logo Raeptor Production
 
Loading...
Searching...
No Matches
Frame Class Reference

Represents a frame. More...

#include <frame.h>

Inheritance diagram for Frame:
Collaboration diagram for Frame:

Public Member Functions

void constructor (float x, int xu, float y, int yu, float w, int wu, float h, int hu, int ha, int va, int scroll, Theme *theme)
 Constructor for initializing a frame object with specified parameters.
 
void handle_dimension_unit (float *src, float *dest, int vertical, double size, int unit, double containerWidth, double containerHeight)
 Handles the conversion of dimension units for a given source and destination.
 
void init_frame ()
 Initializes the frame.
 
void load (FILE *file)
 Loads data from a file.
 
void refresh ()
 Refreshes the frame.
 
void refreshContent ()
 Refreshes the content of the frame.
 
void update ()
 Updates the state of the frame.
 
void on_resize ()
 Handles the resize event for the frame.
 
void draw_frame ()
 Draws a frame.
 
void render (mat4 modelMatrix, Shader activeShader, WorldShaders *shaders)
 Renders a frame using the provided model matrix and shader.
 
void save (FILE *file, Node *editor)
 Saves the current state of the editor node to a file.
 
void get_vao (VAO *vao)
 Retrieves the Vertex Array Object (VAO).
 
void is_gui_element (bool *result)
 Determines if the current object is a GUI element.
 
void is_button (bool *result)
 Determines if a button is pressed.
 
void is_input_area (bool *result)
 Checks if the current area is an input area.
 
void is_selectlist (bool *result)
 Checks if the current item is in the selection list.
 
void is_checkbox (bool *result)
 Checks if a condition is a checkbox.
 
bool is_radiobutton ()
 Checks if the current frame is a radio button.
 
void free ()
 Frees the resources allocated for the frame.
 
- Public Member Functions inherited from Node
void constructor ()
 Constructor for the Node class.
 
void initialize_node ()
 Initializes a node.
 
void get_glow_shader (Shader *shader)
 Retrieves the glow shader.
 
void get_settings_data (void ***ptr, int *length)
 Retrieves settings data.
 
void load ()
 Loads the necessary resources or data for the node.
 
void save (FILE *file)
 Saves the current state to the specified file.
 
void prepare_render (mat4 modelMatrix, Shader activeShader)
 Renders a node using the specified model matrix and shader.
 
void render ()
 Renders the node.
 
void update_global_position (vec3 pos, vec3 rot, vec3 scale)
 Updates the global position of a node.
 
void update (vec3 pos, vec3 rot, vec3 scale)
 Updates the position, rotation, and scale of a node.
 
void on_resize ()
 Handles the resize event for the node.
 
void free ()
 Frees the resources allocated by the object.
 
void is_cshape (bool *cshape)
 Checks if the current shape is a custom shape.
 
void is_body (bool *body)
 Sets the body status of the node.
 
void is_area (bool *area)
 Checks if the current node is within a specified area.
 
void is_render_target (bool *render_target)
 Sets the render target status.
 
void is_gui_element (bool *result)
 Determines if the current node is a GUI element.
 
void add_child (Node *child)
 Adds a child node to a parent node.
 
void add_child_and_realloc (Node *child)
 Adds a child node to a parent node and reallocates memory if necessary.
 
void remove_child (Node *child)
 Removes a child node from a parent node.
 
void remove_child_and_realloc (Node *child)
 Removes a child node from a parent node and reallocates memory if necessary.
 
void remove_child_and_free (Node *child)
 Removes a child node from a parent node and frees the memory of the child node.
 
void remove_child_and_free_and_realloc (Node *child)
 Removes a child node from a parent node, frees the memory of the child node, and reallocates memory if necessary.
 
int index_of_child (Node *child)
 Retrieves the index of a child node in a parent node's children array.
 
void print (int level)
 Prints the details of a node at a specified level of indentation.
 
void emit_ready (...)
 Emits the 'ready' signal for the node.
 
void emit_update (...)
 Emits an update event for the node.
 
void emit_signal (...)
 Emits a signal if the node has a script and the script has a signal handler.
 

Public Attributes

vec4 overflow
 
vec2 relPos
 
vec2 absPos
 
vec2 scale
 
vec2 size
 
vec2 contentSize
 
vec2 scroll
 
vec2 scrollTarget
 
char unit [4]
 
char alignment [2]
 
Themetheme
 
SDL_Surface * contentSurface
 
TextureMap contentTexture
 
union { 
 
   Label *   label 
 
   Button *   button 
 
   InputArea *   inputArea 
 
   SelectList *   selectList 
 
   ImageFrame *   imageFrame 
 
   RadioButton *   radiobutton 
 
   Slider *   slider 
 
};  
 
FrameFlags flags
 
- Public Attributes inherited from Node
void * object
 
struct Node ** children
 
struct Nodeparent
 
u16 length
 
u8 type
 
u8 flags
 
vec3 pos
 
vec3 rot
 
vec3 scale
 
vec3 globalPos
 
vec3 globalRot
 
vec3 globalScale
 
Behaviorbehavior
 
BehaviorAttributeattribute
 
u8 attributes_count
 
Shader shader
 

Static Public Attributes

static VBO _vbo = 0
 Static variable to store the Vertex Buffer Object (VBO) identifier.
 
static VAO _vao = 0
 Static variable to store the Vertex Array Object (VAO) identifier.
 
- Static Public Attributes inherited from Node
static Shader glowShader = 0
 A static Shader variable used for glow effect.
 

Detailed Description

Represents a frame.

This structure holds information about a frame, including its position, size, theme, content, and flags.

Member Function Documentation

◆ constructor()

void Frame::constructor ( float  x,
int  xu,
float  y,
int  yu,
float  w,
int  wu,
float  h,
int  hu,
int  ha,
int  va,
int  scroll,
Theme theme 
)
inline

Constructor for initializing a frame object with specified parameters.

Parameters
xThe x-coordinate of the frame.
xuThe unit for the x-coordinate.
yThe y-coordinate of the frame.
yuThe unit for the y-coordinate.
wThe width of the frame.
wuThe unit for the width.
hThe height of the frame.
huThe unit for the height.
haThe horizontal alignment of the frame.
vaThe vertical alignment of the frame.
scrollThe scroll setting for the frame.
themeA pointer to the Theme object associated with the frame.

◆ handle_dimension_unit()

void Frame::handle_dimension_unit ( float *  src,
float *  dest,
int  vertical,
double  size,
int  unit,
double  containerWidth,
double  containerHeight 
)
inline

Handles the conversion of dimension units for a given source and destination.

This function calculates the dimensions of a graphical element based on the provided unit type and container dimensions. It should be called every frame to ensure the dimensions are updated correctly.

Parameters
srcPointer to the source dimension value.
destPointer to the destination dimension value where the result will be stored.
verticalInteger flag indicating if the dimension is vertical (1 for vertical, 0 for horizontal).
sizeThe size value to be converted.
unitThe unit type for the size (e.g., pixels, percentage).
containerWidthThe width of the container in which the element is placed.
containerHeightThe height of the container in which the element is placed.

◆ init_frame()

void Frame::init_frame ( )
inline

Initializes the frame.

This function sets up the initial state of the frame. It should be called before using any other functions related to the frame.

◆ load()

void Frame::load ( FILE *  file)
inline

Loads data from a file.

This function reads data from the given file and processes it accordingly.

Parameters
fileA pointer to the FILE object that represents the file to be read.

◆ refresh()

void Frame::refresh ( )
inline

Refreshes the frame.

This function is responsible for updating the frame. It performs necessary operations to refresh the frame's state.

◆ refreshContent()

void Frame::refreshContent ( )
inline

Refreshes the content of the frame.

This function is responsible for updating or refreshing the content displayed within the frame. It ensures that the frame's content is up-to-date and reflects any changes that may have occurred.

◆ update()

void Frame::update ( )
inline

Updates the state of the frame.

This function is responsible for updating the internal state of the frame. It should be called regularly to ensure the frame's state is kept up-to-date.

◆ on_resize()

void Frame::on_resize ( )
inline

Handles the resize event for the frame.

This function is called when the frame is resized. It updates the frame's dimensions and performs any necessary adjustments to ensure the frame is displayed correctly.

◆ draw_frame()

void Frame::draw_frame ( )
inline

Draws a frame.

This function is responsible for rendering a frame. The specific details of how the frame is drawn are not provided in the given code snippet.

◆ render()

void Frame::render ( mat4  modelMatrix,
Shader  activeShader,
WorldShaders shaders 
)
inline

Renders a frame using the provided model matrix and shader.

This function is responsible for rendering a frame in the scene. It takes a model matrix, an active shader, and a set of world shaders as parameters.

Parameters
modelMatrixModel matrix to be used for rendering.
activeShaderThe shader to be used for rendering the frame.
shadersA pointer to the WorldShaders structure containing the shaders used in the world.

◆ save()

void Frame::save ( FILE *  file,
Node editor 
)
inline

Saves the current state of the editor node to a file.

This function writes the state of the given editor node to the specified file.

Parameters
fileA pointer to the FILE object where the editor node state will be saved.
editorA pointer to the Node object representing the editor whose state is to be saved.

◆ get_vao()

void Frame::get_vao ( VAO vao)
inline

Retrieves the Vertex Array Object (VAO).

This function is responsible for obtaining the VAO and storing it in the provided VAO structure.

Parameters
vaoA pointer to a VAO structure where the retrieved VAO will be stored.

◆ is_gui_element()

void Frame::is_gui_element ( bool *  result)
inline

Determines if the current object is a GUI element.

This function sets the value pointed to by the result parameter to indicate whether the current object is a graphical user interface (GUI) element.

Parameters
resultA pointer to a boolean variable where the result will be stored. The value will be set to true if the current object is a GUI element, and false otherwise.

◆ is_button()

void Frame::is_button ( bool *  result)
inline

Determines if a button is pressed.

This function checks the state of a button and sets the result accordingly.

Parameters
[out]resultPointer to a boolean variable where the result will be stored.
  • true: if the button is pressed.
  • false: if the button is not pressed.

◆ is_input_area()

void Frame::is_input_area ( bool *  result)
inline

Checks if the current area is an input area.

This function determines whether the current area is designated as an input area.

Parameters
resultA pointer to a boolean variable where the result will be stored.
  • true: The current area is an input area.
  • false: The current area is not an input area.

◆ is_selectlist()

void Frame::is_selectlist ( bool *  result)
inline

Checks if the current item is in the selection list.

This function sets the value of the provided boolean pointer to indicate whether the current item is part of the selection list.

Parameters
resultA pointer to a boolean variable where the result will be stored. The value will be set to true if the item is in the selection list, and false otherwise.

◆ is_checkbox()

void Frame::is_checkbox ( bool *  result)
inline

Checks if a condition is a checkbox.

This function sets the value of the boolean pointer result to indicate whether a certain condition is a checkbox.

Parameters
resultA pointer to a boolean variable where the result will be stored. The value will be set to true if the condition is a checkbox, otherwise it will be set to false.

◆ is_radiobutton()

bool Frame::is_radiobutton ( )
inline

Checks if the current frame is a radio button.

This function determines whether the current frame instance is a radio button.

Returns
true if the frame is a radio button, false otherwise.

◆ free()

void Frame::free ( )
inline

Frees the resources allocated for the frame.

This function is responsible for releasing any memory or resources that were allocated for the frame. It should be called when the frame is no longer needed to avoid memory leaks.

Member Data Documentation

◆ _vbo

Frame::_vbo = 0
static

Static variable to store the Vertex Buffer Object (VBO) identifier.

This static variable is used to store the identifier of the VBO that is used for rendering frames. It is initialized to 0, indicating that no VBO has been created or assigned yet.

◆ _vao

VAO Frame::_vao = 0
static

Static variable to store the Vertex Array Object (VAO) identifier.

This static variable _vao is used to store the identifier of the Vertex Array Object (VAO) associated with the frame. The VAO is used in OpenGL to store the state needed to supply vertex data to the graphics pipeline.

Note
The initial value of _vao is set to 0, indicating that no VAO has been created yet.

◆ overflow

vec4 Frame::overflow

Overflow area of the frame.

◆ relPos

vec2 Frame::relPos

Relative position of the frame.

◆ absPos

vec2 Frame::absPos

Absolute position of the frame.

◆ scale

vec2 Frame::scale

Scale of the frame.

◆ size

vec2 Frame::size

Size of the frame.

◆ contentSize

vec2 Frame::contentSize

Size of the content within the frame.

◆ scroll

vec2 Frame::scroll

Scroll position of the frame.

◆ scrollTarget

vec2 Frame::scrollTarget

Target scroll position of the frame.

◆ unit

char Frame::unit[4]

Unit of measurement for the frame's size and position.

◆ alignment

char Frame::alignment[2]

Alignment of the frame.

◆ theme

Theme* Frame::theme

Pointer to the theme used by the frame.

◆ contentSurface

SDL_Surface* Frame::contentSurface

SDL surface for the frame's content.

◆ contentTexture

TextureMap Frame::contentTexture

Texture map for the frame's content.

◆ label

Label* Frame::label

Pointer to a Label structure if the frame contains a label.

◆ button

Button* Frame::button

Pointer to a Button structure if the frame contains a button.

◆ inputArea

InputArea* Frame::inputArea

Pointer to an InputArea structure if the frame contains an input area.

◆ selectList

SelectList* Frame::selectList

Pointer to a SelectList structure if the frame contains a select list.

◆ imageFrame

ImageFrame* Frame::imageFrame

Pointer to an ImageFrame structure if the frame contains an image frame.

◆ radiobutton

RadioButton* Frame::radiobutton

Pointer to a RadioButton structure if the frame contains a radio button.

◆ slider

Slider* Frame::slider

Pointer to a Slider structure if the frame contains a slider.

◆ [union]

union { ... } Frame

◆ flags

FrameFlags Frame::flags

Flags specifying properties of the frame.


The documentation for this class was generated from the following files: