Partially finished client

This commit is contained in:
2025-04-09 17:21:49 -05:00
parent 6c71debd05
commit 1b336ff559
19 changed files with 664 additions and 47 deletions

View File

@ -6,6 +6,7 @@
*/
#include "console/console.h"
#include "client/client.h"
#include "server/server.h"
#include "util/string.h"
#include "assert/assert.h"
@ -16,41 +17,13 @@ void cmdExit(const consolecmdexec_t *exec) {
exitRequested = true;
}
void cmdServe(const consolecmdexec_t *exec) {
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((serverstart_t){
.type = SERVER_TYPE_NETWORKED,
.networked = {
.port = 3030
}
});
if(ret != ERROR_OK) {
consolePrint("Failed to start server: %s", errorString());
errorFlush();
return;
}
}
void cmdClose(const consolecmdexec_t *exec) {
serverStop();
}
int main(void) {
assertInit();
consoleInit();
clientInit();
serverInit();
consoleRegCmd("exit", cmdExit);
consoleRegCmd("serve", cmdServe);
consoleRegCmd("close", cmdClose);
InitWindow(1280, 720, DUSK_NAME);
@ -68,7 +41,9 @@ int main(void) {
}
CloseWindow();
serverDispose();
clientDispose();
return EXIT_SUCCESS;
}