random cmenu stuff
This commit is contained in:
+8
-11
@@ -11,18 +11,15 @@ typedef struct Color {
|
|||||||
#define WHITE ((Color){255,255,255})
|
#define WHITE ((Color){255,255,255})
|
||||||
#define BLACK ((Color){0,0,0})
|
#define BLACK ((Color){0,0,0})
|
||||||
|
|
||||||
typedef enum Key {
|
typedef enum Action {
|
||||||
Key_backspace,
|
Action_Backspace,
|
||||||
Key_ctrl,
|
Action_Select,
|
||||||
Key_enter,
|
Action_Next,
|
||||||
Key_h,
|
Action_Previous,
|
||||||
Key_n,
|
Count_Action
|
||||||
Key_p,
|
} Action;
|
||||||
Key_y,
|
|
||||||
Count_Key
|
|
||||||
} Key;
|
|
||||||
|
|
||||||
bool KeyPressed(Key key);
|
bool ActionPressed(Action key);
|
||||||
bool InputGetNextPrintable(char const *out_key);
|
bool InputGetNextPrintable(char const *out_key);
|
||||||
|
|
||||||
typedef struct Cell {
|
typedef struct Cell {
|
||||||
|
|||||||
+2
-5
@@ -42,6 +42,8 @@ bool StringSub(String string, int start, int end, String *out_substr) {
|
|||||||
return start_ok && end_ok;
|
return start_ok && end_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: foobar
|
||||||
|
|
||||||
String StringFromCString(unsigned char const *s) {
|
String StringFromCString(unsigned char const *s) {
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
while (s[size] != '\0') { size++; }
|
while (s[size] != '\0') { size++; }
|
||||||
@@ -50,8 +52,3 @@ String StringFromCString(unsigned char const *s) {
|
|||||||
.size=size,
|
.size=size,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
typedef struct String {
|
|
||||||
unsigned char const *buffer;
|
|
||||||
size_t size;
|
|
||||||
} String;
|
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -1,4 +1,7 @@
|
|||||||
|
#ifndef STRING_HEADER
|
||||||
|
#define STRING_HEADER
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
typedef struct String {
|
typedef struct String {
|
||||||
unsigned char const *buffer;
|
unsigned char const *buffer;
|
||||||
@@ -8,4 +11,5 @@ typedef struct String {
|
|||||||
#define STRING(content) ((String){.buffer=#content, .size=sizeof(#content)-1})
|
#define STRING(content) ((String){.buffer=#content, .size=sizeof(#content)-1})
|
||||||
|
|
||||||
bool StringSub(String string, int start, int end, String *out_substr);
|
bool StringSub(String string, int start, int end, String *out_substr);
|
||||||
String StringFromCString(char const *s);
|
String StringFromCString(unsigned char const *s);
|
||||||
|
#endif// STRING_HEADER
|
||||||
|
|||||||
Reference in New Issue
Block a user