Active windowing systems and menu navigation combined.
This commit is contained in:
parent
afd1d88d64
commit
dc292a3554
@ -116,14 +116,22 @@ bool FiestaOnlineEditor::OnUserUpdate(float fElapsedTime){
|
||||
ItemEditor*itemEditor=new ItemEditor(this,"Item Editor: "+config["DefaultPath"].GetString(),{32,32},GetScreenSize()-vi2d{64,64});
|
||||
CreateWindow(itemEditor);
|
||||
itemEditor->Load(config["DefaultPath"].GetString());
|
||||
itemEditor=new ItemEditor(this,"Item Editor: "+config["DefaultPath"].GetString(),{0,0},GetScreenSize()-vi2d{64,64});
|
||||
CreateWindow(itemEditor);
|
||||
itemEditor->Load(config["DefaultPath"].GetString());
|
||||
manager.Close();
|
||||
menuOpened=false;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(GetKey(ESCAPE).bPressed&&!menuOpened){
|
||||
menuOpened=true;
|
||||
manager.Open(&menu);
|
||||
}else
|
||||
if(GetKey(ESCAPE).bPressed&&menuOpened){
|
||||
menuOpened=false;
|
||||
manager.Close();
|
||||
}
|
||||
|
||||
|
||||
SetDrawTarget(1);
|
||||
Clear(olc::VERY_DARK_CYAN);
|
||||
@ -133,28 +141,39 @@ bool FiestaOnlineEditor::OnUserUpdate(float fElapsedTime){
|
||||
//BACKGROUND DRAWING
|
||||
|
||||
bool internalMouseFocus=false;
|
||||
|
||||
for(Window*w:windows){
|
||||
if(!w->IsFocusedWindow()){
|
||||
SetDrawTarget(1);
|
||||
} else {
|
||||
SetDrawTarget(nullptr);
|
||||
if(w->IsInBounds(GetMousePos())){
|
||||
w->InternalMouseFocus(this);
|
||||
w->MouseFocus(this);
|
||||
internalMouseFocus=true;
|
||||
if(!menuOpened){
|
||||
w->InternalUpdate(this,fElapsedTime);
|
||||
}
|
||||
w->Draw(this);
|
||||
}
|
||||
w->InternalUpdate(this,fElapsedTime);
|
||||
w->Draw(this);
|
||||
}
|
||||
|
||||
if(!internalMouseFocus){
|
||||
for(Window*w:windows){ //A second iteration through the windows because windows without focus should only have priority after a window with focus.
|
||||
if(!w->IsFocusedWindow()){
|
||||
for(Window*w:windows){
|
||||
if(w->IsFocusedWindow()){
|
||||
if(!menuOpened){
|
||||
if(w->IsInBounds(GetMousePos())){
|
||||
w->InternalMouseFocus(this);
|
||||
w->MouseFocus(this);
|
||||
internalMouseFocus=true;
|
||||
}
|
||||
}
|
||||
if(!menuOpened){
|
||||
w->InternalUpdate(this,fElapsedTime);
|
||||
}
|
||||
w->Draw(this);
|
||||
}
|
||||
}
|
||||
|
||||
if(!menuOpened){
|
||||
if(!internalMouseFocus){
|
||||
for(Window*w:windows){ //A second iteration through the windows because windows without focus should only have priority after a window with focus.
|
||||
if(!w->IsFocusedWindow()){
|
||||
if(w->IsInBounds(GetMousePos())){
|
||||
w->InternalMouseFocus(this);
|
||||
w->MouseFocus(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ class FiestaOnlineEditor : public olc::PixelGameEngine
|
||||
State appState=LOADFOLDER;
|
||||
utils::datafile config;
|
||||
std::vector<Window*>windows;
|
||||
bool menuOpened=false;
|
||||
|
||||
public:
|
||||
FiestaOnlineEditor();
|
||||
|
Loading…
x
Reference in New Issue
Block a user