117 Room test_room = CreateTestRoom(0x00);
121 std::vector<gfx::PaletteGroup> palette_groups;
124 for (
int i = 0; i < 3; ++i) {
125 palette_groups.push_back(CreateTestPaletteGroup());
128 for (
const auto& palette_group : palette_groups) {
134 EXPECT_TRUE(status.ok() || status.code() == absl::StatusCode::kOk);
140 Room test_room = CreateTestRoom(0x00);
142 auto palette_group = CreateTestPaletteGroup();
145 std::vector<RoomObject> bg1_objects;
146 std::vector<RoomObject> bg2_objects;
149 if (obj.GetLayerValue() == 0) {
150 bg1_objects.push_back(obj);
151 }
else if (obj.GetLayerValue() == 1) {
152 bg2_objects.push_back(obj);
157 if (!bg1_objects.empty()) {
162 EXPECT_TRUE(status.ok() || status.code() == absl::StatusCode::kOk);
166 if (!bg2_objects.empty()) {
171 EXPECT_TRUE(status.ok() || status.code() == absl::StatusCode::kOk);
177 Room test_room = CreateTestRoom(0x00);
179 auto palette_group = CreateTestPaletteGroup();
182 std::map<int, std::vector<RoomObject>> objects_by_size;
185 objects_by_size[obj.size_].push_back(obj);
189 for (
const auto& [size, objects] : objects_by_size) {
194 EXPECT_TRUE(status.ok() || status.code() == absl::StatusCode::kOk);
201 Room large_room(0x00, rom_.get());
204 for (
int i = 0; i < 200; ++i) {
206 int x = (i * 2) % 60;
207 int y = (i * 3) % 60;
208 int size = (i % 8) + 1;
217 auto palette_group = CreateTestPaletteGroup();
220 auto start_time = std::chrono::high_resolution_clock::now();
227 auto end_time = std::chrono::high_resolution_clock::now();
228 auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(
229 end_time - start_time);
231 EXPECT_TRUE(status.ok() || status.code() == absl::StatusCode::kOk);
234 EXPECT_LT(duration.count(), 2000);
236 std::cout <<
"Rendered room with 200 objects in " << duration.count() <<
"ms" << std::endl;
241 Room test_room = CreateTestRoom(0x00);
243 auto palette_group = CreateTestPaletteGroup();
246 std::vector<RoomObject> edge_objects;
248 edge_objects.emplace_back(0x34, 0, 0, 1, 0);
249 edge_objects.emplace_back(0x34, 63, 63, 1, 0);
250 edge_objects.emplace_back(0x34, 32, 32, 1, 0);
251 edge_objects.emplace_back(0x34, 1, 1, 1, 0);
252 edge_objects.emplace_back(0x34, 62, 62, 1, 0);
255 for (
auto& obj : edge_objects) {
256 obj.set_rom(rom_.get());
264 EXPECT_TRUE(status.ok() || status.code() == absl::StatusCode::kOk);
269 Room test_room = CreateTestRoom(0x00);
271 auto palette_group = CreateTestPaletteGroup();
274 std::vector<RoomObject> mixed_objects;
277 mixed_objects.emplace_back(0x00, 5, 5, 3, 0);
278 mixed_objects.emplace_back(0x01, 10, 10, 2, 0);
281 mixed_objects.emplace_back(0x02, 15, 15, 4, 0);
282 mixed_objects.emplace_back(0x03, 20, 20, 1, 1);
285 mixed_objects.emplace_back(0x09, 25, 25, 5, 0);
286 mixed_objects.emplace_back(0x0A, 30, 30, 3, 0);
289 mixed_objects.emplace_back(0x34, 35, 35, 1, 0);
290 mixed_objects.emplace_back(0x33, 40, 40, 2, 1);
293 mixed_objects.emplace_back(0x36, 45, 45, 3, 0);
294 mixed_objects.emplace_back(0x38, 50, 50, 1, 0);
297 for (
auto& obj : mixed_objects) {
298 obj.set_rom(rom_.get());
306 EXPECT_TRUE(status.ok() || status.code() == absl::StatusCode::kOk);
328 Room test_room = CreateTestRoom(0x00);
330 auto palette_group = CreateTestPaletteGroup();
333 std::vector<RoomObject> invalid_objects;
335 invalid_objects.emplace_back(0x999, 5, 5, 1, 0);
336 invalid_objects.emplace_back(0x00, -1, -1, 1, 0);
337 invalid_objects.emplace_back(0x00, 100, 100, 1, 0);
338 invalid_objects.emplace_back(0x00, 5, 5, 255, 0);
341 for (
auto& obj : invalid_objects) {
342 obj.set_rom(rom_.get());
352 EXPECT_TRUE(status.ok() || status.code() == absl::StatusCode::kOk);
absl::Status DrawObjectList(const std::vector< RoomObject > &objects, gfx::BackgroundBuffer &bg1, gfx::BackgroundBuffer &bg2, const gfx::PaletteGroup &palette_group)
Draw all objects in a room.