- new_storm_context
- get_screen_size
- new_text_node
- AppWindow
- AppContext
- AppConfig
- Node
- NodeR2D
- NodeV2D
- TextConfig
- WindowConfig
fn new_storm_context(mut args AppConfig) &AppContext
Creates a new app context.
fn get_screen_size() NodeV2D
Gets the screen size.
fn new_text_node(config TextConfig, text string) &Node
Creates a new text node with the specified config and string.
struct AppWindow {
pub mut:
gg &gg.Context = unsafe { 0 }
latest_event &gg.Event = unsafe { 0 }
show_fps bool
// Mostly internal use
force_scale f32 = 1
}
Struct containing all the info about the window
fn (win AppWindow) get_app_scale() f32
Gets current window scaling to be used with drawing functions.
fn (win AppWindow) get_touches() TouchList
Gets current touches state.
fn (win AppWindow) get_mouse_pos() NodeV2D
Gets current mouse position.
fn (win AppWindow) get_size() NodeV2D
Gets current window size.
fn (win AppWindow) get_scale_relative_to(what NodeV2D) f32
Gets scale compared to a specific size.
struct AppContext {
pub mut:
win &AppWindow
root &Node
}
Struct that contains all the data about the app.
fn (mut app AppContext) run()
Runs the created app context.
struct AppConfig {
pub mut:
winconfig WindowConfig
}
Used to initialise the framework.
struct Node {
mut:
// Components are containers holding data as any struct.
components map[string]voidptr
// Children are other nodes that have the current node as parent.
children map[string]&Node
// Functions are methods that can be executed ON the node.
functions map[string]fn (&Node)
pub mut:
parent &Node = unsafe { 0 }
context &AppContext = unsafe { 0 }
}
fn (mut e Node) add_component(what voidptr, str string)
Adds a component to the node.
The component can be any struct and is saved as a refference to the original data.
fn (mut e Node) has_component(str string) bool
Checks if a component with a specific name exists.
fn (mut e Node) delete_component(str string)
Deletes a component from the node.
fn (e Node) get_component(str string) voidptr
Gets a specific component.
! Returns a voidptr that needs to be converted to the intended data struct !
fn (mut e Node) add_child(mut new Node, str string)
Adds a child to the node.
fn (mut e Node) has_child(str string) bool
Returns if the child with the specified name exists.
fn (mut e Node) get_child(str string) &Node
Gets a child with a specified name.
fn (mut e Node) remove_child(str string)
Removes a child with a specified name.
fn (mut e Node) add_function(new fn (&Node), str string)
Adds a method with a specified name.
fn (mut e Node) execute(str string)
Executes a function on itself going down recursively if it also exists there.
fn (mut e Node) execute_one(func fn (&Node))
Executes a specific function of the current entity.
fn (mut e Node) execute_all(func fn (&Node))
Executes a specific function on the current entity AND its children.
struct NodeR2D {
pub mut:
// Position
pos NodeV2D
// Size
siz NodeV2D
}
Struct that represents a 2D rectangle into memory.
fn (n NodeR2D) check_inside(what NodeV2D) bool
Checks if a point represented by a 2D vertex is inside the rectangle.
fn (n NodeR2D) get_relative_to(what NodeV2D) NodeR2D
Returns a modified version of the current rectangle relative to the argument vertex.
It can return the original rectangle if the relative flag is not set for both the size and position.
struct NodeV2D {
pub mut:
x f32
y f32
r bool
}
Struct that represents a 2D vertex into memory.
Can be relative to another 2D vertex.
fn (a NodeV2D) divide_by<T>(b T) NodeV2D
Divide the vertex by a scalar.
fn (a NodeV2D) multiply_by<T>(b T) NodeV2D
Mulitiply the vertex by a scalar.
fn (n NodeV2D) get_relative_to(what NodeV2D) NodeV2D
Returns a modified version of the current vertex relative to the argument vertex.
This happens only if the relative flag is set to true, otherwise the original is returned.
struct TextConfig {
pub mut:
color gx.Color
size f32
italic bool
relative bool
text string
position NodeV2D
align gx.HorizontalAlign
vertical_align gx.VerticalAlign
}
Config for the text to draw with.
struct WindowConfig {
pub mut:
title string
size NodeV2D
fullscreen bool
ui_mode bool
init_fn fn (&AppContext)
}
Used to initialise the window.