Archeus 0.0.0
A C library and game engine that focuses on documentation
Loading...
Searching...
No Matches
view.h File Reference
#include <stdint.h>
#include <wchar.h>
#include "arc/console/key.h"
#include "arc/math/rectangle.h"
#include "arc/std/bool.h"
#include "arc/std/string.h"

Go to the source code of this file.

Macros

#define ARC_CONSOLE_VIEW_CURSOR_HIDDEN   0x00
 mouse options
 
#define ARC_CONSOLE_VIEW_CURSOR_VISIBLE   0x01
 
#define ARC_CONSOLE_VIEW_BORDER_NONE   0x00
 border options
 
#define ARC_CONSOLE_VIEW_BORDER_DEFAULT   0x01
 
#define ARC_CONSOLE_VIEW_ATTRIBUTE_NONE   0x00
 border options
 
#define ARC_CONSOLE_VIEW_ATTRIBUTE_REVERSE   0x01
 

Typedefs

typedef struct ARC_ConsoleView ARC_ConsoleView
 
typedef ARC_Bool(* ARC_ConsoleView_OverrideCharInputFn) (ARC_ConsoleKey *key, char *inputCStr, uint32_t *inputSize, uint32_t maxInputSize, void *userdata)
 callback to check char being read in and override functionality
 

Functions

void ARC_ConsoleView_Create (ARC_ConsoleView **view, ARC_Rect bounds)
 creates ARC_ConsoleView type
 
void ARC_ConsoleView_Destroy (ARC_ConsoleView *view)
 destroys ARC_ConsoleView type
 
void ARC_ConsoleView_AddElement (ARC_ConsoleView *view, ARC_ConsoleElement *element)
 adds an ARC_ConsoleElement to the ARC_ConsoleView type
 
void ARC_ConsoleView_RemoveElement (ARC_ConsoleView *view, uint32_t index)
 
void ARC_ConsoleView_Clear (ARC_ConsoleView *view)
 
void ARC_ConsoleView_RenderCharAt (ARC_ConsoleView *view, char character, ARC_Point pos)
 
void ARC_ConsoleView_RenderWCharAt (ARC_ConsoleView *view, wchar_t character, ARC_Point pos)
 
void ARC_ConsoleView_RenderKeyAt (ARC_ConsoleView *view, ARC_ConsoleKey key, ARC_Point pos)
 
void ARC_ConsoleView_RenderUint32At (ARC_ConsoleView *view, uint32_t uint32, ARC_Point pos)
 
void ARC_ConsoleView_RenderStringAt (ARC_ConsoleView *view, ARC_String *text, ARC_Point pos)
 
void ARC_ConsoleView_RenderCStringWithStrlenAt (ARC_ConsoleView *view, char *cstr, ARC_Point pos)
 
void ARC_ConsoleView_RenderRect (ARC_ConsoleView *view, ARC_Rect bounds)
 
void ARC_ConsoleView_RenderElements (ARC_ConsoleView *view)
 
ARC_Rect ARC_ConsoleView_GetBounds (ARC_ConsoleView *view)
 gets the bounds of an ARC_ConsoleView
 
ARC_ConsoleElementARC_ConsoleView_GetElement (ARC_ConsoleView *view, uint32_t index)
 adds an ARC_ConsoleElement to the ARC_ConsoleView type
 
char ARC_ConsoleView_GetChar (ARC_ConsoleView *view)
 gets a char from the view
 
char ARC_ConsoleView_GetCharAt (ARC_ConsoleView *view, ARC_Point pos)
 gets a char from the view at a position
 
ARC_ConsoleKey ARC_ConsoleView_GetConsoleKeyAt (ARC_ConsoleView *view, ARC_Point pos)
 gets a console key from the view at a position
 
ARC_ConsoleKeyARC_ConsoleView_GetCreateConsoleKeyAt (ARC_ConsoleView *view, ARC_Point pos)
 gets and creates a console key from the view at a position
 
ARC_StringARC_ConsoleView_GetStringInput (ARC_ConsoleView *view, ARC_Point pos, ARC_ConsoleView_OverrideCharInputFn *overrideCharInputFn, void *userdata)
 gets a ARC_String from the view at a position
 
void ARC_ConsoleView_SetCursorVisibility (ARC_ConsoleView *view, uint8_t visibility)
 sets a visibility of the cursor with an ARC_ConsoleView
 
void ARC_ConsoleView_SetBorder (ARC_ConsoleView *view, uint32_t border)
 sets a border on the ARC_ConsoleView
 
void ARC_ConsoleView_SetAttribute (ARC_ConsoleView *view, uint32_t attribute)
 sets a border on the ARC_ConsoleView
 

Macro Definition Documentation

◆ ARC_CONSOLE_VIEW_ATTRIBUTE_NONE

#define ARC_CONSOLE_VIEW_ATTRIBUTE_NONE   0x00

border options

Definition at line 252 of file view.h.

◆ ARC_CONSOLE_VIEW_ATTRIBUTE_REVERSE

#define ARC_CONSOLE_VIEW_ATTRIBUTE_REVERSE   0x01

Definition at line 253 of file view.h.

◆ ARC_CONSOLE_VIEW_BORDER_DEFAULT

#define ARC_CONSOLE_VIEW_BORDER_DEFAULT   0x01

Definition at line 239 of file view.h.

◆ ARC_CONSOLE_VIEW_BORDER_NONE

#define ARC_CONSOLE_VIEW_BORDER_NONE   0x00

border options

Definition at line 238 of file view.h.

◆ ARC_CONSOLE_VIEW_CURSOR_HIDDEN

#define ARC_CONSOLE_VIEW_CURSOR_HIDDEN   0x00

mouse options

Definition at line 224 of file view.h.

◆ ARC_CONSOLE_VIEW_CURSOR_VISIBLE

#define ARC_CONSOLE_VIEW_CURSOR_VISIBLE   0x01

Definition at line 225 of file view.h.

Typedef Documentation

◆ ARC_ConsoleView

Definition at line 18 of file view.h.

◆ ARC_ConsoleView_OverrideCharInputFn

typedef ARC_Bool(* ARC_ConsoleView_OverrideCharInputFn) (ARC_ConsoleKey *key, char *inputCStr, uint32_t *inputSize, uint32_t maxInputSize, void *userdata)

callback to check char being read in and override functionality

Note
this function is used for pressing arrow keys but can be used for anything
Parameters
keythe current key being read in
inputCStrthe cstring that holds the current contents of the input
inputSizethe size of the current contents of the input string
maxInputSizethe max size inputCStr can store
userdatadata that a user can pass to use within this function

Definition at line 209 of file view.h.

Function Documentation

◆ ARC_ConsoleView_AddElement()

void ARC_ConsoleView_AddElement ( ARC_ConsoleView * view,
ARC_ConsoleElement * element )

adds an ARC_ConsoleElement to the ARC_ConsoleView type

Note
the elements position will be based on the ARC_ConsoleView which might mess up how it looks
Parameters
view
elment

◆ ARC_ConsoleView_Clear()

void ARC_ConsoleView_Clear ( ARC_ConsoleView * view)
Parameters
view
index

◆ ARC_ConsoleView_Create()

void ARC_ConsoleView_Create ( ARC_ConsoleView ** view,
ARC_Rect bounds )

creates ARC_ConsoleView type

Parameters
viewARC_ConsoleView to create
boundsthe bounds of the window, if bounds.w == 0 or bounds.h == 0, bounds will take up the entire screen

◆ ARC_ConsoleView_Destroy()

void ARC_ConsoleView_Destroy ( ARC_ConsoleView * view)

destroys ARC_ConsoleView type

Parameters
viewARC_ConsoleView to destroy

◆ ARC_ConsoleView_GetBounds()

ARC_Rect ARC_ConsoleView_GetBounds ( ARC_ConsoleView * view)

gets the bounds of an ARC_ConsoleView

Parameters
viewARC_ConsoleView to get bounds from
Returns
the bounds of the ARC_ConsoleView

◆ ARC_ConsoleView_GetChar()

char ARC_ConsoleView_GetChar ( ARC_ConsoleView * view)

gets a char from the view

Note
use ARC_ConsoleView_GetInt32At if you want to check for direction key or special character input
Parameters
viewthe ARC_ConsoleView to get the char from

◆ ARC_ConsoleView_GetCharAt()

char ARC_ConsoleView_GetCharAt ( ARC_ConsoleView * view,
ARC_Point pos )

gets a char from the view at a position

Note
use ARC_ConsoleView_GetInt32At if you want to check for direction key or special character input
Parameters
viewthe ARC_ConsoleView to get the char from
posthe positiion to get the char at

◆ ARC_ConsoleView_GetConsoleKeyAt()

ARC_ConsoleKey ARC_ConsoleView_GetConsoleKeyAt ( ARC_ConsoleView * view,
ARC_Point pos )

gets a console key from the view at a position

Note
you most likely do not want to use this function outside of a backend as ARC_ConsoleKey is defined within the console backend
Parameters
viewthe ARC_ConsoleView to get the console key from
posthe positiion to get the console key at
Returns
a console key

◆ ARC_ConsoleView_GetCreateConsoleKeyAt()

ARC_ConsoleKey * ARC_ConsoleView_GetCreateConsoleKeyAt ( ARC_ConsoleView * view,
ARC_Point pos )

gets and creates a console key from the view at a position

Note
the given ARC_ConsoleKey needs to be destroyed
use ARC_ConsoleView_GetConsoleKeyAt if you want to check for keyboard or special character input
Parameters
viewthe ARC_ConsoleView to get the console key from
posthe positiion to get the console key at
Returns
a console key

◆ ARC_ConsoleView_GetElement()

ARC_ConsoleElement * ARC_ConsoleView_GetElement ( ARC_ConsoleView * view,
uint32_t index )

adds an ARC_ConsoleElement to the ARC_ConsoleView type

Note
the elements position will be based on the ARC_ConsoleView which might mess up how it looks
Parameters
view
index

◆ ARC_ConsoleView_GetStringInput()

ARC_String * ARC_ConsoleView_GetStringInput ( ARC_ConsoleView * view,
ARC_Point pos,
ARC_ConsoleView_OverrideCharInputFn * overrideCharInputFn,
void * userdata )

gets a ARC_String from the view at a position

Parameters
viewthe ARC_ConsoleView to get the string from
posthe positiion to get the string at
overrideCharInputFna function to allow overriding what happens when inputing chars, can be NULL
userdatadata that a user can pass to use within the overrideCharInputFn

◆ ARC_ConsoleView_RemoveElement()

void ARC_ConsoleView_RemoveElement ( ARC_ConsoleView * view,
uint32_t index )
Parameters
view
index

◆ ARC_ConsoleView_RenderCharAt()

void ARC_ConsoleView_RenderCharAt ( ARC_ConsoleView * view,
char character,
ARC_Point pos )
Parameters
view
character
pos

◆ ARC_ConsoleView_RenderCStringWithStrlenAt()

void ARC_ConsoleView_RenderCStringWithStrlenAt ( ARC_ConsoleView * view,
char * cstr,
ARC_Point pos )
Parameters
view
text
pos

◆ ARC_ConsoleView_RenderElements()

void ARC_ConsoleView_RenderElements ( ARC_ConsoleView * view)
Parameters
view

◆ ARC_ConsoleView_RenderKeyAt()

void ARC_ConsoleView_RenderKeyAt ( ARC_ConsoleView * view,
ARC_ConsoleKey key,
ARC_Point pos )
Parameters
view
key
pos

◆ ARC_ConsoleView_RenderRect()

void ARC_ConsoleView_RenderRect ( ARC_ConsoleView * view,
ARC_Rect bounds )
Parameters
view
bounds

◆ ARC_ConsoleView_RenderStringAt()

void ARC_ConsoleView_RenderStringAt ( ARC_ConsoleView * view,
ARC_String * text,
ARC_Point pos )
Parameters
view
text
pos

◆ ARC_ConsoleView_RenderUint32At()

void ARC_ConsoleView_RenderUint32At ( ARC_ConsoleView * view,
uint32_t uint32,
ARC_Point pos )
Parameters
view
uint32
pos

◆ ARC_ConsoleView_RenderWCharAt()

void ARC_ConsoleView_RenderWCharAt ( ARC_ConsoleView * view,
wchar_t character,
ARC_Point pos )
Parameters
view
character
pos

◆ ARC_ConsoleView_SetAttribute()

void ARC_ConsoleView_SetAttribute ( ARC_ConsoleView * view,
uint32_t attribute )

sets a border on the ARC_ConsoleView

Parameters
viewARC_ConsoleView to set border to
borderThe border to set

◆ ARC_ConsoleView_SetBorder()

void ARC_ConsoleView_SetBorder ( ARC_ConsoleView * view,
uint32_t border )

sets a border on the ARC_ConsoleView

Parameters
viewARC_ConsoleView to set border to
borderThe border to set

◆ ARC_ConsoleView_SetCursorVisibility()

void ARC_ConsoleView_SetCursorVisibility ( ARC_ConsoleView * view,
uint8_t visibility )

sets a visibility of the cursor with an ARC_ConsoleView

Parameters
viewARC_ConsoleView to set mouse visibility
visibilitythe visibility to set