made the join game screen to get ready for attaching to host and also made a protocol doc
This commit is contained in:
67
overworld.c
67
overworld.c
@@ -10,37 +10,37 @@
|
||||
#include <overworld.h>
|
||||
#include <err_check.h>
|
||||
|
||||
#define OW_ROWS ((DEF_WINDOW_WIDTH / OW_GRIDSZ) + 1)
|
||||
#define OW_COLS ((DEF_WINDOW_HEIGHT / OW_GRIDSZ) + 1)
|
||||
|
||||
|
||||
PLAYER *myplayer, me;
|
||||
SDL_Texture *selected_grid, *player_sprite, *grass;
|
||||
|
||||
|
||||
PLAYER *get_this_player()
|
||||
{
|
||||
return &me;
|
||||
}
|
||||
|
||||
#define ow_rows ((DEF_WINDOW_WIDTH / OW_GRIDSZ) + 1)
|
||||
#define ow_cols ((DEF_WINDOW_HEIGHT / OW_GRIDSZ) + 1)
|
||||
SDL_Rect ow_rects[OW_ROWS][OW_COLS];
|
||||
|
||||
SDL_Rect ow_rects[ow_rows][ow_cols];
|
||||
|
||||
|
||||
void start_overworld()
|
||||
void init_overworld()
|
||||
{
|
||||
SDL_Texture *selected_grid, *player_sprite, *grass;
|
||||
int row, col;
|
||||
|
||||
PRINT_M(INIT OVERWORLD)
|
||||
|
||||
PRINT_M(STARTING GAME)
|
||||
|
||||
IMG_GETANDCHECK(grass, renderer, "assets/ow_grid_grass.png")
|
||||
IMG_GETANDCHECK(selected_grid, renderer, "assets/ow_selected_grid.png");
|
||||
IMG_GETANDCHECK(player_sprite, renderer, "assets/player.png");
|
||||
|
||||
myplayer = get_this_player();
|
||||
|
||||
int row, col;
|
||||
|
||||
//set up rects to render textures into
|
||||
for(row = 0; row <= ow_rows; row++)
|
||||
for(row = 0; row <= OW_ROWS; row++)
|
||||
{
|
||||
for(col = 0; col <= ow_cols; col++)
|
||||
for(col = 0; col <= OW_COLS; col++)
|
||||
{
|
||||
ow_rects[row][col].x = row * OW_GRIDSZ;
|
||||
ow_rects[row][col].y = col * OW_GRIDSZ;
|
||||
@@ -50,40 +50,31 @@ void start_overworld()
|
||||
}
|
||||
|
||||
myplayer->texture = player_sprite;
|
||||
myplayer->pos.x = ow_rows >> 1;
|
||||
myplayer->pos.y = ow_cols >> 1;
|
||||
|
||||
myplayer->pos.x = OW_ROWS >> 1;
|
||||
myplayer->pos.y = OW_COLS >> 1;
|
||||
|
||||
while(running)
|
||||
return;
|
||||
}
|
||||
|
||||
void render_overworld()
|
||||
{
|
||||
int row, col;
|
||||
SDL_RenderClear(renderer);
|
||||
//render the ow grid
|
||||
for(row = 0; row < OW_ROWS; row++)
|
||||
{
|
||||
handle_event(&event);
|
||||
|
||||
SDL_RenderClear(renderer);
|
||||
//render the ow grid
|
||||
for(row = 0; row < ow_rows; row++)
|
||||
for(col = 0; col < OW_COLS; col++)
|
||||
{
|
||||
for(col = 0; col < ow_cols; col++)
|
||||
{
|
||||
SDL_RenderCopy(renderer, grass, NULL, &(ow_rects[row][col]));
|
||||
}
|
||||
SDL_RenderCopy(renderer, grass, NULL, &(ow_rects[row][col]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
SDL_RenderCopy(renderer, myplayer->texture, NULL, &(ow_rects[myplayer->pos.x][myplayer->pos.y]));
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
}
|
||||
|
||||
|
||||
SDL_RenderCopy(renderer, myplayer->texture, NULL, &(ow_rects[myplayer->pos.x][myplayer->pos.y]));
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
|
||||
start_battle();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user