Add input field size constant and improve sprite preview handling; adjust depth and add checks for empty graphics
This commit is contained in:
@@ -15,6 +15,8 @@ using ImGui::SameLine;
|
||||
using ImGui::Selectable;
|
||||
using ImGui::Text;
|
||||
|
||||
constexpr float kInputFieldSize = 30.f;
|
||||
|
||||
bool IsMouseHoveringOverEntity(const zelda3::GameEntity &entity,
|
||||
ImVec2 canvas_p0, ImVec2 scrolling) {
|
||||
// Get the mouse position relative to the canvas
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "imgui/imgui.h"
|
||||
|
||||
#include "app/editor/overworld/overworld_editor.h"
|
||||
#include "app/zelda3/common.h"
|
||||
#include "app/zelda3/overworld/overworld.h"
|
||||
|
||||
@@ -85,4 +84,4 @@ bool DrawSpriteEditorPopup(zelda3::Sprite &sprite);
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APP_EDITOR_OVERWORLD_ENTITY_H
|
||||
#endif // YAZE_APP_EDITOR_OVERWORLD_ENTITY_H
|
||||
|
||||
@@ -997,6 +997,11 @@ void OverworldEditor::DrawOverworldSprites() {
|
||||
current_sprite_ = sprite;
|
||||
}
|
||||
}
|
||||
if (sprite_previews_[sprite.id()].is_active()) {
|
||||
ow_map_canvas_.DrawBitmap(sprite_previews_[sprite.id()], map_x, map_y,
|
||||
2.0f);
|
||||
}
|
||||
|
||||
ow_map_canvas_.DrawText(absl::StrFormat("%s", sprite.name()), map_x,
|
||||
map_y);
|
||||
}
|
||||
@@ -1108,8 +1113,11 @@ absl::Status OverworldEditor::LoadSpriteGraphics() {
|
||||
for (auto const &sprite : overworld_.sprites(i)) {
|
||||
int width = sprite.width();
|
||||
int height = sprite.height();
|
||||
int depth = 0x40;
|
||||
int depth = 0x10;
|
||||
auto spr_gfx = sprite.PreviewGraphics();
|
||||
if (spr_gfx.empty() || width == 0 || height == 0) {
|
||||
continue;
|
||||
}
|
||||
sprite_previews_[sprite.id()].Create(width, height, depth, spr_gfx);
|
||||
RETURN_IF_ERROR(sprite_previews_[sprite.id()].ApplyPalette(palette_));
|
||||
Renderer::GetInstance().RenderBitmap(&(sprite_previews_[sprite.id()]));
|
||||
|
||||
Reference in New Issue
Block a user