-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpriteWnd.cpp
More file actions
76 lines (60 loc) · 1.88 KB
/
SpriteWnd.cpp
File metadata and controls
76 lines (60 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
Copyright (c) 2024-2025 Toksisitee. All rights reserved.
This work is licensed under the terms of the MIT license.
For a copy, refer to license.md or https://opensource.org/licenses/MIT
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*/
#include "imgui.h"
#include "FileDialogNative.h"
#include "AssetsErrHandler.h"
#include "ImEditor.h"
#include "Utils.h"
#include "SpriteWnd.h"
void CSpriteWnd::RenderBegin()
{
ImGui::Begin( m_sWindowName.c_str(), &m_bOpen );
}
void CSpriteWnd::RenderEnd()
{
ImGui::End();
}
void CSpriteWnd::Render()
{
static bool inputs_step = true;
#if 0
if ( m_Sprite.m_Bank.Header.Count == 0 ) {
auto sFilePath = Util::FileSystem::FormatPath( "HSPR0-0.dat" );
m_Sprite.SetPalette( &g_Palette );
g_ErrHandler.HandleResult( g_Sprite.LoadBin( sFilePath ) );
g_Sprite.CreateTextures( g_Editor.m_pd3dDevice );
}
else {
ImEditor::SetPointFiltering( g_Editor.m_pd3dDevice );
static uint16_t uSprIndex = 5000;
ImEditor::InputScalar( "##SpriteEditor", &uSprIndex );
//ImGui::InputScalar( "##SpriteIndex", ImGuiDataType_U16, &uSprIndex, inputs_step ? &u16_one : NULL, NULL, "%u" );
auto pTex = g_Sprite.GetTexture( uSprIndex );
ImVec2 texSize = ImVec2( static_cast<float>(pTex->GetWidth()), static_cast<float>(pTex->GetHeight()) );
texSize.x = 256;
texSize.y = 256;
static bool uv = false;
ImGui::Checkbox( "UV", &uv );
if ( uv ) {
float fTexelU = 0.5f / texSize.x;
float fTexelV = 0.5f / texSize.y;
auto uv0 = ImVec2( fTexelU, fTexelV );
auto uv1 = ImVec2( 1.0f - fTexelU, 1.0f - fTexelV );
ImEditor::RenderTexture( pTex, texSize, uv0, uv1 );
}
else {
ImEditor::RenderTexture( pTex, texSize );
}
ImEditor::ResetRenderState();
}
#endif
}
void CSpriteWnd::OnPaletteChange()
{
}