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::Selectable;
|
||||||
using ImGui::Text;
|
using ImGui::Text;
|
||||||
|
|
||||||
|
constexpr float kInputFieldSize = 30.f;
|
||||||
|
|
||||||
bool IsMouseHoveringOverEntity(const zelda3::GameEntity &entity,
|
bool IsMouseHoveringOverEntity(const zelda3::GameEntity &entity,
|
||||||
ImVec2 canvas_p0, ImVec2 scrolling) {
|
ImVec2 canvas_p0, ImVec2 scrolling) {
|
||||||
// Get the mouse position relative to the canvas
|
// Get the mouse position relative to the canvas
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "imgui/imgui.h"
|
#include "imgui/imgui.h"
|
||||||
|
|
||||||
#include "app/editor/overworld/overworld_editor.h"
|
|
||||||
#include "app/zelda3/common.h"
|
#include "app/zelda3/common.h"
|
||||||
#include "app/zelda3/overworld/overworld.h"
|
#include "app/zelda3/overworld/overworld.h"
|
||||||
|
|
||||||
|
|||||||
@@ -997,6 +997,11 @@ void OverworldEditor::DrawOverworldSprites() {
|
|||||||
current_sprite_ = sprite;
|
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,
|
ow_map_canvas_.DrawText(absl::StrFormat("%s", sprite.name()), map_x,
|
||||||
map_y);
|
map_y);
|
||||||
}
|
}
|
||||||
@@ -1108,8 +1113,11 @@ absl::Status OverworldEditor::LoadSpriteGraphics() {
|
|||||||
for (auto const &sprite : overworld_.sprites(i)) {
|
for (auto const &sprite : overworld_.sprites(i)) {
|
||||||
int width = sprite.width();
|
int width = sprite.width();
|
||||||
int height = sprite.height();
|
int height = sprite.height();
|
||||||
int depth = 0x40;
|
int depth = 0x10;
|
||||||
auto spr_gfx = sprite.PreviewGraphics();
|
auto spr_gfx = sprite.PreviewGraphics();
|
||||||
|
if (spr_gfx.empty() || width == 0 || height == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
sprite_previews_[sprite.id()].Create(width, height, depth, spr_gfx);
|
sprite_previews_[sprite.id()].Create(width, height, depth, spr_gfx);
|
||||||
RETURN_IF_ERROR(sprite_previews_[sprite.id()].ApplyPalette(palette_));
|
RETURN_IF_ERROR(sprite_previews_[sprite.id()].ApplyPalette(palette_));
|
||||||
Renderer::GetInstance().RenderBitmap(&(sprite_previews_[sprite.id()]));
|
Renderer::GetInstance().RenderBitmap(&(sprite_previews_[sprite.id()]));
|
||||||
|
|||||||
Reference in New Issue
Block a user