Introduce edit_field entity

master
rexim 2018-08-04 23:27:15 +07:00
parent 0f8f771521
commit e25fd13f94
3 changed files with 71 additions and 1 deletions

View File

@ -20,8 +20,8 @@ set(SOURCE_FILES
src/color.c
src/game.c
src/game/camera.c
src/game/debug_node.h
src/game/debug_tree.c
src/game/edit_field.c
src/game/level.c
src/game/level/background.c
src/game/level/boxes.c
@ -56,6 +56,7 @@ set(HEADER_FILES
src/game/camera.h
src/game/debug_node.h
src/game/debug_tree.h
src/game/edit_field.h
src/game/level.h
src/game/level/background.h
src/game/level/boxes.h

49
src/game/edit_field.c Normal file
View File

@ -0,0 +1,49 @@
#include <assert.h>
#include "game/sprite_font.h"
#include "system/lt.h"
#include "edit_field.h"
struct edit_field_t
{
lt_t *lt;
char *buffer;
size_t size;
size_t capacity;
size_t cursor;
};
edit_field_t *create_edit_field(const sprite_font_t *font)
{
assert(font);
return NULL;
}
void destroy_edit_field(edit_field_t *edit_field)
{
assert(edit_field);
}
int edit_field_render(const edit_field_t *edit_field,
SDL_Renderer *renderer,
point_t position)
{
assert(edit_field);
assert(renderer);
(void) position;
return 0;
}
int edit_field_handle_event(edit_field_t *edit_field,
const SDL_Event *event)
{
assert(edit_field);
assert(event);
return 0;
}
const char *edit_field_as_text(const edit_field_t *edit_field)
{
assert(edit_field);
return NULL;
}

20
src/game/edit_field.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef EDIT_FIELD_H_
#define EDIT_FIELD_H_
#include <SDL2/SDL.h>
typedef struct edit_field_t edit_field_t;
edit_field_t *create_edit_field(const sprite_font_t *font);
void destroy_edit_field(edit_field_t *edit_field);
int edit_field_render(const edit_field_t *edit_field,
SDL_Renderer *renderer,
point_t position);
int edit_field_handle_event(edit_field_t *edit_field,
const SDL_Event *event);
const char *edit_field_as_text(const edit_field_t *edit_field);
#endif // EDIT_FIELD_H_