fp: Introduce building zones
This commit is contained in:
+37
-2
@@ -348,9 +348,9 @@ void TELY_DLL_Init(void *user_data)
|
||||
}
|
||||
|
||||
// NOTE: Map walls =============================================================================
|
||||
FP_GameEntity const *map = game->map;
|
||||
Dqn_Rect const map_hit_box = FP_Game_CalcEntityWorldHitBox(game, map->handle);
|
||||
{
|
||||
FP_GameEntity const *map = game->map;
|
||||
Dqn_Rect map_hit_box = FP_Game_CalcEntityWorldHitBox(game, map->handle);
|
||||
Dqn_f32 wall_thickness = FP_Game_MetersToPixelsNx1(game, 1.f);
|
||||
Dqn_f32 half_wall_thickness = wall_thickness * .5f;
|
||||
|
||||
@@ -375,6 +375,37 @@ void TELY_DLL_Init(void *user_data)
|
||||
Dqn_V2_InitNx2(map_hit_box.size.w, wall_thickness));
|
||||
}
|
||||
|
||||
// NOTE: Map building zones
|
||||
{
|
||||
{
|
||||
FP_Entity_CreatePermittedBuildZone(game,
|
||||
Dqn_V2_InitNx2(0.f, -1206),
|
||||
Dqn_V2_InitNx2(map_hit_box.size.w, 335),
|
||||
"Building Zone");
|
||||
}
|
||||
|
||||
{
|
||||
FP_Entity_CreatePermittedBuildZone(game,
|
||||
Dqn_V2_InitNx2(-839.9, -460),
|
||||
Dqn_V2_InitNx2(2991.3, 670),
|
||||
"Building Zone");
|
||||
}
|
||||
|
||||
{
|
||||
FP_Entity_CreatePermittedBuildZone(game,
|
||||
Dqn_V2_InitNx2(-839.9, 460),
|
||||
Dqn_V2_InitNx2(2991.3, 670),
|
||||
"Building Zone");
|
||||
}
|
||||
|
||||
{
|
||||
FP_Entity_CreatePermittedBuildZone(game,
|
||||
Dqn_V2_InitNx2(0.f, 1200),
|
||||
Dqn_V2_InitNx2(map_hit_box.size.w, 335),
|
||||
"Building Zone");
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: Hero ==================================================================================
|
||||
{
|
||||
FP_GameEntityHandle terry = FP_Entity_CreateTerry(game, Dqn_V2_InitNx2(1434, 11), "Terry");
|
||||
@@ -436,6 +467,7 @@ void TELY_DLL_Init(void *user_data)
|
||||
|
||||
FP_Entity_CreateHeart(game, base_mid_p, "Heart");
|
||||
|
||||
|
||||
uint16_t font_size = 18;
|
||||
game->camera.scale = Dqn_V2_InitNx1(1);
|
||||
game->inter_regular_font = platform->func_load_font(assets, DQN_STRING8("Inter (Regular)"), DQN_STRING8("Data/Inter-Regular.otf"), font_size);
|
||||
@@ -1553,6 +1585,8 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer)
|
||||
TELY_Render_LineColourV4(renderer, start, end, TELY_Colour_V4Alpha(TELY_COLOUR_WHITE_V4, .25f), 1.f);
|
||||
}
|
||||
|
||||
TELY_Render_PushColourV4(renderer, TELY_COLOUR_BLACK_V4);
|
||||
|
||||
// NOTE: Draw entities =========================================================================
|
||||
for (FP_GameEntityIterator it = {}; FP_Game_DFSPostOrderWalkEntityTree(game, &it, game->root_entity); ) {
|
||||
FP_GameEntity *entity = it.entity;
|
||||
@@ -1768,6 +1802,7 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer)
|
||||
TELY_Render_TextF(renderer, draw_p, Dqn_V2_InitNx2(0.f, 1), "World Pos: (%.1f, %.1f)", world_pos.x, world_pos.y); draw_p.y += line_height;
|
||||
TELY_Render_TextF(renderer, draw_p, Dqn_V2_InitNx2(0.f, 1), "Hit Box Size: %.1fx%.1f", world_hit_box.size.x, world_hit_box.size.y); draw_p.y += line_height;
|
||||
TELY_Render_TextF(renderer, draw_p, Dqn_V2_InitNx2(0.f, 1), "Tile: %I32dx%I32d", player_tile.x, player_tile.y); draw_p.y += line_height;
|
||||
TELY_Render_TextF(renderer, draw_p, Dqn_V2_InitNx2(0.f, 1), "World Mouse Pos: (%.1f, %.1f)", world_mouse_p.x, world_mouse_p.y); draw_p.y += line_height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user