hide gui with thumbnail generation
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -58,3 +58,5 @@ desktop.ini
|
|||||||
#Redist
|
#Redist
|
||||||
!Installer/Redist/*
|
!Installer/Redist/*
|
||||||
UpgradeLog.htm
|
UpgradeLog.htm
|
||||||
|
click_output.JPEG
|
||||||
|
click_output.PNG
|
||||||
|
|||||||
@@ -15,10 +15,15 @@ ThumbnailGeneratorInstance::~ThumbnailGeneratorInstance(void) {}
|
|||||||
|
|
||||||
std::string ThumbnailGeneratorInstance::click(std::string fileType, int cx, int cy, bool hideSky)
|
std::string ThumbnailGeneratorInstance::click(std::string fileType, int cx, int cy, bool hideSky)
|
||||||
{
|
{
|
||||||
const G3D::GImage::Format format = G3D::GImage::stringToFormat(fileType);
|
// Important things we need
|
||||||
|
|
||||||
RenderDevice* rd = g_usableApp->getRenderDevice();
|
RenderDevice* rd = g_usableApp->getRenderDevice();
|
||||||
|
GuiRootInstance* guiRoot = g_dataModel->getGuiRoot();
|
||||||
|
|
||||||
|
const G3D::GImage::Format format = G3D::GImage::stringToFormat(fileType);
|
||||||
|
|
||||||
|
// Hide the GUI
|
||||||
|
guiRoot->hideGui(true);
|
||||||
|
|
||||||
// Disable the sky
|
// Disable the sky
|
||||||
if(hideSky)
|
if(hideSky)
|
||||||
g_usableApp->toggleSky();
|
g_usableApp->toggleSky();
|
||||||
@@ -38,6 +43,9 @@ std::string ThumbnailGeneratorInstance::click(std::string fileType, int cx, int
|
|||||||
std::ofstream out(fileSave.c_str(), std::ios::out | std::ios::binary);
|
std::ofstream out(fileSave.c_str(), std::ios::out | std::ios::binary);
|
||||||
out.write(reinterpret_cast<const char*>(binOut.getCArray()), binOut.length());
|
out.write(reinterpret_cast<const char*>(binOut.getCArray()), binOut.length());
|
||||||
|
|
||||||
|
// Unhide GUI
|
||||||
|
guiRoot->hideGui(false);
|
||||||
|
|
||||||
return "boop!";
|
return "boop!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ public:
|
|||||||
void update();
|
void update();
|
||||||
bool mouseInGUI(G3D::RenderDevice* renderDevice,int x,int y);
|
bool mouseInGUI(G3D::RenderDevice* renderDevice,int x,int y);
|
||||||
void onMouseLeftUp(G3D::RenderDevice* renderDevice, int x,int y);
|
void onMouseLeftUp(G3D::RenderDevice* renderDevice, int x,int y);
|
||||||
|
void hideGui(bool doHide);
|
||||||
private:
|
private:
|
||||||
std::string _message;
|
std::string _message;
|
||||||
G3D::RealTime _messageTime;
|
G3D::RealTime _messageTime;
|
||||||
|
bool _hideGui;
|
||||||
};
|
};
|
||||||
@@ -43,6 +43,7 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
|
|||||||
{
|
{
|
||||||
g_fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));
|
g_fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));
|
||||||
g_fntlighttrek = GFont::fromFile(GetFileInPath("/content/font/lighttrek.fnt"));
|
g_fntlighttrek = GFont::fromFile(GetFileInPath("/content/font/lighttrek.fnt"));
|
||||||
|
_hideGui = false;
|
||||||
|
|
||||||
//Bottom Left
|
//Bottom Left
|
||||||
TextButtonInstance* button = makeTextButton();
|
TextButtonInstance* button = makeTextButton();
|
||||||
@@ -434,6 +435,7 @@ void GuiRootInstance::setDebugMessage(std::string msg, G3D::RealTime msgTime)
|
|||||||
|
|
||||||
void GuiRootInstance::renderGUI(G3D::RenderDevice* rd, double fps)
|
void GuiRootInstance::renderGUI(G3D::RenderDevice* rd, double fps)
|
||||||
{
|
{
|
||||||
|
if(_hideGui) return;
|
||||||
//TODO--Move these to their own instance
|
//TODO--Move these to their own instance
|
||||||
|
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
@@ -539,3 +541,7 @@ void GuiRootInstance::onMouseLeftUp(G3D::RenderDevice* renderDevice, int x,int y
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GuiRootInstance::hideGui(bool doHide) {
|
||||||
|
_hideGui = doHide;
|
||||||
|
}
|
||||||
@@ -15,8 +15,12 @@ void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
AppendMenu(mainmenu, MF_STRING, 100, "New");
|
AppendMenu(mainmenu, MF_STRING, 100, "New");
|
||||||
AppendMenu(mainmenu, MF_STRING, 101, "Open...");
|
AppendMenu(mainmenu, MF_STRING, 101, "Open...");
|
||||||
AppendMenu(mainmenu, MF_STRING, 102, "Close");
|
AppendMenu(mainmenu, MF_STRING, 102, "Close");
|
||||||
AppendMenu(mainmenu, MF_STRING, 103, "ThumbnailGenerator::click");
|
|
||||||
AppendMenu(mainmenu, MF_SEPARATOR, 0, NULL);
|
AppendMenu(mainmenu, MF_SEPARATOR, 0, NULL);
|
||||||
|
|
||||||
|
// Temporary
|
||||||
|
AppendMenu(mainmenu, MF_STRING, 103, "ThumbnailGenerator::click hideSky = true");
|
||||||
|
AppendMenu(mainmenu, MF_STRING, 104, "ThumbnailGenerator::click hideSky = false");
|
||||||
|
|
||||||
POINT p;
|
POINT p;
|
||||||
GetCursorPos(&p);
|
GetCursorPos(&p);
|
||||||
int menuClick = TrackPopupMenu(mainmenu, TPM_LEFTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, Globals::mainHwnd, 0);
|
int menuClick = TrackPopupMenu(mainmenu, TPM_LEFTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, Globals::mainHwnd, 0);
|
||||||
@@ -34,6 +38,10 @@ void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
|||||||
break;
|
break;
|
||||||
case 103:
|
case 103:
|
||||||
g_dataModel->getThumbnailGenerator()->click("PNG", 256, 256, true);
|
g_dataModel->getThumbnailGenerator()->click("PNG", 256, 256, true);
|
||||||
|
break;
|
||||||
|
case 104:
|
||||||
|
g_dataModel->getThumbnailGenerator()->click("JPEG", 256, 256, false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user