Archeus 0.0.0
A C library and game engine that focuses on documentation
Loading...
Searching...
No Matches
view.h
Go to the documentation of this file.
1#ifndef ARC_CONSOLE_VIEW_H_
2#define ARC_CONSOLE_VIEW_H_
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdint.h>
9#include <wchar.h>
10#include "arc/console/key.h"
11#include "arc/math/rectangle.h"
12#include "arc/std/bool.h"
13#include "arc/std/string.h"
14
15/**
16 * @brief
17*/
19
20/**
21 * @brief
22*/
24
25/**
26 * @brief creates ARC_ConsoleView type
27 *
28 * @param view ARC_ConsoleView to create
29 * @param bounds the bounds of the window, if bounds.w == 0 or bounds.h == 0, bounds will take up the entire screen
30*/
32
33/**
34 * @brief destroys ARC_ConsoleView type
35 *
36 * @param view ARC_ConsoleView to destroy
37*/
39
40/**
41 * @brief adds an ARC_ConsoleElement to the ARC_ConsoleView type
42 *
43 * @note the elements position will be based on the ARC_ConsoleView which might mess up how it looks
44 *
45 * @param view
46 * @param elment
47*/
49
50/**
51 * @brief
52 *
53 * @param view
54 * @param index
55*/
57
58/**
59 * @brief
60 *
61 * @param view
62 * @param index
63*/
65
66/**
67 * @brief
68 *
69 * @param view
70 * @param character
71 * @param pos
72*/
74
75/**
76 * @brief
77 *
78 * @param view
79 * @param character
80 * @param pos
81*/
83
84/**
85 * @brief
86 *
87 * @param view
88 * @param key
89 * @param pos
90*/
92
93/**
94 * @brief
95 *
96 * @param view
97 * @param uint32
98 * @param pos
99*/
101
102/**
103 * @brief
104 *
105 * @param view
106 * @param text
107 * @param pos
108*/
110
111/**
112 * @brief
113 *
114 * @param view
115 * @param text
116 * @param pos
117*/
119
120/**
121 * @brief
122 *
123 * @param view
124 * @param bounds
125*/
127
128/**
129 * @brief
130 *
131 * @param view
132*/
134
135/**
136 * @brief gets the bounds of an ARC_ConsoleView
137 *
138 * @param view ARC_ConsoleView to get bounds from
139 *
140 * @return the bounds of the ARC_ConsoleView
141*/
143
144/**
145 * @brief adds an ARC_ConsoleElement to the ARC_ConsoleView type
146 *
147 * @note the elements position will be based on the ARC_ConsoleView which might mess up how it looks
148 *
149 * @param view
150 * @param index
151*/
153
154/**
155 * @brief gets a char from the view
156 *
157 * @note use ARC_ConsoleView_GetInt32At if you want to check for direction key or special character input
158 *
159 * @param view the ARC_ConsoleView to get the char from
160*/
162
163/**
164 * @brief gets a char from the view at a position
165 *
166 * @note use ARC_ConsoleView_GetInt32At if you want to check for direction key or special character input
167 *
168 * @param view the ARC_ConsoleView to get the char from
169 * @param pos the positiion to get the char at
170*/
172
173/**
174 * @brief gets a console key from the view at a position
175 *
176 * @note you most likely do not want to use this function outside of a backend as ARC_ConsoleKey is defined within the console backend
177 *
178 * @param view the ARC_ConsoleView to get the console key from
179 * @param pos the positiion to get the console key at
180 *
181 * @return a console key
182*/
184
185/**
186 * @brief gets and creates a console key from the view at a position
187 *
188 * @note the given ARC_ConsoleKey needs to be destroyed
189 * @note use ARC_ConsoleView_GetConsoleKeyAt if you want to check for keyboard or special character input
190 *
191 * @param view the ARC_ConsoleView to get the console key from
192 * @param pos the positiion to get the console key at
193 *
194 * @return a console key
195*/
197
198/**
199 * @brief callback to check char being read in and override functionality
200 *
201 * @note this function is used for pressing arrow keys but can be used for anything
202 *
203 * @param key the current key being read in
204 * @param inputCStr the cstring that holds the current contents of the input
205 * @param inputSize the size of the current contents of the input string
206 * @param maxInputSize the max size inputCStr can store
207 * @param userdata data that a user can pass to use within this function
208*/
209typedef ARC_Bool (* ARC_ConsoleView_OverrideCharInputFn)(ARC_ConsoleKey *key, char *inputCStr, uint32_t *inputSize, uint32_t maxInputSize, void *userdata);
210
211/**
212 * @brief gets a ARC_String from the view at a position
213 *
214 * @param view the ARC_ConsoleView to get the string from
215 * @param pos the positiion to get the string at
216 * @param overrideCharInputFn a function to allow overriding what happens when inputing chars, can be NULL
217 * @param userdata data that a user can pass to use within the overrideCharInputFn
218*/
220
221/**
222 * @brief mouse options
223*/
224#define ARC_CONSOLE_VIEW_CURSOR_HIDDEN 0x00
225#define ARC_CONSOLE_VIEW_CURSOR_VISIBLE 0x01
226
227/**
228 * @brief sets a visibility of the cursor with an ARC_ConsoleView
229 *
230 * @param view ARC_ConsoleView to set mouse visibility
231 * @param visibility the visibility to set
232*/
234
235/**
236 * @brief border options
237*/
238#define ARC_CONSOLE_VIEW_BORDER_NONE 0x00
239#define ARC_CONSOLE_VIEW_BORDER_DEFAULT 0x01
240
241/**
242 * @brief sets a border on the ARC_ConsoleView
243 *
244 * @param view ARC_ConsoleView to set border to
245 * @param border The border to set
246*/
247void ARC_ConsoleView_SetBorder(ARC_ConsoleView *view, uint32_t border);
248
249/**
250 * @brief border options
251*/
252#define ARC_CONSOLE_VIEW_ATTRIBUTE_NONE 0x00
253#define ARC_CONSOLE_VIEW_ATTRIBUTE_REVERSE 0x01
254
255/**
256 * @brief sets a border on the ARC_ConsoleView
257 *
258 * @param view ARC_ConsoleView to set border to
259 * @param border The border to set
260*/
261void ARC_ConsoleView_SetAttribute(ARC_ConsoleView *view, uint32_t attribute);
262
263#ifdef __cplusplus
264}
265#endif
266
267#endif //!ARC_CONSOLE_VIEW_H_
#define ARC_Bool
Definition bool.h:10
void ARC_ConsoleView_RenderStringAt(ARC_ConsoleView *view, ARC_String *text, ARC_Point pos)
char ARC_ConsoleView_GetChar(ARC_ConsoleView *view)
gets a char from the view
void ARC_ConsoleView_RenderCStringWithStrlenAt(ARC_ConsoleView *view, char *cstr, ARC_Point pos)
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
void ARC_ConsoleView_RenderElements(ARC_ConsoleView *view)
void ARC_ConsoleView_RenderKeyAt(ARC_ConsoleView *view, ARC_ConsoleKey key, ARC_Point pos)
ARC_Rect ARC_ConsoleView_GetBounds(ARC_ConsoleView *view)
gets the bounds of an ARC_ConsoleView
void ARC_ConsoleView_RenderUint32At(ARC_ConsoleView *view, uint32_t uint32, ARC_Point pos)
struct ARC_ConsoleView ARC_ConsoleView
Definition view.h:18
void ARC_ConsoleView_Create(ARC_ConsoleView **view, ARC_Rect bounds)
creates ARC_ConsoleView type
void ARC_ConsoleView_RenderCharAt(ARC_ConsoleView *view, char character, ARC_Point pos)
ARC_ConsoleKey ARC_ConsoleView_GetConsoleKeyAt(ARC_ConsoleView *view, ARC_Point pos)
gets a console key from the view at a position
void ARC_ConsoleView_SetBorder(ARC_ConsoleView *view, uint32_t border)
sets a border on the ARC_ConsoleView
void ARC_ConsoleView_RenderWCharAt(ARC_ConsoleView *view, wchar_t character, ARC_Point pos)
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
Definition view.h:209
ARC_ConsoleKey * ARC_ConsoleView_GetCreateConsoleKeyAt(ARC_ConsoleView *view, ARC_Point pos)
gets and creates a console key from the view at a position
void ARC_ConsoleView_RemoveElement(ARC_ConsoleView *view, uint32_t index)
char ARC_ConsoleView_GetCharAt(ARC_ConsoleView *view, ARC_Point pos)
gets a char 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_AddElement(ARC_ConsoleView *view, ARC_ConsoleElement *element)
adds an ARC_ConsoleElement to the ARC_ConsoleView type
ARC_ConsoleElement * ARC_ConsoleView_GetElement(ARC_ConsoleView *view, uint32_t index)
adds an ARC_ConsoleElement to the ARC_ConsoleView type
void ARC_ConsoleView_SetAttribute(ARC_ConsoleView *view, uint32_t attribute)
sets a border on the ARC_ConsoleView
void ARC_ConsoleView_RenderRect(ARC_ConsoleView *view, ARC_Rect bounds)
void ARC_ConsoleView_Clear(ARC_ConsoleView *view)
void ARC_ConsoleView_Destroy(ARC_ConsoleView *view)
destroys ARC_ConsoleView type
struct ARC_ConsoleKeyType ARC_ConsoleKey
Definition key.h:11
ARC_Point pos
Definition element.h:32
substring position within a string
Definition string.h:14