Put the stuff in a more sensible position

This commit is contained in:
Bill Rossi 2025-01-07 20:47:31 -05:00
parent dfd204ff14
commit b994cb895d
3 changed files with 13 additions and 7 deletions

View File

@ -20,9 +20,10 @@ Game *game_create(void) {
Log *log = create_log(); Log *log = create_log();
g->log = log; g->log = log;
Vector2 input_position = { 190, 200 }; Vector2 input_position = { 20, 400 };
Input *input = create_input(input_position); Input *input = create_input(input_position);
input->log = log; input->log = log;
log->input = input;
input->g = g; input->g = g;
input->command = '>'; // Don't change this input->command = '>'; // Don't change this
@ -91,7 +92,7 @@ void game_handle_directional_command(Game *g, const char *c) {
} }
} }
#define INVALID_COMMAND "I don't know how to " #define INVALID_COMMAND "I don't know how to %s"
void game_handle_command(Game *g, const char *command) { void game_handle_command(Game *g, const char *command) {
Input *input = g->input; Input *input = g->input;
@ -110,7 +111,7 @@ void game_handle_command(Game *g, const char *command) {
break; break;
default: default:
char *response = malloc(strlen(INVALID_COMMAND) + strlen(command) + 1); char *response = malloc(strlen(INVALID_COMMAND) + strlen(command) + 1);
sprintf(response, INVALID_COMMAND "%s", command); sprintf(response, INVALID_COMMAND, command);
push_line_to_log(input->log, response); push_line_to_log(input->log, response);
free(response); free(response);
break; break;

View File

@ -8,8 +8,8 @@ void draw_log(Log* log) {
for(int line_num = 0; line_num < log->line_count; line_num++) { for(int line_num = 0; line_num < log->line_count; line_num++) {
DrawText( DrawText(
log->lines[line_num], log->lines[line_num],
190, log->input->position.x,
200 + ((line_num - log->line_count) * 20), log->input->position.y + ((line_num - log->line_count) * 20),
20, 20,
RAYWHITE RAYWHITE
); );

View File

@ -1,10 +1,15 @@
#ifndef _FD_LOG_ #ifndef _FD_LOG_
#define _FD_LOG_ #define _FD_LOG_
typedef struct Log { typedef struct Log Log;
#include "input.h"
struct Log {
char** lines; char** lines;
int line_count; int line_count;
} Log; Input *input;
};
Log *create_log(void); Log *create_log(void);
void draw_log(Log*); void draw_log(Log*);