hide gui with thumbnail generation
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -58,3 +58,5 @@ desktop.ini
|
||||
#Redist
|
||||
!Installer/Redist/*
|
||||
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)
|
||||
{
|
||||
const G3D::GImage::Format format = G3D::GImage::stringToFormat(fileType);
|
||||
|
||||
// Important things we need
|
||||
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
|
||||
if(hideSky)
|
||||
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);
|
||||
out.write(reinterpret_cast<const char*>(binOut.getCArray()), binOut.length());
|
||||
|
||||
// Unhide GUI
|
||||
guiRoot->hideGui(false);
|
||||
|
||||
return "boop!";
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,9 @@ public:
|
||||
void update();
|
||||
bool mouseInGUI(G3D::RenderDevice* renderDevice,int x,int y);
|
||||
void onMouseLeftUp(G3D::RenderDevice* renderDevice, int x,int y);
|
||||
void hideGui(bool doHide);
|
||||
private:
|
||||
std::string _message;
|
||||
G3D::RealTime _messageTime;
|
||||
bool _hideGui;
|
||||
};
|
||||
@@ -43,6 +43,7 @@ GuiRootInstance::GuiRootInstance() : _message(""), _messageTime(0)
|
||||
{
|
||||
g_fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));
|
||||
g_fntlighttrek = GFont::fromFile(GetFileInPath("/content/font/lighttrek.fnt"));
|
||||
_hideGui = false;
|
||||
|
||||
//Bottom Left
|
||||
TextButtonInstance* button = makeTextButton();
|
||||
@@ -434,6 +435,7 @@ void GuiRootInstance::setDebugMessage(std::string msg, G3D::RealTime msgTime)
|
||||
|
||||
void GuiRootInstance::renderGUI(G3D::RenderDevice* rd, double fps)
|
||||
{
|
||||
if(_hideGui) return;
|
||||
//TODO--Move these to their own instance
|
||||
|
||||
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, 101, "Open...");
|
||||
AppendMenu(mainmenu, MF_STRING, 102, "Close");
|
||||
AppendMenu(mainmenu, MF_STRING, 103, "ThumbnailGenerator::click");
|
||||
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;
|
||||
GetCursorPos(&p);
|
||||
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;
|
||||
case 103:
|
||||
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