Update QuickGUI to handle drawing and updating offsets. Textbox now follows cursor within dimension contraints.

master
sigonasr2 1 year ago
parent 36756885e3
commit 94e85f1a9a
  1. 2
      FiestaOnlineEditor/FiestaOnlineEditor.cpp
  2. 1
      FiestaOnlineEditor/FiestaOnlineEditor.vcxproj
  3. 3
      FiestaOnlineEditor/FiestaOnlineEditor.vcxproj.filters
  4. 23
      FiestaOnlineEditor/ItemEditor.cpp
  5. 5
      FiestaOnlineEditor/ItemEditor.h
  6. 4
      FiestaOnlineEditor/Window.cpp
  7. 3
      FiestaOnlineEditor/Window.h
  8. 1332
      FiestaOnlineEditor/olcPGEX_QuickGUI.h

@ -6,6 +6,8 @@
#include "SHNFileDecryptor.h" #include "SHNFileDecryptor.h"
#define OLC_PGEX_TRANSFORMEDVIEW #define OLC_PGEX_TRANSFORMEDVIEW
#include "olcPGEX_TransformedView.h" #include "olcPGEX_TransformedView.h"
#define OLC_PGEX_QUICKGUI
#include "olcPGEX_QuickGUI.h"
#include "FiestaOnlineEditor.h" #include "FiestaOnlineEditor.h"
#include "ActionIDs.h" #include "ActionIDs.h"
#include "ItemEditor.h" #include "ItemEditor.h"

@ -135,6 +135,7 @@
<ClInclude Include="FiestaOnlineEditor.h" /> <ClInclude Include="FiestaOnlineEditor.h" />
<ClInclude Include="ItemEditor.h" /> <ClInclude Include="ItemEditor.h" />
<ClInclude Include="olcPGEX_PopupMenu.h" /> <ClInclude Include="olcPGEX_PopupMenu.h" />
<ClInclude Include="olcPGEX_QuickGUI.h" />
<ClInclude Include="olcPGEX_TransformedView.h" /> <ClInclude Include="olcPGEX_TransformedView.h" />
<ClInclude Include="olcPixelGameEngine.h" /> <ClInclude Include="olcPixelGameEngine.h" />
<ClInclude Include="olcUTIL_DataFile.h" /> <ClInclude Include="olcUTIL_DataFile.h" />

@ -48,6 +48,9 @@
<ClInclude Include="olcPGEX_TransformedView.h"> <ClInclude Include="olcPGEX_TransformedView.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="olcPGEX_QuickGUI.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="FiestaOnlineEditor.cpp"> <ClCompile Include="FiestaOnlineEditor.cpp">

@ -120,33 +120,22 @@ void ItemEditor::Load(std::string basePath,std::string clientPath,std::string im
it.stat_dmg=GradeItemOption.Get<uint16_t>(i,14); it.stat_dmg=GradeItemOption.Get<uint16_t>(i,14);
it.stat_magDmg=GradeItemOption.Get<uint16_t>(i,15); it.stat_magDmg=GradeItemOption.Get<uint16_t>(i,15);
} }
//QuickGUI is magic and handles freeing memory for us! Don't need to!
searchBox=new QuickGUI::TextBox(manager,"",vf2d{8,16},vf2d{128,26},vf2d{1,2});
} }
void ItemEditor::Update(FiestaOnlineEditor*pge,float fElapsedTime){ void ItemEditor::Update(FiestaOnlineEditor*pge,float fElapsedTime){
bool updateRequired=false; bool updateRequired=false;
if(pge->GetKey(UP).bHeld){ updateRequired=true;
pos.y-=32*fElapsedTime; manager.Update(pge,GetPos());
updateRequired=true;
}
if(pge->GetKey(DOWN).bHeld){
pos.y+=32*fElapsedTime;
updateRequired=true;
}
if(pge->GetKey(RIGHT).bHeld){
pos.x+=32*fElapsedTime;
updateRequired=true;
}
if(pge->GetKey(LEFT).bHeld){
pos.x-=32*fElapsedTime;
updateRequired=true;
}
if(updateRequired){ if(updateRequired){
InternalRefresh(pge); InternalRefresh(pge);
} }
} }
void ItemEditor::Refresh(FiestaOnlineEditor*pge){ void ItemEditor::Refresh(FiestaOnlineEditor*pge){
pge->DrawRect(pos,{16,16},WHITE); manager.Draw(pge,vi2d{0,headerHeight});
} }
void ItemEditor::MouseFocus(FiestaOnlineEditor*pge){ void ItemEditor::MouseFocus(FiestaOnlineEditor*pge){

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "olcPGEX_TransformedView.h" #include "olcPGEX_TransformedView.h"
#include "olcPGEX_QuickGUI.h"
class FiestaOnlineEditor; class FiestaOnlineEditor;
@ -158,10 +159,12 @@ public:
class ItemEditor:public Window{ class ItemEditor:public Window{
SHNFile ItemInfo,ItemInfoServer,ItemViewInfo,GradeItemOption; SHNFile ItemInfo,ItemInfoServer,ItemViewInfo,GradeItemOption;
vf2d pos={64,64}; //vf2d pos={64,64};
std::map<std::string,std::unique_ptr<Renderable>>imgLookup; std::map<std::string,std::unique_ptr<Renderable>>imgLookup;
std::map<std::string,Item>itemList; std::map<std::string,Item>itemList;
bool reloadImages; bool reloadImages;
QuickGUI::Manager manager;
QuickGUI::TextBox*searchBox;
public: public:
ItemEditor(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size,bool reloadImages=true); ItemEditor(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size,bool reloadImages=true);
~ItemEditor(); ~ItemEditor();

@ -122,4 +122,8 @@ bool Window::IsClosed(){
void Window::SetFocusedWindow(FiestaOnlineEditor*pge,Window*w){ void Window::SetFocusedWindow(FiestaOnlineEditor*pge,Window*w){
focusedWindow=w; focusedWindow=w;
w->InternalRefresh(pge); w->InternalRefresh(pge);
}
vf2d Window::GetPos(){
return pos+vi2d{0,headerHeight};
} }

@ -7,16 +7,17 @@ class Window{
private: private:
vi2d pos; vi2d pos;
Decal*decWindow; Decal*decWindow;
const int headerHeight=12;
bool dragging=false; bool dragging=false;
vf2d dragPoint; vf2d dragPoint;
bool canClose=false; bool canClose=false;
bool closed=false; bool closed=false;
protected: protected:
const int headerHeight=12;
vi2d size; vi2d size;
Sprite*sprWindow; Sprite*sprWindow;
static Window*focusedWindow; static Window*focusedWindow;
std::string windowTitle=""; std::string windowTitle="";
vf2d GetPos(); //Note this isn't the actual window's position, it's the drawable window position.
public: public:
Window(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size); Window(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size);
virtual ~Window(); virtual ~Window();

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save