Refactor OverworldEditor to use uint for loop counters in RefreshTile16Blockset method
This commit is contained in:
@@ -59,7 +59,8 @@ void HandleEntityDragging(zelda3::GameEntity *entity, ImVec2 canvas_p0,
|
|||||||
std::string entity_type = "Entity";
|
std::string entity_type = "Entity";
|
||||||
if (entity->entity_type_ == zelda3::GameEntity::EntityType::kExit) {
|
if (entity->entity_type_ == zelda3::GameEntity::EntityType::kExit) {
|
||||||
entity_type = "Exit";
|
entity_type = "Exit";
|
||||||
} else if (entity->entity_type_ == zelda3::GameEntity::EntityType::kEntrance) {
|
} else if (entity->entity_type_ ==
|
||||||
|
zelda3::GameEntity::EntityType::kEntrance) {
|
||||||
entity_type = "Entrance";
|
entity_type = "Entrance";
|
||||||
} else if (entity->entity_type_ == zelda3::GameEntity::EntityType::kSprite) {
|
} else if (entity->entity_type_ == zelda3::GameEntity::EntityType::kSprite) {
|
||||||
entity_type = "Sprite";
|
entity_type = "Sprite";
|
||||||
@@ -310,11 +311,11 @@ bool DrawExitEditorPopup(zelda3::overworld::OverworldExit &exit) {
|
|||||||
void DrawItemInsertPopup() {
|
void DrawItemInsertPopup() {
|
||||||
// Contents of the Context Menu
|
// Contents of the Context Menu
|
||||||
if (ImGui::BeginPopup("Item Inserter")) {
|
if (ImGui::BeginPopup("Item Inserter")) {
|
||||||
static int new_item_id = 0;
|
static size_t new_item_id = 0;
|
||||||
Text("Add Item");
|
Text("Add Item");
|
||||||
BeginChild("ScrollRegion", ImVec2(150, 150), true,
|
BeginChild("ScrollRegion", ImVec2(150, 150), true,
|
||||||
ImGuiWindowFlags_AlwaysVerticalScrollbar);
|
ImGuiWindowFlags_AlwaysVerticalScrollbar);
|
||||||
for (int i = 0; i < zelda3::overworld::kSecretItemNames.size(); i++) {
|
for (size_t i = 0; i < zelda3::overworld::kSecretItemNames.size(); i++) {
|
||||||
if (Selectable(zelda3::overworld::kSecretItemNames[i].c_str(),
|
if (Selectable(zelda3::overworld::kSecretItemNames[i].c_str(),
|
||||||
i == new_item_id)) {
|
i == new_item_id)) {
|
||||||
new_item_id = i;
|
new_item_id = i;
|
||||||
@@ -348,7 +349,7 @@ bool DrawItemEditorPopup(zelda3::overworld::OverworldItem &item) {
|
|||||||
BeginChild("ScrollRegion", ImVec2(150, 150), true,
|
BeginChild("ScrollRegion", ImVec2(150, 150), true,
|
||||||
ImGuiWindowFlags_AlwaysVerticalScrollbar);
|
ImGuiWindowFlags_AlwaysVerticalScrollbar);
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
for (int i = 0; i < zelda3::overworld::kSecretItemNames.size(); i++) {
|
for (size_t i = 0; i < zelda3::overworld::kSecretItemNames.size(); i++) {
|
||||||
if (Selectable(zelda3::overworld::kSecretItemNames[i].c_str(),
|
if (Selectable(zelda3::overworld::kSecretItemNames[i].c_str(),
|
||||||
item.id_ == i)) {
|
item.id_ == i)) {
|
||||||
item.id_ = i;
|
item.id_ = i;
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ absl::Status OverworldEditor::RefreshTile16Blockset() {
|
|||||||
|
|
||||||
std::vector<std::future<void>> futures;
|
std::vector<std::future<void>> futures;
|
||||||
// Loop through the tiles and copy their pixel data into separate vectors
|
// Loop through the tiles and copy their pixel data into separate vectors
|
||||||
for (int i = 0; i < kNumTile16Individual; i++) {
|
for (uint i = 0; i < kNumTile16Individual; i++) {
|
||||||
futures.push_back(std::async(
|
futures.push_back(std::async(
|
||||||
std::launch::async,
|
std::launch::async,
|
||||||
[&](int index) {
|
[&](int index) {
|
||||||
@@ -141,7 +141,7 @@ absl::Status OverworldEditor::RefreshTile16Blockset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Render the bitmaps of each tile.
|
// Render the bitmaps of each tile.
|
||||||
for (int id = 0; id < kNumTile16Individual; id++) {
|
for (uint id = 0; id < kNumTile16Individual; id++) {
|
||||||
RETURN_IF_ERROR(tile16_individual_[id].ApplyPalette(palette_));
|
RETURN_IF_ERROR(tile16_individual_[id].ApplyPalette(palette_));
|
||||||
Renderer::GetInstance().UpdateBitmap(&tile16_individual_[id]);
|
Renderer::GetInstance().UpdateBitmap(&tile16_individual_[id]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
TEST(YazeCLibTest, InitializeAndCleanup) {
|
TEST(YazeTest, InitializeAndCleanup) {
|
||||||
yaze_flags flags;
|
yaze_flags flags;
|
||||||
yaze_init(&flags);
|
yaze_init(&flags);
|
||||||
yaze_cleanup(&flags);
|
yaze_cleanup(&flags);
|
||||||
|
|||||||
Reference in New Issue
Block a user