abt to big refactor

This commit is contained in:
2025-04-08 20:24:00 -05:00
parent a779da6c72
commit 9208ebb685
17 changed files with 501 additions and 83 deletions

View File

@ -7,13 +7,29 @@
#include "console/console.h"
#include "server/server.h"
#include "util/string.h"
bool_t exitRequested = false;
void cmdExit(const consolecmdexec_t *exec) {
CloseWindow();
exitRequested = true;
}
void cmdServe(const consolecmdexec_t *exec) {
serverStart(3030);
uint16_t port = 3030;
if(exec->argc != 0) {
if(!stringToU16(exec->argv[0], &port)) {
consolePrint("Invalid port number: %s", exec->argv[0]);
return;
}
}
errorret_t ret = serverStart(port);
if(ret != ERROR_OK) {
consolePrint("Failed to start server: %s", errorString());
errorFlush();
return;
}
}
void cmdClose(const consolecmdexec_t *exec) {
@ -39,6 +55,8 @@ int main(void) {
consoleDraw();
EndDrawing();
if(exitRequested) break;
}
CloseWindow();