random cmenu stuff

This commit is contained in:
2026-09-22 22:46:53 +02:00
parent 123529d03f
commit 6776883aa5
3 changed files with 15 additions and 17 deletions
+8 -11
View File
@@ -11,18 +11,15 @@ typedef struct Color {
#define WHITE ((Color){255,255,255})
#define BLACK ((Color){0,0,0})
typedef enum Key {
Key_backspace,
Key_ctrl,
Key_enter,
Key_h,
Key_n,
Key_p,
Key_y,
Count_Key
} Key;
typedef enum Action {
Action_Backspace,
Action_Select,
Action_Next,
Action_Previous,
Count_Action
} Action;
bool KeyPressed(Key key);
bool ActionPressed(Action key);
bool InputGetNextPrintable(char const *out_key);
typedef struct Cell {
+2 -5
View File
@@ -42,6 +42,8 @@ bool StringSub(String string, int start, int end, String *out_substr) {
return start_ok && end_ok;
}
// TODO: foobar
String StringFromCString(unsigned char const *s) {
size_t size = 0;
while (s[size] != '\0') { size++; }
@@ -50,8 +52,3 @@ String StringFromCString(unsigned char const *s) {
.size=size,
};
}
typedef struct String {
unsigned char const *buffer;
size_t size;
} String;
+5 -1
View File
@@ -1,4 +1,7 @@
#ifndef STRING_HEADER
#define STRING_HEADER
#include <stddef.h>
#include <stdbool.h>
typedef struct String {
unsigned char const *buffer;
@@ -8,4 +11,5 @@ typedef struct String {
#define STRING(content) ((String){.buffer=#content, .size=sizeof(#content)-1})
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