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. 21
      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"
#define OLC_PGEX_TRANSFORMEDVIEW
#include "olcPGEX_TransformedView.h"
#define OLC_PGEX_QUICKGUI
#include "olcPGEX_QuickGUI.h"
#include "FiestaOnlineEditor.h"
#include "ActionIDs.h"
#include "ItemEditor.h"

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

@ -48,6 +48,9 @@
<ClInclude Include="olcPGEX_TransformedView.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="olcPGEX_QuickGUI.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<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_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){
bool updateRequired=false;
if(pge->GetKey(UP).bHeld){
pos.y-=32*fElapsedTime;
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;
}
manager.Update(pge,GetPos());
if(updateRequired){
InternalRefresh(pge);
}
}
void ItemEditor::Refresh(FiestaOnlineEditor*pge){
pge->DrawRect(pos,{16,16},WHITE);
manager.Draw(pge,vi2d{0,headerHeight});
}
void ItemEditor::MouseFocus(FiestaOnlineEditor*pge){

@ -1,5 +1,6 @@
#pragma once
#include "olcPGEX_TransformedView.h"
#include "olcPGEX_QuickGUI.h"
class FiestaOnlineEditor;
@ -158,10 +159,12 @@ public:
class ItemEditor:public Window{
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,Item>itemList;
bool reloadImages;
QuickGUI::Manager manager;
QuickGUI::TextBox*searchBox;
public:
ItemEditor(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size,bool reloadImages=true);
~ItemEditor();

@ -123,3 +123,7 @@ void Window::SetFocusedWindow(FiestaOnlineEditor*pge,Window*w){
focusedWindow=w;
w->InternalRefresh(pge);
}
vf2d Window::GetPos(){
return pos+vi2d{0,headerHeight};
}

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

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