Blocking Confirm/Error/Input prompts (EngineProcess creates a new event loop which can be broken out of with Engine::Break())
This commit is contained in:
parent
63da7a4afe
commit
740f0d30c3
3
src/PowderToy.h
Normal file
3
src/PowderToy.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
void EngineProcess();
|
@ -284,188 +284,21 @@ std::map<std::string, std::string> readArguments(int argc, char * argv[])
|
|||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char * argv[])
|
int elapsedTime = 0, currentTime = 0, lastTime = 0, currentFrame = 0;
|
||||||
|
unsigned int lastTick = 0;
|
||||||
|
float fps = 0, delta = 1.0f, inputScale = 1.0f;
|
||||||
|
ui::Engine * engine = NULL;
|
||||||
|
|
||||||
|
void EngineProcess()
|
||||||
{
|
{
|
||||||
int elapsedTime = 0, currentTime = 0, lastTime = 0, currentFrame = 0;
|
|
||||||
unsigned int lastTick = 0;
|
|
||||||
float fps = 0, delta = 1.0f, inputScale = 1.0f;
|
|
||||||
float currentWidth = XRES+BARSIZE, currentHeight = YRES+MENUSIZE;
|
|
||||||
|
|
||||||
std::map<std::string, std::string> arguments = readArguments(argc, argv);
|
|
||||||
|
|
||||||
if(arguments["ddir"].length())
|
|
||||||
#ifdef WIN
|
|
||||||
_chdir(arguments["ddir"].c_str());
|
|
||||||
#else
|
|
||||||
chdir(arguments["ddir"].c_str());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int tempScale = 1;
|
|
||||||
bool tempFullscreen = false;
|
|
||||||
|
|
||||||
tempScale = Client::Ref().GetPrefInteger("Scale", 1);
|
|
||||||
tempFullscreen = Client::Ref().GetPrefBool("Fullscreen", false);
|
|
||||||
|
|
||||||
|
|
||||||
if(arguments["kiosk"] == "true")
|
|
||||||
{
|
|
||||||
tempFullscreen = true;
|
|
||||||
Client::Ref().SetPref("Fullscreen", tempFullscreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(arguments["scale"].length())
|
|
||||||
{
|
|
||||||
tempScale = format::StringToNumber<int>(arguments["scale"]);
|
|
||||||
Client::Ref().SetPref("Scale", tempScale);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string proxyString = "";
|
|
||||||
if(arguments["proxy"].length())
|
|
||||||
{
|
|
||||||
if(arguments["proxy"] == "false")
|
|
||||||
{
|
|
||||||
proxyString = "";
|
|
||||||
Client::Ref().SetPref("Proxy", "");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
proxyString = (arguments["proxy"]);
|
|
||||||
Client::Ref().SetPref("Proxy", arguments["proxy"]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(Client::Ref().GetPrefString("Proxy", "").length())
|
|
||||||
{
|
|
||||||
proxyString = (Client::Ref().GetPrefString("Proxy", ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
Client::Ref().Initialise(proxyString);
|
|
||||||
|
|
||||||
if(tempScale != 1 && tempScale != 2)
|
|
||||||
tempScale = 1;
|
|
||||||
|
|
||||||
int sdlStatus = SDLOpen();
|
|
||||||
sdl_scrn = SDLSetScreen(tempScale, tempFullscreen);
|
|
||||||
#ifdef OGLI
|
|
||||||
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
|
|
||||||
//glScaled(2.0f, 2.0f, 1.0f);
|
|
||||||
#endif
|
|
||||||
#if defined(OGLI)
|
|
||||||
int status = glewInit();
|
|
||||||
if(status != GLEW_OK)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Initializing Glew: %d\n", status);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ui::Engine::Ref().g = new Graphics();
|
|
||||||
ui::Engine::Ref().Scale = scale;
|
|
||||||
inputScale = 1.0f/float(scale);
|
|
||||||
ui::Engine::Ref().Fullscreen = fullscreen;
|
|
||||||
|
|
||||||
ui::Engine * engine = &ui::Engine::Ref();
|
|
||||||
engine->Begin(XRES+BARSIZE, YRES+MENUSIZE);
|
|
||||||
|
|
||||||
GameController * gameController = new GameController();
|
|
||||||
engine->ShowWindow(gameController->GetView());
|
|
||||||
|
|
||||||
if(arguments["open"].length())
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
std::cout << "Loading " << arguments["open"] << std::endl;
|
|
||||||
#endif
|
|
||||||
if(Client::Ref().FileExists(arguments["open"]))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
std::vector<unsigned char> gameSaveData = Client::Ref().ReadFile(arguments["open"]);
|
|
||||||
if(!gameSaveData.size())
|
|
||||||
{
|
|
||||||
new ErrorMessage("Error", "Could not read file");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SaveFile * newFile = new SaveFile(arguments["open"]);
|
|
||||||
GameSave * newSave = new GameSave(gameSaveData);
|
|
||||||
newFile->SetGameSave(newSave);
|
|
||||||
gameController->LoadSaveFile(newFile);
|
|
||||||
delete newFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch(std::exception & e)
|
|
||||||
{
|
|
||||||
new ErrorMessage("Error", "Could not open save file:\n"+std::string(e.what())) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
new ErrorMessage("Error", "Could not open file");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(arguments["ptsave"].length())
|
|
||||||
{
|
|
||||||
engine->g->fillrect((engine->GetWidth()/2)-101, (engine->GetHeight()/2)-26, 202, 52, 0, 0, 0, 210);
|
|
||||||
engine->g->drawrect((engine->GetWidth()/2)-100, (engine->GetHeight()/2)-25, 200, 50, 255, 255, 255, 180);
|
|
||||||
engine->g->drawtext((engine->GetWidth()/2)-(Graphics::textwidth("Loading save...")/2), (engine->GetHeight()/2)-5, "Loading save...", style::Colour::InformationTitle.Red, style::Colour::InformationTitle.Green, style::Colour::InformationTitle.Blue, 255);
|
|
||||||
|
|
||||||
#ifdef OGLI
|
|
||||||
blit();
|
|
||||||
#else
|
|
||||||
if(engine->Scale==2)
|
|
||||||
blit2(engine->g->vid, engine->Scale);
|
|
||||||
else
|
|
||||||
blit(engine->g->vid);
|
|
||||||
#endif
|
|
||||||
std::string ptsaveArg = arguments["ptsave"];
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if(!ptsaveArg.find("ptsave:"))
|
|
||||||
{
|
|
||||||
std::string saveIdPart = "";
|
|
||||||
int saveId;
|
|
||||||
int hashPos = ptsaveArg.find('#');
|
|
||||||
if(hashPos != std::string::npos)
|
|
||||||
{
|
|
||||||
saveIdPart = ptsaveArg.substr(7, hashPos-7);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
saveIdPart = ptsaveArg.substr(7);
|
|
||||||
}
|
|
||||||
if(saveIdPart.length())
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
std::cout << "Got Ptsave: id: " << saveIdPart << std::endl;
|
|
||||||
#endif
|
|
||||||
saveId = format::StringToNumber<int>(saveIdPart);
|
|
||||||
if(!saveId)
|
|
||||||
throw std::runtime_error("Invalid Save ID");
|
|
||||||
|
|
||||||
SaveInfo * newSave = Client::Ref().GetSave(saveId, 0);
|
|
||||||
GameSave * newGameSave = new GameSave(Client::Ref().GetSaveData(saveId, 0));
|
|
||||||
newSave->SetGameSave(newGameSave);
|
|
||||||
if(!newSave)
|
|
||||||
throw std::runtime_error("Could not load save");
|
|
||||||
|
|
||||||
gameController->LoadSave(newSave);
|
|
||||||
delete newSave;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw std::runtime_error("No Save ID");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (std::exception & e)
|
|
||||||
{
|
|
||||||
new ErrorMessage("Error", "Invalid save link");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
while(engine->Running())
|
while(engine->Running())
|
||||||
{
|
{
|
||||||
|
if(engine->Broken())
|
||||||
|
{
|
||||||
|
engine->Break();
|
||||||
|
break;
|
||||||
|
}
|
||||||
event.type = 0;
|
event.type = 0;
|
||||||
while (SDL_PollEvent(&event))
|
while (SDL_PollEvent(&event))
|
||||||
{
|
{
|
||||||
@ -581,6 +414,186 @@ int main(int argc, char * argv[])
|
|||||||
}
|
}
|
||||||
engine->SetFps(fps);
|
engine->SetFps(fps);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char * argv[])
|
||||||
|
{
|
||||||
|
float currentWidth = XRES+BARSIZE, currentHeight = YRES+MENUSIZE;
|
||||||
|
|
||||||
|
std::map<std::string, std::string> arguments = readArguments(argc, argv);
|
||||||
|
|
||||||
|
if(arguments["ddir"].length())
|
||||||
|
#ifdef WIN
|
||||||
|
_chdir(arguments["ddir"].c_str());
|
||||||
|
#else
|
||||||
|
chdir(arguments["ddir"].c_str());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int tempScale = 1;
|
||||||
|
bool tempFullscreen = false;
|
||||||
|
|
||||||
|
tempScale = Client::Ref().GetPrefInteger("Scale", 1);
|
||||||
|
tempFullscreen = Client::Ref().GetPrefBool("Fullscreen", false);
|
||||||
|
|
||||||
|
|
||||||
|
if(arguments["kiosk"] == "true")
|
||||||
|
{
|
||||||
|
tempFullscreen = true;
|
||||||
|
Client::Ref().SetPref("Fullscreen", tempFullscreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(arguments["scale"].length())
|
||||||
|
{
|
||||||
|
tempScale = format::StringToNumber<int>(arguments["scale"]);
|
||||||
|
Client::Ref().SetPref("Scale", tempScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string proxyString = "";
|
||||||
|
if(arguments["proxy"].length())
|
||||||
|
{
|
||||||
|
if(arguments["proxy"] == "false")
|
||||||
|
{
|
||||||
|
proxyString = "";
|
||||||
|
Client::Ref().SetPref("Proxy", "");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
proxyString = (arguments["proxy"]);
|
||||||
|
Client::Ref().SetPref("Proxy", arguments["proxy"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(Client::Ref().GetPrefString("Proxy", "").length())
|
||||||
|
{
|
||||||
|
proxyString = (Client::Ref().GetPrefString("Proxy", ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
Client::Ref().Initialise(proxyString);
|
||||||
|
|
||||||
|
if(tempScale != 1 && tempScale != 2)
|
||||||
|
tempScale = 1;
|
||||||
|
|
||||||
|
int sdlStatus = SDLOpen();
|
||||||
|
sdl_scrn = SDLSetScreen(tempScale, tempFullscreen);
|
||||||
|
#ifdef OGLI
|
||||||
|
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
|
||||||
|
//glScaled(2.0f, 2.0f, 1.0f);
|
||||||
|
#endif
|
||||||
|
#if defined(OGLI)
|
||||||
|
int status = glewInit();
|
||||||
|
if(status != GLEW_OK)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Initializing Glew: %d\n", status);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
ui::Engine::Ref().g = new Graphics();
|
||||||
|
ui::Engine::Ref().Scale = scale;
|
||||||
|
inputScale = 1.0f/float(scale);
|
||||||
|
ui::Engine::Ref().Fullscreen = fullscreen;
|
||||||
|
|
||||||
|
engine = &ui::Engine::Ref();
|
||||||
|
engine->Begin(XRES+BARSIZE, YRES+MENUSIZE);
|
||||||
|
|
||||||
|
GameController * gameController = new GameController();
|
||||||
|
engine->ShowWindow(gameController->GetView());
|
||||||
|
|
||||||
|
if(arguments["open"].length())
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
std::cout << "Loading " << arguments["open"] << std::endl;
|
||||||
|
#endif
|
||||||
|
if(Client::Ref().FileExists(arguments["open"]))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::vector<unsigned char> gameSaveData = Client::Ref().ReadFile(arguments["open"]);
|
||||||
|
if(!gameSaveData.size())
|
||||||
|
{
|
||||||
|
new ErrorMessage("Error", "Could not read file");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SaveFile * newFile = new SaveFile(arguments["open"]);
|
||||||
|
GameSave * newSave = new GameSave(gameSaveData);
|
||||||
|
newFile->SetGameSave(newSave);
|
||||||
|
gameController->LoadSaveFile(newFile);
|
||||||
|
delete newFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(std::exception & e)
|
||||||
|
{
|
||||||
|
new ErrorMessage("Error", "Could not open save file:\n"+std::string(e.what())) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new ErrorMessage("Error", "Could not open file");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(arguments["ptsave"].length())
|
||||||
|
{
|
||||||
|
engine->g->fillrect((engine->GetWidth()/2)-101, (engine->GetHeight()/2)-26, 202, 52, 0, 0, 0, 210);
|
||||||
|
engine->g->drawrect((engine->GetWidth()/2)-100, (engine->GetHeight()/2)-25, 200, 50, 255, 255, 255, 180);
|
||||||
|
engine->g->drawtext((engine->GetWidth()/2)-(Graphics::textwidth("Loading save...")/2), (engine->GetHeight()/2)-5, "Loading save...", style::Colour::InformationTitle.Red, style::Colour::InformationTitle.Green, style::Colour::InformationTitle.Blue, 255);
|
||||||
|
|
||||||
|
#ifdef OGLI
|
||||||
|
blit();
|
||||||
|
#else
|
||||||
|
if(engine->Scale==2)
|
||||||
|
blit2(engine->g->vid, engine->Scale);
|
||||||
|
else
|
||||||
|
blit(engine->g->vid);
|
||||||
|
#endif
|
||||||
|
std::string ptsaveArg = arguments["ptsave"];
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(!ptsaveArg.find("ptsave:"))
|
||||||
|
{
|
||||||
|
std::string saveIdPart = "";
|
||||||
|
int saveId;
|
||||||
|
int hashPos = ptsaveArg.find('#');
|
||||||
|
if(hashPos != std::string::npos)
|
||||||
|
{
|
||||||
|
saveIdPart = ptsaveArg.substr(7, hashPos-7);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
saveIdPart = ptsaveArg.substr(7);
|
||||||
|
}
|
||||||
|
if(saveIdPart.length())
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
std::cout << "Got Ptsave: id: " << saveIdPart << std::endl;
|
||||||
|
#endif
|
||||||
|
saveId = format::StringToNumber<int>(saveIdPart);
|
||||||
|
if(!saveId)
|
||||||
|
throw std::runtime_error("Invalid Save ID");
|
||||||
|
|
||||||
|
SaveInfo * newSave = Client::Ref().GetSave(saveId, 0);
|
||||||
|
GameSave * newGameSave = new GameSave(Client::Ref().GetSaveData(saveId, 0));
|
||||||
|
newSave->SetGameSave(newGameSave);
|
||||||
|
if(!newSave)
|
||||||
|
throw std::runtime_error("Could not load save");
|
||||||
|
|
||||||
|
gameController->LoadSave(newSave);
|
||||||
|
delete newSave;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw std::runtime_error("No Save ID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (std::exception & e)
|
||||||
|
{
|
||||||
|
new ErrorMessage("Error", "Invalid save link");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EngineProcess();
|
||||||
|
|
||||||
ui::Engine::Ref().CloseWindow();
|
ui::Engine::Ref().CloseWindow();
|
||||||
delete gameController;
|
delete gameController;
|
||||||
delete ui::Engine::Ref().g;
|
delete ui::Engine::Ref().g;
|
||||||
|
@ -12,9 +12,18 @@
|
|||||||
#include "TPTScriptInterface.h"
|
#include "TPTScriptInterface.h"
|
||||||
#include "dialogues/ErrorMessage.h"
|
#include "dialogues/ErrorMessage.h"
|
||||||
#include "dialogues/InformationMessage.h"
|
#include "dialogues/InformationMessage.h"
|
||||||
|
#include "dialogues/TextPrompt.h"
|
||||||
|
#include "dialogues/ConfirmPrompt.h"
|
||||||
#include "simulation/Simulation.h"
|
#include "simulation/Simulation.h"
|
||||||
#include "game/GameModel.h"
|
#include "game/GameModel.h"
|
||||||
#include "LuaScriptHelper.h"
|
#include "LuaScriptHelper.h"
|
||||||
|
#include "client/HTTP.h"
|
||||||
|
|
||||||
|
#ifdef WIN
|
||||||
|
#include <direct.h>
|
||||||
|
#else
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
LuaScriptInterface::LuaScriptInterface(GameModel * m):
|
LuaScriptInterface::LuaScriptInterface(GameModel * m):
|
||||||
CommandInterface(m),
|
CommandInterface(m),
|
||||||
@ -1000,7 +1009,7 @@ int luatpt_graphics_func(lua_State *l)
|
|||||||
int luatpt_error(lua_State* l)
|
int luatpt_error(lua_State* l)
|
||||||
{
|
{
|
||||||
std::string errorMessage = std::string(luaL_optstring(l, 1, "Error text"));
|
std::string errorMessage = std::string(luaL_optstring(l, 1, "Error text"));
|
||||||
new ErrorMessage("Error", errorMessage);
|
ErrorMessage::Blocking("Error", errorMessage);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int luatpt_drawtext(lua_State* l)
|
int luatpt_drawtext(lua_State* l)
|
||||||
@ -1841,30 +1850,16 @@ int luatpt_unregister_mouseclick(lua_State* l)
|
|||||||
}
|
}
|
||||||
int luatpt_input(lua_State* l)
|
int luatpt_input(lua_State* l)
|
||||||
{
|
{
|
||||||
/*char *prompt, *title, *result, *shadow, *text;
|
std::string prompt, title, result, shadow, text;
|
||||||
title = mystrdup((char*)luaL_optstring(l, 1, "Title"));
|
title = std::string(luaL_optstring(l, 1, "Title"));
|
||||||
prompt = mystrdup((char*)luaL_optstring(l, 2, "Enter some text:"));
|
prompt = std::string(luaL_optstring(l, 2, "Enter some text:"));
|
||||||
text = mystrdup((char*)luaL_optstring(l, 3, ""));
|
text = std::string(luaL_optstring(l, 3, ""));
|
||||||
shadow = mystrdup((char*)luaL_optstring(l, 4, ""));
|
shadow = std::string(luaL_optstring(l, 4, ""));
|
||||||
|
|
||||||
if (vid_buf!=NULL)
|
result = TextPrompt::Blocking(title, prompt, text, shadow, false);
|
||||||
{
|
|
||||||
result = input_ui(vid_buf, title, prompt, text, shadow);
|
lua_pushstring(l, result.c_str());
|
||||||
lua_pushstring(l, result);
|
return 1;
|
||||||
free(result);
|
|
||||||
free(title);
|
|
||||||
free(prompt);
|
|
||||||
free(text);
|
|
||||||
free(shadow);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
free(title);
|
|
||||||
free(prompt);
|
|
||||||
free(text);
|
|
||||||
free(shadow);
|
|
||||||
return luaL_error(l, "Screen buffer does not exist");*/
|
|
||||||
//TODO IMPLEMENT
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
int luatpt_message_box(lua_State* l)
|
int luatpt_message_box(lua_State* l)
|
||||||
{
|
{
|
||||||
@ -1989,22 +1984,24 @@ int luatpt_setfpscap(lua_State* l)
|
|||||||
}
|
}
|
||||||
int luatpt_getscript(lua_State* l)
|
int luatpt_getscript(lua_State* l)
|
||||||
{
|
{
|
||||||
/*char *fileid = NULL, *filedata = NULL, *fileuri = NULL, *fileauthor = NULL, *filename = NULL, *lastError = NULL, *luacommand = NULL;
|
char *filedata = NULL, *fileuri = NULL, *filename = NULL, *lastError = NULL, *luacommand = NULL;
|
||||||
|
std::string fileauthor = "", fileid = "";
|
||||||
int len, ret,run_script;
|
int len, ret,run_script;
|
||||||
FILE * outputfile;
|
FILE * outputfile;
|
||||||
|
|
||||||
fileauthor = mystrdup(luaL_optstring(l, 1, ""));
|
fileauthor = std::string(luaL_optstring(l, 1, ""));
|
||||||
fileid = mystrdup(luaL_optstring(l, 2, ""));
|
fileid = std::string(luaL_optstring(l, 2, ""));
|
||||||
run_script = luaL_optint(l, 3, 0);
|
run_script = luaL_optint(l, 3, 0);
|
||||||
if(!fileauthor || !fileid || strlen(fileauthor)<1 || strlen(fileid)<1)
|
if(!fileauthor.length() || !fileid.length())
|
||||||
goto fin;
|
goto fin;
|
||||||
if(!confirm_ui(vid_buf, "Do you want to install script?", fileid, "Install"))
|
if(!ConfirmPrompt::Blocking("Do you want to install script?", fileid, "Install"))
|
||||||
goto fin;
|
goto fin;
|
||||||
|
|
||||||
fileuri = malloc(strlen(SCRIPTSERVER)+strlen(fileauthor)+strlen(fileid)+44);
|
fileuri = new char[strlen(SCRIPTSERVER)+fileauthor.length()+fileid.length()+44];
|
||||||
sprintf(fileuri, "http://" SCRIPTSERVER "/GetScript.api?Author=%s&Filename=%s", fileauthor, fileid);
|
sprintf(fileuri, "http://" SCRIPTSERVER "/GetScript.api?Author=%s&Filename=%s", fileauthor.c_str(), fileid.c_str());
|
||||||
|
|
||||||
filedata = http_auth_get(fileuri, svf_user_id, NULL, svf_session_id, &ret, &len);
|
//filedata = http_auth_get(fileuri, svf_user_id, NULL, svf_session_id, &ret, &len);
|
||||||
|
filedata = http_auth_get(fileuri, NULL, NULL, NULL, &ret, &len);
|
||||||
|
|
||||||
if(len <= 0 || !filedata)
|
if(len <= 0 || !filedata)
|
||||||
{
|
{
|
||||||
@ -2017,8 +2014,8 @@ int luatpt_getscript(lua_State* l)
|
|||||||
goto fin;
|
goto fin;
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = (char*)malloc(strlen(fileauthor)+strlen(fileid)+strlen(PATH_SEP)+strlen(LOCAL_LUA_DIR)+6);
|
filename = new char[fileauthor.length()+fileid.length()+strlen(PATH_SEP)+strlen(LOCAL_LUA_DIR)+6];
|
||||||
sprintf(filename, LOCAL_LUA_DIR PATH_SEP "%s_%s.lua", fileauthor, fileid);
|
sprintf(filename, LOCAL_LUA_DIR PATH_SEP "%s_%s.lua", fileauthor.c_str(), fileid.c_str());
|
||||||
|
|
||||||
#ifdef WIN
|
#ifdef WIN
|
||||||
_mkdir(LOCAL_LUA_DIR);
|
_mkdir(LOCAL_LUA_DIR);
|
||||||
@ -2031,7 +2028,7 @@ int luatpt_getscript(lua_State* l)
|
|||||||
{
|
{
|
||||||
fclose(outputfile);
|
fclose(outputfile);
|
||||||
outputfile = NULL;
|
outputfile = NULL;
|
||||||
if(confirm_ui(vid_buf, "File already exists, overwrite?", filename, "Overwrite"))
|
if(ConfirmPrompt::Blocking("File already exists, overwrite?", filename, "Overwrite"))
|
||||||
{
|
{
|
||||||
outputfile = fopen(filename, "w");
|
outputfile = fopen(filename, "w");
|
||||||
}
|
}
|
||||||
@ -2057,24 +2054,20 @@ int luatpt_getscript(lua_State* l)
|
|||||||
outputfile = NULL;
|
outputfile = NULL;
|
||||||
if(run_script)
|
if(run_script)
|
||||||
{
|
{
|
||||||
luacommand = malloc(strlen(filename)+20);
|
luacommand = new char[strlen(filename)+20];
|
||||||
sprintf(luacommand,"dofile(\"%s\")",filename);
|
sprintf(luacommand,"dofile(\"%s\")",filename);
|
||||||
luaL_dostring (l, luacommand);
|
luaL_dostring (l, luacommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
fin:
|
fin:
|
||||||
if(fileid) free(fileid);
|
|
||||||
if(filedata) free(filedata);
|
if(filedata) free(filedata);
|
||||||
if(fileuri) free(fileuri);
|
if(fileuri) delete[] fileuri;
|
||||||
if(fileauthor) free(fileauthor);
|
if(filename) delete[] filename;
|
||||||
if(filename) free(filename);
|
if(luacommand) delete[] luacommand;
|
||||||
if(luacommand) free(luacommand);
|
|
||||||
luacommand = NULL;
|
luacommand = NULL;
|
||||||
|
|
||||||
if(lastError) return luaL_error(l, lastError);
|
if(lastError) return luaL_error(l, lastError);
|
||||||
return 0;*/
|
return 0;
|
||||||
//TODO IMPLEMENT
|
|
||||||
return luaL_error(l, "Not implemented");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int luatpt_setwindowsize(lua_State* l)
|
int luatpt_setwindowsize(lua_State* l)
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "interface/Label.h"
|
#include "interface/Label.h"
|
||||||
#include "interface/Button.h"
|
#include "interface/Button.h"
|
||||||
|
#include "PowderToy.h"
|
||||||
|
|
||||||
ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, ConfirmDialogueCallback * callback_):
|
ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, ConfirmDialogueCallback * callback_):
|
||||||
ui::Window(ui::Point(-1, -1), ui::Point(250, 50)),
|
ui::Window(ui::Point(-1, -1), ui::Point(250, 50)),
|
||||||
@ -40,7 +41,8 @@ ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, ConfirmDial
|
|||||||
void ActionCallback(ui::Button * sender)
|
void ActionCallback(ui::Button * sender)
|
||||||
{
|
{
|
||||||
ui::Engine::Ref().CloseWindow();
|
ui::Engine::Ref().CloseWindow();
|
||||||
prompt->callback->ConfirmCallback(result);
|
if(prompt->callback)
|
||||||
|
prompt->callback->ConfirmCallback(result);
|
||||||
prompt->SelfDestruct();
|
prompt->SelfDestruct();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -65,6 +67,83 @@ ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, ConfirmDial
|
|||||||
ui::Engine::Ref().ShowWindow(this);
|
ui::Engine::Ref().ShowWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, std::string buttonText, ConfirmDialogueCallback * callback_):
|
||||||
|
ui::Window(ui::Point(-1, -1), ui::Point(250, 50)),
|
||||||
|
callback(callback_)
|
||||||
|
{
|
||||||
|
int width, height;
|
||||||
|
ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 15), title);
|
||||||
|
titleLabel->SetTextColour(style::Colour::WarningTitle);
|
||||||
|
titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
|
titleLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
|
AddComponent(titleLabel);
|
||||||
|
|
||||||
|
|
||||||
|
ui::Label * messageLabel = new ui::Label(ui::Point(4, 25), ui::Point(Size.X-8, -1), message);
|
||||||
|
messageLabel->SetMultiline(true);
|
||||||
|
messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
|
messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop;
|
||||||
|
AddComponent(messageLabel);
|
||||||
|
|
||||||
|
Size.Y += messageLabel->Size.Y+12;
|
||||||
|
Position.Y = (ui::Engine::Ref().GetHeight()-Size.Y)/2;
|
||||||
|
|
||||||
|
class CloseAction: public ui::ButtonAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ConfirmPrompt * prompt;
|
||||||
|
DialogueResult result;
|
||||||
|
CloseAction(ConfirmPrompt * prompt_, DialogueResult result_) { prompt = prompt_; result = result_; }
|
||||||
|
void ActionCallback(ui::Button * sender)
|
||||||
|
{
|
||||||
|
ui::Engine::Ref().CloseWindow();
|
||||||
|
if(prompt->callback)
|
||||||
|
prompt->callback->ConfirmCallback(result);
|
||||||
|
prompt->SelfDestruct();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
ui::Button * cancelButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X-75, 16), "Cancel");
|
||||||
|
cancelButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
|
cancelButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
|
cancelButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
|
||||||
|
cancelButton->SetActionCallback(new CloseAction(this, ResultCancel));
|
||||||
|
AddComponent(cancelButton);
|
||||||
|
SetCancelButton(cancelButton);
|
||||||
|
|
||||||
|
ui::Button * okayButton = new ui::Button(ui::Point(Size.X-76, Size.Y-16), ui::Point(76, 16), buttonText);
|
||||||
|
okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||||
|
okayButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
|
||||||
|
okayButton->Appearance.TextInactive = style::Colour::WarningTitle;
|
||||||
|
okayButton->SetActionCallback(new CloseAction(this, ResultOkay));
|
||||||
|
AddComponent(okayButton);
|
||||||
|
SetOkayButton(okayButton);
|
||||||
|
|
||||||
|
ui::Engine::Ref().ShowWindow(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ConfirmPrompt::Blocking(std::string title, std::string message, std::string buttonText)
|
||||||
|
{
|
||||||
|
class BlockingPromptCallback: public ConfirmDialogueCallback {
|
||||||
|
public:
|
||||||
|
bool & outputResult;
|
||||||
|
BlockingPromptCallback(bool & output): outputResult(output) {}
|
||||||
|
virtual void ConfirmCallback(ConfirmPrompt::DialogueResult result) {
|
||||||
|
if (result == ConfirmPrompt::ResultOkay)
|
||||||
|
outputResult = true;
|
||||||
|
else
|
||||||
|
outputResult = false;
|
||||||
|
ui::Engine::Ref().Break();
|
||||||
|
}
|
||||||
|
virtual ~BlockingPromptCallback() { }
|
||||||
|
};
|
||||||
|
bool result;
|
||||||
|
new ConfirmPrompt(title, message, buttonText, new BlockingPromptCallback(result));
|
||||||
|
EngineProcess();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void ConfirmPrompt::OnDraw()
|
void ConfirmPrompt::OnDraw()
|
||||||
{
|
{
|
||||||
Graphics * g = ui::Engine::Ref().g;
|
Graphics * g = ui::Engine::Ref().g;
|
||||||
|
@ -14,7 +14,9 @@ class ConfirmDialogueCallback;
|
|||||||
class ConfirmPrompt: public ui::Window {
|
class ConfirmPrompt: public ui::Window {
|
||||||
public:
|
public:
|
||||||
enum DialogueResult { ResultCancel, ResultOkay };
|
enum DialogueResult { ResultCancel, ResultOkay };
|
||||||
ConfirmPrompt(std::string title, std::string message, ConfirmDialogueCallback * callback_);
|
ConfirmPrompt(std::string title, std::string message, ConfirmDialogueCallback * callback_ = NULL);
|
||||||
|
ConfirmPrompt(std::string title, std::string message, std::string buttonText, ConfirmDialogueCallback * callback_ = NULL);
|
||||||
|
static bool Blocking(std::string title, std::string message, std::string buttonText = "Confirm");
|
||||||
virtual void OnDraw();
|
virtual void OnDraw();
|
||||||
virtual ~ConfirmPrompt();
|
virtual ~ConfirmPrompt();
|
||||||
ConfirmDialogueCallback * callback;
|
ConfirmDialogueCallback * callback;
|
||||||
|
@ -9,9 +9,11 @@
|
|||||||
#include "ErrorMessage.h"
|
#include "ErrorMessage.h"
|
||||||
#include "interface/Button.h"
|
#include "interface/Button.h"
|
||||||
#include "interface/Label.h"
|
#include "interface/Label.h"
|
||||||
|
#include "PowderToy.h"
|
||||||
|
|
||||||
ErrorMessage::ErrorMessage(std::string title, std::string message):
|
ErrorMessage::ErrorMessage(std::string title, std::string message, ErrorMessageCallback * callback_):
|
||||||
ui::Window(ui::Point(-1, -1), ui::Point(200, 75))
|
ui::Window(ui::Point(-1, -1), ui::Point(200, 75)),
|
||||||
|
callback(callback_)
|
||||||
{
|
{
|
||||||
ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 16), title);
|
ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 16), title);
|
||||||
titleLabel->SetTextColour(style::Colour::ErrorTitle);
|
titleLabel->SetTextColour(style::Colour::ErrorTitle);
|
||||||
@ -32,7 +34,9 @@ ErrorMessage::ErrorMessage(std::string title, std::string message):
|
|||||||
void ActionCallback(ui::Button * sender)
|
void ActionCallback(ui::Button * sender)
|
||||||
{
|
{
|
||||||
ui::Engine::Ref().CloseWindow();
|
ui::Engine::Ref().CloseWindow();
|
||||||
message->SelfDestruct(); //TODO: Fix component disposal
|
if(message->callback)
|
||||||
|
message->callback->DismissCallback();
|
||||||
|
message->SelfDestruct();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -48,6 +52,20 @@ ErrorMessage::ErrorMessage(std::string title, std::string message):
|
|||||||
ui::Engine::Ref().ShowWindow(this);
|
ui::Engine::Ref().ShowWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ErrorMessage::Blocking(std::string title, std::string message)
|
||||||
|
{
|
||||||
|
class BlockingDismissCallback: public ErrorMessageCallback {
|
||||||
|
public:
|
||||||
|
BlockingDismissCallback() {}
|
||||||
|
virtual void DismissCallback() {
|
||||||
|
ui::Engine::Ref().Break();
|
||||||
|
}
|
||||||
|
virtual ~BlockingDismissCallback() { }
|
||||||
|
};
|
||||||
|
new ErrorMessage(title, message, new BlockingDismissCallback());
|
||||||
|
EngineProcess();
|
||||||
|
}
|
||||||
|
|
||||||
void ErrorMessage::OnDraw()
|
void ErrorMessage::OnDraw()
|
||||||
{
|
{
|
||||||
Graphics * g = ui::Engine::Ref().g;
|
Graphics * g = ui::Engine::Ref().g;
|
||||||
@ -57,5 +75,7 @@ void ErrorMessage::OnDraw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ErrorMessage::~ErrorMessage() {
|
ErrorMessage::~ErrorMessage() {
|
||||||
|
if(callback)
|
||||||
|
delete callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,11 +10,21 @@
|
|||||||
|
|
||||||
#include "interface/Window.h"
|
#include "interface/Window.h"
|
||||||
|
|
||||||
|
class ErrorMessageCallback;
|
||||||
class ErrorMessage: public ui::Window {
|
class ErrorMessage: public ui::Window {
|
||||||
|
ErrorMessageCallback * callback;
|
||||||
public:
|
public:
|
||||||
ErrorMessage(std::string title, std::string message);
|
ErrorMessage(std::string title, std::string message, ErrorMessageCallback * callback_ = NULL);
|
||||||
|
static void Blocking(std::string title, std::string message);
|
||||||
virtual void OnDraw();
|
virtual void OnDraw();
|
||||||
virtual ~ErrorMessage();
|
virtual ~ErrorMessage();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ErrorMessageCallback
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void DismissCallback() {}
|
||||||
|
virtual ~ErrorMessageCallback() {}
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* ERRORMESSAGE_H_ */
|
#endif /* ERRORMESSAGE_H_ */
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "interface/Label.h"
|
#include "interface/Label.h"
|
||||||
#include "interface/Button.h"
|
#include "interface/Button.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
|
#include "PowderToy.h"
|
||||||
|
|
||||||
class CloseAction: public ui::ButtonAction
|
class CloseAction: public ui::ButtonAction
|
||||||
{
|
{
|
||||||
@ -25,7 +26,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TextPrompt::TextPrompt(std::string title, std::string message, bool multiline, TextDialogueCallback * callback_):
|
TextPrompt::TextPrompt(std::string title, std::string message, std::string text, std::string placeholder, bool multiline, TextDialogueCallback * callback_):
|
||||||
ui::Window(ui::Point(-1, -1), ui::Point(200, 80)),
|
ui::Window(ui::Point(-1, -1), ui::Point(200, 80)),
|
||||||
callback(callback_)
|
callback(callback_)
|
||||||
{
|
{
|
||||||
@ -39,7 +40,7 @@ TextPrompt::TextPrompt(std::string title, std::string message, bool multiline, T
|
|||||||
messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop;
|
messageLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; messageLabel->Appearance.VerticalAlign = ui::Appearance::AlignTop;
|
||||||
AddComponent(messageLabel);
|
AddComponent(messageLabel);
|
||||||
|
|
||||||
textField = new ui::Textbox(ui::Point(4, 45 ), ui::Point(Size.X-8, 16), "", "Reason");
|
textField = new ui::Textbox(ui::Point(4, 45 ), ui::Point(Size.X-8, 16), text, placeholder);
|
||||||
if(multiline)
|
if(multiline)
|
||||||
{
|
{
|
||||||
textField->SetMultiline(true);
|
textField->SetMultiline(true);
|
||||||
@ -73,6 +74,29 @@ TextPrompt::TextPrompt(std::string title, std::string message, bool multiline, T
|
|||||||
ui::Engine::Ref().ShowWindow(this);
|
ui::Engine::Ref().ShowWindow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string TextPrompt::Blocking(std::string title, std::string message, std::string text, std::string placeholder, bool multiline)
|
||||||
|
{
|
||||||
|
std::string returnString = "";
|
||||||
|
|
||||||
|
class BlockingTextCallback: public TextDialogueCallback {
|
||||||
|
std::string & outputString;
|
||||||
|
public:
|
||||||
|
BlockingTextCallback(std::string & output) : outputString(output) {}
|
||||||
|
virtual void TextCallback(TextPrompt::DialogueResult result, std::string resultText) {
|
||||||
|
if(result == ResultOkay)
|
||||||
|
outputString = resultText;
|
||||||
|
else
|
||||||
|
outputString = "";
|
||||||
|
ui::Engine::Ref().Break();
|
||||||
|
}
|
||||||
|
virtual ~BlockingTextCallback() { }
|
||||||
|
};
|
||||||
|
new TextPrompt(title, message, text, placeholder, multiline, new BlockingTextCallback(returnString));
|
||||||
|
EngineProcess();
|
||||||
|
|
||||||
|
return returnString;
|
||||||
|
}
|
||||||
|
|
||||||
void TextPrompt::OnDraw()
|
void TextPrompt::OnDraw()
|
||||||
{
|
{
|
||||||
Graphics * g = ui::Engine::Ref().g;
|
Graphics * g = ui::Engine::Ref().g;
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
* Author: Simon
|
* Author: Simon
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONFIRMPROMPT_H_
|
#ifndef TEXTPROMPT_H_
|
||||||
#define CONFIRMPROMPT_H_
|
#define TEXTPROMPT_H_
|
||||||
|
|
||||||
#include "interface/Window.h"
|
#include "interface/Window.h"
|
||||||
#include "interface/Textbox.h"
|
#include "interface/Textbox.h"
|
||||||
@ -18,7 +18,8 @@ protected:
|
|||||||
public:
|
public:
|
||||||
friend class CloseAction;
|
friend class CloseAction;
|
||||||
enum DialogueResult { ResultCancel, ResultOkay };
|
enum DialogueResult { ResultCancel, ResultOkay };
|
||||||
TextPrompt(std::string title, std::string message, bool multiline, TextDialogueCallback * callback_);
|
TextPrompt(std::string title, std::string message, std::string text, std::string placeholder, bool multiline, TextDialogueCallback * callback_);
|
||||||
|
static std::string Blocking(std::string title, std::string message, std::string text, std::string placeholder, bool multiline);
|
||||||
virtual void OnDraw();
|
virtual void OnDraw();
|
||||||
virtual ~TextPrompt();
|
virtual ~TextPrompt();
|
||||||
TextDialogueCallback * callback;
|
TextDialogueCallback * callback;
|
||||||
@ -31,4 +32,4 @@ class TextDialogueCallback
|
|||||||
virtual ~TextDialogueCallback() {}
|
virtual ~TextDialogueCallback() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CONFIRMPROMPT_H_ */
|
#endif /* TEXTPROMPT_H_ */
|
||||||
|
@ -24,7 +24,8 @@ Engine::Engine():
|
|||||||
windowTargetPosition(0, 0),
|
windowTargetPosition(0, 0),
|
||||||
FrameIndex(0),
|
FrameIndex(0),
|
||||||
Fullscreen(false),
|
Fullscreen(false),
|
||||||
Scale(1)
|
Scale(1),
|
||||||
|
break_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,6 +50,11 @@ void Engine::Begin(int width, int height)
|
|||||||
height_ = height;
|
height_ = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Engine::Break()
|
||||||
|
{
|
||||||
|
break_ = !break_;
|
||||||
|
}
|
||||||
|
|
||||||
void Engine::Exit()
|
void Engine::Exit()
|
||||||
{
|
{
|
||||||
running_ = false;
|
running_ = false;
|
||||||
|
@ -35,7 +35,9 @@ namespace ui
|
|||||||
|
|
||||||
void Begin(int width, int height);
|
void Begin(int width, int height);
|
||||||
inline bool Running() { return running_; }
|
inline bool Running() { return running_; }
|
||||||
|
inline bool Broken() { return break_; }
|
||||||
void Exit();
|
void Exit();
|
||||||
|
void Break();
|
||||||
|
|
||||||
void SetFullscreen(bool fullscreen) { Fullscreen = fullscreen; }
|
void SetFullscreen(bool fullscreen) { Fullscreen = fullscreen; }
|
||||||
inline bool GetFullscreen() { return Fullscreen; }
|
inline bool GetFullscreen() { return Fullscreen; }
|
||||||
@ -76,6 +78,7 @@ namespace ui
|
|||||||
float windowOpenState;
|
float windowOpenState;
|
||||||
|
|
||||||
bool running_;
|
bool running_;
|
||||||
|
bool break_;
|
||||||
|
|
||||||
int mousex_;
|
int mousex_;
|
||||||
int mousey_;
|
int mousey_;
|
||||||
|
@ -113,7 +113,7 @@ PreviewView::PreviewView():
|
|||||||
ReportAction(PreviewView * v_){ v = v_; }
|
ReportAction(PreviewView * v_){ v = v_; }
|
||||||
virtual void ActionCallback(ui::Button * sender)
|
virtual void ActionCallback(ui::Button * sender)
|
||||||
{
|
{
|
||||||
new TextPrompt("Report Save", "Reason for reporting", true, new ReportPromptCallback(v));
|
new TextPrompt("Report Save", "Reason for reporting", "", "[reason]", true, new ReportPromptCallback(v));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
reportButton = new ui::Button(ui::Point(100, Size.Y-19), ui::Point(51, 19), "Report");
|
reportButton = new ui::Button(ui::Point(100, Size.Y-19), ui::Point(51, 19), "Report");
|
||||||
|
Loading…
Reference in New Issue
Block a user