f***ed up and needed to rework packages
This commit is contained in:
parent
b43ab1702f
commit
f7a87d7519
78 changed files with 3713 additions and 0 deletions
102
include/arc/console/buffer/line.h
Normal file
102
include/arc/console/buffer/line.h
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
#ifndef ARC_CONSOLE_LINE_BUFFER_H_
|
||||
#define ARC_CONSOLE_LINE_BUFFER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include "arc/console/view.h"
|
||||
#include "arc/std/string.h"
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
typedef struct ARC_ConsoleLineBuffer ARC_ConsoleLineBuffer;
|
||||
|
||||
/**
|
||||
* @brief creates ARC_ConsoleLineBuffer type
|
||||
*
|
||||
* @param buffer ARC_ConsoleLineBuffer to create
|
||||
*/
|
||||
void ARC_ConsoleLineBuffer_Create(ARC_ConsoleLineBuffer **buffer);
|
||||
|
||||
/**
|
||||
* @brief destroys ARC_ConsoleLineBuffer type
|
||||
*
|
||||
* @param buffer ARC_ConsoleLineBuffer to destroy
|
||||
*/
|
||||
void ARC_ConsoleLineBuffer_Destroy(ARC_ConsoleLineBuffer *buffer);
|
||||
|
||||
/**
|
||||
* @brief clears the contents of a ARC_ConsoleLineBuffer
|
||||
*
|
||||
* @param buffer ARC_ConsoleLineBuffer to clear
|
||||
*/
|
||||
void ARC_ConsoleLineBuffer_Clear(ARC_ConsoleLineBuffer *buffer);
|
||||
|
||||
/**
|
||||
* @brief renders a buffer to a ARC_ConsoleView
|
||||
*
|
||||
* @param buffer ARC_ConsoleLineBuffer to render
|
||||
* @param view ARC_ConsoleView to render the buffer contents to
|
||||
*/
|
||||
void ARC_ConsoleLineBuffer_Render(ARC_ConsoleLineBuffer *buffer, ARC_ConsoleView *view);
|
||||
|
||||
/**
|
||||
* @brief renders a section of buffer to a ARC_ConsoleView
|
||||
*
|
||||
* @param buffer ARC_ConsoleLineBuffer to render
|
||||
* @param view ARC_ConsoleView to render the buffer contents to
|
||||
* @param startIndex start index of buffer to render
|
||||
* @param lines the number of lines of buffer to render
|
||||
*/
|
||||
void ARC_ConsoleLineBuffer_RenderSection(ARC_ConsoleLineBuffer *buffer, ARC_ConsoleView *view, uint32_t startIndex, uint32_t lines);
|
||||
|
||||
/**
|
||||
* @brief adds a character to the buffer
|
||||
*
|
||||
* @param buffer ARC_ConsoleLineBuffer to add character to
|
||||
* @param character char to add to ARC_ConsoleBuffer
|
||||
*/
|
||||
void ARC_ConsoleLineBuffer_AddChar(ARC_ConsoleLineBuffer *buffer, char character);
|
||||
|
||||
/**
|
||||
* @brief adds an ARC_String to the buffer
|
||||
*
|
||||
* @param buffer ARC_ConsoleLineBuffer to add character to
|
||||
* @param string ARC_String to add to ARC_ConsoleLineBuffer
|
||||
*/
|
||||
void ARC_ConsoleLineBuffer_AddString(ARC_ConsoleLineBuffer *buffer, ARC_String *string);
|
||||
|
||||
/**
|
||||
* @brief adds a cstring to the buffer
|
||||
*
|
||||
* @param buffer ARC_ConsoleLineBuffer to add character to
|
||||
* @param string cstring to add to ARC_ConsoleLineBuffer
|
||||
* @param length the length of the c string to add
|
||||
*/
|
||||
void ARC_ConsoleLineBuffer_AddCString(ARC_ConsoleLineBuffer *buffer, char *cstring, uint64_t length);
|
||||
|
||||
/**
|
||||
* @brief adds a cstring to the buffer with the cstrings string length
|
||||
*
|
||||
* @param buffer ARC_ConsoleLineBuffer to add character to
|
||||
* @param string cstring to add to ARC_ConsoleLineBuffer
|
||||
*/
|
||||
void ARC_ConsoleLineBuffer_AddCStringWithStrlen(ARC_ConsoleLineBuffer *buffer, char *cstring);
|
||||
|
||||
/**
|
||||
* @brief gets the number of lines from a console line buffer
|
||||
*
|
||||
* @param buffer ARC_ConsoleLineBuffer get number of lines from
|
||||
*
|
||||
* @return the number of lines within an ARC_ConsoleLineBuffer
|
||||
*/
|
||||
uint32_t ARC_ConsoleLineBuffer_GetLineNumbers(ARC_ConsoleLineBuffer *buffer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //!ARC_CONSOLE_LINE_BUFFER_H_
|
||||
98
include/arc/console/buffer/view.h
Normal file
98
include/arc/console/buffer/view.h
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
#ifndef ARC_CONSOLE_VIEW_BUFFER_H_
|
||||
#define ARC_CONSOLE_VIEW_BUFFER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include "arc/console/view.h"
|
||||
#include "arc/math/point.h"
|
||||
#include "arc/std/string.h"
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
typedef struct ARC_ConsoleViewBuffer ARC_ConsoleViewBuffer;
|
||||
|
||||
/**
|
||||
* @brief creates ARC_ConsoleViewBuffer type
|
||||
*
|
||||
* @param buffer ARC_ConsoleViewBuffer to create
|
||||
*/
|
||||
void ARC_ConsoleViewBuffer_Create(ARC_ConsoleViewBuffer **buffer, ARC_ConsoleView *view);
|
||||
|
||||
/**
|
||||
* @brief destroys ARC_ConsoleViewBuffer type
|
||||
*
|
||||
* @param buffer ARC_ConsoleViewBuffer to destroy
|
||||
*/
|
||||
void ARC_ConsoleViewBuffer_Destroy(ARC_ConsoleViewBuffer *buffer);
|
||||
|
||||
/**
|
||||
* @brief clears the contents of a ARC_ConsoleViewBuffer
|
||||
*
|
||||
* @param buffer ARC_ConsoleViewBuffer to clear
|
||||
*/
|
||||
void ARC_ConsoleViewBuffer_Clear(ARC_ConsoleViewBuffer *buffer);
|
||||
|
||||
/**
|
||||
* @brief renders a buffer to a ARC_ConsoleView
|
||||
*
|
||||
* @param buffer ARC_ConsoleViewBuffer to render
|
||||
* @param view ARC_ConsoleView to render the buffer contents to
|
||||
*/
|
||||
void ARC_ConsoleViewBuffer_Render(ARC_ConsoleViewBuffer *buffer, ARC_ConsoleView *view);
|
||||
|
||||
/**
|
||||
* @brief renders a section of buffer to a ARC_ConsoleView
|
||||
*
|
||||
* @param buffer ARC_ConsoleViewBuffer to render
|
||||
* @param view ARC_ConsoleView to render the buffer contents to
|
||||
* @param startIndex start index of buffer to render
|
||||
* @param lines the number of lines of buffer to render
|
||||
*/
|
||||
void ARC_ConsoleViewBuffer_RenderArea(ARC_ConsoleViewBuffer *buffer, ARC_ConsoleView *view, uint32_t startIndex, uint32_t lines);
|
||||
|
||||
/**
|
||||
* @brief adds a character to the buffer
|
||||
*
|
||||
* @param buffer ARC_ConsoleViewBuffer to add character to
|
||||
* @param character char to add to ARC_ConsoleBuffer
|
||||
* @param pos position to add the char at
|
||||
*/
|
||||
void ARC_ConsoleViewBuffer_AddCharAt(ARC_ConsoleViewBuffer *buffer, char character, ARC_Point pos);
|
||||
|
||||
/**
|
||||
* @brief adds an ARC_String to the buffer
|
||||
*
|
||||
* @param buffer ARC_ConsoleViewBuffer to add character to
|
||||
* @param string ARC_String to add to ARC_ConsoleViewBuffer
|
||||
* @param pos position to add the char at
|
||||
*/
|
||||
void ARC_ConsoleViewBuffer_AddStringAt(ARC_ConsoleViewBuffer *buffer, ARC_String *string, ARC_Point pos);
|
||||
|
||||
/**
|
||||
* @brief adds a cstring to the buffer
|
||||
*
|
||||
* @param buffer ARC_ConsoleViewBuffer to add character to
|
||||
* @param string cstring to add to ARC_ConsoleViewBuffer
|
||||
* @param length the length of the c string to add
|
||||
* @param pos position to add the char at
|
||||
*/
|
||||
void ARC_ConsoleViewBuffer_AddCString(ARC_ConsoleViewBuffer *buffer, char *cstring, uint64_t length);
|
||||
|
||||
/**
|
||||
* @brief adds a cstring to the buffer with the cstrings string length
|
||||
*
|
||||
* @param buffer ARC_ConsoleViewBuffer to add character to
|
||||
* @param string cstring to add to ARC_ConsoleViewBuffer
|
||||
* @param pos position to add the char at
|
||||
*/
|
||||
void ARC_ConsoleViewBuffer_AddCStringWithStrlen(ARC_ConsoleViewBuffer *buffer, char *cstring);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // [!ARC_CONSOLE_VIEW_BUFFER_H_
|
||||
78
include/arc/console/element.h
Normal file
78
include/arc/console/element.h
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
#ifndef ARC_NCURSES_ELEMENT_H_
|
||||
#define ARC_NCURSES_ELEMENT_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include "view.h"
|
||||
#include "arc/std/string.h"
|
||||
#include "arc/std/bool.h"
|
||||
#include "arc/math/point.h"
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
typedef struct ARC_ConsoleElement ARC_ConsoleElement;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
typedef void (*ARC_ConsoleElement_RenderFn)(ARC_ConsoleView *view, ARC_ConsoleElement *element);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
typedef struct ARC_ConsoleElement {
|
||||
uint32_t type;
|
||||
uint8_t flags;
|
||||
ARC_String *string;
|
||||
|
||||
ARC_Point pos;
|
||||
|
||||
ARC_ConsoleElement_RenderFn renderFn;
|
||||
} ARC_ConsoleElement;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
#define ARC_CONSOLE_ELEMENT_FLAG_NONE 0b00000000
|
||||
#define ARC_CONSOLE_ELEMENT_FLAG_SELECTABLE 0b00000001
|
||||
#define ARC_CONSOLE_ELEMENT_FLAG_SELECTED 0b00000010
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void ARC_ConsoleElement_Create(ARC_ConsoleElement **element, uint32_t type, uint8_t flags, ARC_String *string, ARC_Point pos, ARC_ConsoleElement_RenderFn renderFn);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void ARC_ConsoleElement_Destroy(ARC_ConsoleElement *element);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void ARC_ConsoleElement_DefaultRenderFn(ARC_ConsoleView *view, ARC_ConsoleElement *element);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
ARC_Bool ARC_ConsoleElement_IsSelectable(ARC_ConsoleElement *element);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
void ARC_ConsoleElement_SetSelected(ARC_ConsoleElement *element, ARC_Bool selected);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void ARC_ConsoleElement_ToggleSelected(ARC_ConsoleElement *element);
|
||||
|
||||
#endif //!ARC_CONSOLE_ELEMENT_H_
|
||||
76
include/arc/console/key.h
Normal file
76
include/arc/console/key.h
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
#ifndef ARC_CONSOLE_KEY_H_
|
||||
#define ARC_CONSOLE_KEY_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "arc/std/bool.h"
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct ARC_ConsoleKeyType ARC_ConsoleKey;
|
||||
|
||||
typedef enum ARC_ConsoleKey_Key {
|
||||
ARC_KEY_A,
|
||||
ARC_KEY_B,
|
||||
ARC_KEY_C,
|
||||
ARC_KEY_D,
|
||||
ARC_KEY_E,
|
||||
ARC_KEY_F,
|
||||
ARC_KEY_G,
|
||||
ARC_KEY_H,
|
||||
ARC_KEY_I,
|
||||
ARC_KEY_J,
|
||||
ARC_KEY_K,
|
||||
ARC_KEY_L,
|
||||
ARC_KEY_M,
|
||||
ARC_KEY_N,
|
||||
ARC_KEY_O,
|
||||
ARC_KEY_P,
|
||||
ARC_KEY_Q,
|
||||
ARC_KEY_R,
|
||||
ARC_KEY_S,
|
||||
ARC_KEY_T,
|
||||
ARC_KEY_U,
|
||||
ARC_KEY_V,
|
||||
ARC_KEY_W,
|
||||
ARC_KEY_X,
|
||||
ARC_KEY_Y,
|
||||
ARC_KEY_Z,
|
||||
|
||||
ARC_KEY_0,
|
||||
ARC_KEY_1,
|
||||
ARC_KEY_2,
|
||||
ARC_KEY_3,
|
||||
ARC_KEY_4,
|
||||
ARC_KEY_5,
|
||||
ARC_KEY_6,
|
||||
ARC_KEY_7,
|
||||
ARC_KEY_8,
|
||||
ARC_KEY_9,
|
||||
|
||||
ARC_KEY_LEFT,
|
||||
ARC_KEY_RIGHT,
|
||||
ARC_KEY_DOWN,
|
||||
ARC_KEY_UP,
|
||||
|
||||
ARC_KEY_ESC
|
||||
} ARC_ConsoleKey_Key;
|
||||
|
||||
void ARC_ConsoleKey_Create(ARC_ConsoleKey **consoleKey, ARC_ConsoleKey_Key *key);
|
||||
|
||||
void ARC_ConsoleKey_Destroy(ARC_ConsoleKey *consoleKey);
|
||||
|
||||
ARC_Bool ARC_ConsoleKey_Equals(ARC_ConsoleKey consoleKey, enum ARC_ConsoleKey_Key key);
|
||||
|
||||
ARC_Bool ARC_ConsoleKey_EqualsPointer(ARC_ConsoleKey *consoleKey, enum ARC_ConsoleKey_Key key);
|
||||
|
||||
ARC_ConsoleKey ARC_Keyboard_GetConsoleKey(enum ARC_ConsoleKey_Key key);
|
||||
|
||||
uint8_t ARC_ConsoleKey_GetCharFromKey(ARC_ConsoleKey *consoleKey);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // !ARC_CONSOLE_KEY_H_
|
||||
97
include/arc/console/shell.h
Normal file
97
include/arc/console/shell.h
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
#ifndef ARC_CONSOLE_SHELL_H_
|
||||
#define ARC_CONSOLE_SHELL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//TODO: fix up this file
|
||||
|
||||
#include "view.h"
|
||||
//#include "buffer.h"
|
||||
#include "arc/std/string.h"
|
||||
#include "arc/std/vector.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
typedef struct ARC_ConsoleShell ARC_ConsoleShell;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
typedef void (* ARC_ConsoleShell_UpdateFn)(ARC_ConsoleShell *shell);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
struct ARC_ConsoleShell {
|
||||
ARC_ConsoleView *view;
|
||||
// ARC_ConsoleBuffer *buffer;
|
||||
uint32_t bufferLineIndex;
|
||||
|
||||
ARC_Vector *history;
|
||||
uint32_t historyIndex;
|
||||
|
||||
ARC_ConsoleShell_UpdateFn updateFn;
|
||||
|
||||
ARC_String *currentLine;
|
||||
ARC_String *userInput;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief creates ARC_ConsoleShell type
|
||||
*
|
||||
* @param shell ARC_ConsoleShell to create
|
||||
* @param view ARC_ConsoleView to attach the shell to
|
||||
* @param updateFn ARC_ConsoleShell_UpdateFn provided that will run the console
|
||||
*/
|
||||
void ARC_ConsoleShell_Create(ARC_ConsoleShell **shell, ARC_ConsoleView *view, ARC_ConsoleShell_UpdateFn updateFn);
|
||||
|
||||
/**
|
||||
* @brief destroys ARC_ConsoleShell type
|
||||
*
|
||||
* @param shell ARC_ConsoleShell to destroy
|
||||
*/
|
||||
void ARC_ConsoleShell_Destroy(ARC_ConsoleShell *shell);
|
||||
|
||||
/**
|
||||
* @brief updates the ARC_ConsoleShell type
|
||||
*
|
||||
* @param shell the ARC_ConsoleShell to update
|
||||
*/
|
||||
void ARC_ConsoleShell_Update(ARC_ConsoleShell *shell);
|
||||
|
||||
/**
|
||||
* @brief renders the ARC_ConsoleShell type
|
||||
*
|
||||
* @param shell the ARC_ConsoleShell to render
|
||||
*/
|
||||
void ARC_ConsoleShell_Render(ARC_ConsoleShell *shell);
|
||||
|
||||
/**
|
||||
* @brief adds history ARC_String to ARC_ConsoleShell
|
||||
*
|
||||
* @param shell the ARC_ConsoleShell to add history to
|
||||
* @param string the history string to add to ARC_ConsoleShell
|
||||
*/
|
||||
void ARC_ConsoleShell_AddHistory(ARC_ConsoleShell *shell, ARC_String *string);
|
||||
|
||||
/**
|
||||
* @brief gets history from ARC_ConsoleShell
|
||||
*
|
||||
* @note the index 0 will start from the last added history
|
||||
*
|
||||
* @param shell the ARC_ConsoleShell to get history from
|
||||
* @param index the location to get history at
|
||||
*
|
||||
* @return the history as an ARC_String
|
||||
*/
|
||||
ARC_String *ARC_ConsoleShell_GetHistoryAt(ARC_ConsoleShell *shell, uint32_t index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //!ARC_CONSOLE_SHELL_H_
|
||||
267
include/arc/console/view.h
Normal file
267
include/arc/console/view.h
Normal file
|
|
@ -0,0 +1,267 @@
|
|||
#ifndef ARC_CONSOLE_VIEW_H_
|
||||
#define ARC_CONSOLE_VIEW_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#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"
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
typedef struct ARC_ConsoleView ARC_ConsoleView;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
typedef struct ARC_ConsoleElement ARC_ConsoleElement;
|
||||
|
||||
/**
|
||||
* @brief creates ARC_ConsoleView type
|
||||
*
|
||||
* @param view ARC_ConsoleView to create
|
||||
* @param bounds the bounds of the window, if bounds.w == 0 or bounds.h == 0, bounds will take up the entire screen
|
||||
*/
|
||||
void ARC_ConsoleView_Create(ARC_ConsoleView **view, ARC_Rect bounds);
|
||||
|
||||
/**
|
||||
* @brief destroys ARC_ConsoleView type
|
||||
*
|
||||
* @param view ARC_ConsoleView to destroy
|
||||
*/
|
||||
void ARC_ConsoleView_Destroy(ARC_ConsoleView *view);
|
||||
|
||||
/**
|
||||
* @brief 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
|
||||
*
|
||||
* @param view
|
||||
* @param elment
|
||||
*/
|
||||
void ARC_ConsoleView_AddElement(ARC_ConsoleView *view, ARC_ConsoleElement *element);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param view
|
||||
* @param index
|
||||
*/
|
||||
void ARC_ConsoleView_RemoveElement(ARC_ConsoleView *view, uint32_t index);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param view
|
||||
* @param index
|
||||
*/
|
||||
void ARC_ConsoleView_Clear(ARC_ConsoleView *view);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param view
|
||||
* @param character
|
||||
* @param pos
|
||||
*/
|
||||
void ARC_ConsoleView_RenderCharAt(ARC_ConsoleView *view, char character, ARC_Point pos);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param view
|
||||
* @param character
|
||||
* @param pos
|
||||
*/
|
||||
void ARC_ConsoleView_RenderWCharAt(ARC_ConsoleView *view, wchar_t character, ARC_Point pos);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param view
|
||||
* @param key
|
||||
* @param pos
|
||||
*/
|
||||
void ARC_ConsoleView_RenderKeyAt(ARC_ConsoleView *view, ARC_ConsoleKey key, ARC_Point pos);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param view
|
||||
* @param uint32
|
||||
* @param pos
|
||||
*/
|
||||
void ARC_ConsoleView_RenderUint32At(ARC_ConsoleView *view, uint32_t uint32, ARC_Point pos);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param view
|
||||
* @param text
|
||||
* @param pos
|
||||
*/
|
||||
void ARC_ConsoleView_RenderStringAt(ARC_ConsoleView *view, ARC_String *text, ARC_Point pos);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param view
|
||||
* @param text
|
||||
* @param pos
|
||||
*/
|
||||
void ARC_ConsoleView_RenderCStringWithStrlenAt(ARC_ConsoleView *view, char *cstr, ARC_Point pos);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param view
|
||||
* @param bounds
|
||||
*/
|
||||
void ARC_ConsoleView_RenderRect(ARC_ConsoleView *view, ARC_Rect bounds);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
void ARC_ConsoleView_RenderElements(ARC_ConsoleView *view);
|
||||
|
||||
/**
|
||||
* @brief gets the bounds of an ARC_ConsoleView
|
||||
*
|
||||
* @param view ARC_ConsoleView to get bounds from
|
||||
*
|
||||
* @return the bounds of the ARC_ConsoleView
|
||||
*/
|
||||
ARC_Rect ARC_ConsoleView_GetBounds(ARC_ConsoleView *view);
|
||||
|
||||
/**
|
||||
* @brief 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
|
||||
*
|
||||
* @param view
|
||||
* @param index
|
||||
*/
|
||||
ARC_ConsoleElement *ARC_ConsoleView_GetElement(ARC_ConsoleView *view, uint32_t index);
|
||||
|
||||
/**
|
||||
* @brief gets a char from the view
|
||||
*
|
||||
* @note use ARC_ConsoleView_GetInt32At if you want to check for direction key or special character input
|
||||
*
|
||||
* @param view the ARC_ConsoleView to get the char from
|
||||
*/
|
||||
char ARC_ConsoleView_GetChar(ARC_ConsoleView *view);
|
||||
|
||||
/**
|
||||
* @brief 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
|
||||
*
|
||||
* @param view the ARC_ConsoleView to get the char from
|
||||
* @param pos the positiion to get the char at
|
||||
*/
|
||||
char ARC_ConsoleView_GetCharAt(ARC_ConsoleView *view, ARC_Point pos);
|
||||
|
||||
/**
|
||||
* @brief 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
|
||||
*
|
||||
* @param view the ARC_ConsoleView to get the console key from
|
||||
* @param pos the positiion to get the console key at
|
||||
*
|
||||
* @return a console key
|
||||
*/
|
||||
ARC_ConsoleKey ARC_ConsoleView_GetConsoleKeyAt(ARC_ConsoleView *view, ARC_Point pos);
|
||||
|
||||
/**
|
||||
* @brief gets and creates a console key from the view at a position
|
||||
*
|
||||
* @note the given ARC_ConsoleKey needs to be destroyed
|
||||
* @note use ARC_ConsoleView_GetConsoleKeyAt if you want to check for keyboard or special character input
|
||||
*
|
||||
* @param view the ARC_ConsoleView to get the console key from
|
||||
* @param pos the positiion to get the console key at
|
||||
*
|
||||
* @return a console key
|
||||
*/
|
||||
ARC_ConsoleKey *ARC_ConsoleView_GetCreateConsoleKeyAt(ARC_ConsoleView *view, ARC_Point pos);
|
||||
|
||||
/**
|
||||
* @brief 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
|
||||
*
|
||||
* @param key the current key being read in
|
||||
* @param inputCStr the cstring that holds the current contents of the input
|
||||
* @param inputSize the size of the current contents of the input string
|
||||
* @param maxInputSize the max size inputCStr can store
|
||||
* @param userdata data that a user can pass to use within this function
|
||||
*/
|
||||
typedef ARC_Bool (* ARC_ConsoleView_OverrideCharInputFn)(ARC_ConsoleKey *key, char *inputCStr, uint32_t *inputSize, uint32_t maxInputSize, void *userdata);
|
||||
|
||||
/**
|
||||
* @brief gets a ARC_String from the view at a position
|
||||
*
|
||||
* @param view the ARC_ConsoleView to get the string from
|
||||
* @param pos the positiion to get the string at
|
||||
* @param overrideCharInputFn a function to allow overriding what happens when inputing chars, can be NULL
|
||||
* @param userdata data that a user can pass to use within the overrideCharInputFn
|
||||
*/
|
||||
ARC_String *ARC_ConsoleView_GetStringInput(ARC_ConsoleView *view, ARC_Point pos, ARC_ConsoleView_OverrideCharInputFn *overrideCharInputFn, void *userdata);
|
||||
|
||||
/**
|
||||
* @brief mouse options
|
||||
*/
|
||||
#define ARC_CONSOLE_VIEW_CURSOR_HIDDEN 0x00
|
||||
#define ARC_CONSOLE_VIEW_CURSOR_VISIBLE 0x01
|
||||
|
||||
/**
|
||||
* @brief sets a visibility of the cursor with an ARC_ConsoleView
|
||||
*
|
||||
* @param view ARC_ConsoleView to set mouse visibility
|
||||
* @param visibility the visibility to set
|
||||
*/
|
||||
void ARC_ConsoleView_SetCursorVisibility(ARC_ConsoleView *view, uint8_t visibility);
|
||||
|
||||
/**
|
||||
* @brief border options
|
||||
*/
|
||||
#define ARC_CONSOLE_VIEW_BORDER_NONE 0x00
|
||||
#define ARC_CONSOLE_VIEW_BORDER_DEFAULT 0x01
|
||||
|
||||
/**
|
||||
* @brief sets a border on the ARC_ConsoleView
|
||||
*
|
||||
* @param view ARC_ConsoleView to set border to
|
||||
* @param border The border to set
|
||||
*/
|
||||
void ARC_ConsoleView_SetBorder(ARC_ConsoleView *view, uint32_t border);
|
||||
|
||||
/**
|
||||
* @brief border options
|
||||
*/
|
||||
#define ARC_CONSOLE_VIEW_ATTRIBUTE_NONE 0x00
|
||||
#define ARC_CONSOLE_VIEW_ATTRIBUTE_REVERSE 0x01
|
||||
|
||||
/**
|
||||
* @brief sets a border on the ARC_ConsoleView
|
||||
*
|
||||
* @param view ARC_ConsoleView to set border to
|
||||
* @param border The border to set
|
||||
*/
|
||||
void ARC_ConsoleView_SetAttribute(ARC_ConsoleView *view, uint32_t attribute);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //!ARC_CONSOLE_VIEW_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue