Add game framework and whitebox level

This commit is contained in:
2026-06-08 23:47:32 +08:00
parent 5525343656
commit e52cf94336
24 changed files with 778 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
#pragma once
#include "../movement/platform_world.h"
#include <frostbite2D/types/type_color.h>
#include <frostbite2D/types/type_math.h>
#include <vector>
namespace ns_game {
struct WhiteboxProp {
frostbite2D::Rect bounds;
frostbite2D::Color color;
};
struct LevelDefinition {
PlatformWorld collision;
std::vector<WhiteboxProp> props;
};
LevelDefinition CreateWhiteboxLevel();
} // namespace ns_game
+27
View File
@@ -0,0 +1,27 @@
#include "level_definition.h"
namespace ns_game {
LevelDefinition CreateWhiteboxLevel() {
LevelDefinition level;
level.collision.levelLeft = 0.0f;
level.collision.levelRight = 1600.0f;
level.collision.platforms = {
frostbite2D::Rect(0.0f, 600.0f, 1600.0f, 80.0f),
frostbite2D::Rect(230.0f, 500.0f, 220.0f, 28.0f),
frostbite2D::Rect(560.0f, 430.0f, 260.0f, 28.0f),
frostbite2D::Rect(930.0f, 510.0f, 260.0f, 28.0f),
frostbite2D::Rect(1250.0f, 420.0f, 230.0f, 28.0f),
};
level.props = {
{frostbite2D::Rect(118.0f, 392.0f, 88.0f, 208.0f),
frostbite2D::Color(0.26f, 0.30f, 0.34f, 1.0f)},
{frostbite2D::Rect(780.0f, 250.0f, 72.0f, 180.0f),
frostbite2D::Color(0.26f, 0.30f, 0.34f, 1.0f)},
{frostbite2D::Rect(1440.0f, 300.0f, 80.0f, 300.0f),
frostbite2D::Color(0.26f, 0.30f, 0.34f, 1.0f)},
};
return level;
}
} // namespace ns_game