Bla bla
This commit is contained in:
+6
-35
@@ -1,11 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/* This houses the state of an actual, running game; your player, the
|
/* This houses the state of an actual, running game; your player, the
|
||||||
other players, the world map, buildings. TODO: move some stuff to
|
other players, the world map, buildings. */
|
||||||
separate files. */
|
|
||||||
|
|
||||||
#include <glib-2.0/glib.h>
|
#include <glib-2.0/glib.h>
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
#include "world.h"
|
||||||
|
|
||||||
typedef struct Player
|
typedef struct Player
|
||||||
{
|
{
|
||||||
unsigned int id;
|
unsigned int id;
|
||||||
@@ -18,41 +20,10 @@ typedef struct Player
|
|||||||
gboolean is_alive : 1, is_human : 1;
|
gboolean is_alive : 1, is_human : 1;
|
||||||
} Player;
|
} Player;
|
||||||
|
|
||||||
typedef enum TerrainType
|
|
||||||
{
|
|
||||||
TERRAIN_WATER,
|
|
||||||
TERRAIN_FLAT,
|
|
||||||
TERRAIN_HILL,
|
|
||||||
TERRAIN_MOUNTAIN
|
|
||||||
} TerrainType;
|
|
||||||
|
|
||||||
typedef struct MapTile
|
|
||||||
{
|
|
||||||
unsigned int x, y;
|
|
||||||
unsigned int owner_id;
|
|
||||||
TerrainType terrain_type;
|
|
||||||
|
|
||||||
gboolean is_defended : 1, is_radiated : 1;
|
|
||||||
} MapTile;
|
|
||||||
|
|
||||||
typedef struct Building
|
|
||||||
{
|
|
||||||
MapTile *parent_tile;
|
|
||||||
unsigned int level;
|
|
||||||
} Building;
|
|
||||||
|
|
||||||
typedef struct World
|
|
||||||
{
|
|
||||||
GArray *tiles;
|
|
||||||
GArray *buildings;
|
|
||||||
unsigned int width, height;
|
|
||||||
} World;
|
|
||||||
|
|
||||||
typedef struct GameState
|
typedef struct GameState
|
||||||
{
|
{
|
||||||
World world;
|
World *world;
|
||||||
|
GArray *players;
|
||||||
GList *players;
|
|
||||||
Player *me;
|
Player *me;
|
||||||
} GameState;
|
} GameState;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#include "world.h"
|
||||||
|
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <glib-2.0/glib.h>
|
||||||
|
|
||||||
|
typedef enum TerrainType
|
||||||
|
{
|
||||||
|
TERRAIN_WATER,
|
||||||
|
TERRAIN_FLAT,
|
||||||
|
TERRAIN_HILL,
|
||||||
|
TERRAIN_MOUNTAIN
|
||||||
|
} TerrainType;
|
||||||
|
|
||||||
|
typedef struct MapTile
|
||||||
|
{
|
||||||
|
unsigned int x, y;
|
||||||
|
unsigned int owner_id;
|
||||||
|
TerrainType terrain_type;
|
||||||
|
|
||||||
|
gboolean is_defended : 1, is_radiated : 1;
|
||||||
|
} MapTile;
|
||||||
|
|
||||||
|
typedef struct Building
|
||||||
|
{
|
||||||
|
MapTile *parent_tile;
|
||||||
|
unsigned int level;
|
||||||
|
|
||||||
|
unsigned int (*at_what_cost) (Building *self, World *world);
|
||||||
|
} Building;
|
||||||
|
|
||||||
|
typedef struct World
|
||||||
|
{
|
||||||
|
unsigned int width, height;
|
||||||
|
GArray *tiles;
|
||||||
|
GArray *buildings;
|
||||||
|
} World;
|
||||||
|
|
||||||
|
World *World_new (unsigned int width, unsigned int height);
|
||||||
|
void World_tick (World *self);
|
||||||
|
void World_render (World *self, GfxContext *gfx_context);
|
||||||
Reference in New Issue
Block a user