Merge branch 'master' into MusicalProgrammer
This commit is contained in:
@@ -6,6 +6,9 @@ Instance* guiRoot;
|
|||||||
float mousex;
|
float mousex;
|
||||||
float mousey;
|
float mousey;
|
||||||
bool mouseButton1Down;
|
bool mouseButton1Down;
|
||||||
|
std::string message;
|
||||||
|
bool showMessage;
|
||||||
|
G3D::GFontRef font;
|
||||||
|
|
||||||
|
|
||||||
DataModelInstance::DataModelInstance(void)
|
DataModelInstance::DataModelInstance(void)
|
||||||
@@ -17,12 +20,38 @@ DataModelInstance::DataModelInstance(void)
|
|||||||
mousex = 0;
|
mousex = 0;
|
||||||
mousey = 0;
|
mousey = 0;
|
||||||
mouseButton1Down = false;
|
mouseButton1Down = false;
|
||||||
|
showMessage = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataModelInstance::~DataModelInstance(void)
|
DataModelInstance::~DataModelInstance(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataModelInstance::setMessage(std::string msg)
|
||||||
|
{
|
||||||
|
message = msg;
|
||||||
|
showMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataModelInstance::clearMessage()
|
||||||
|
{
|
||||||
|
showMessage = false;
|
||||||
|
message = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataModelInstance::drawMessage(RenderDevice* rd)
|
||||||
|
{
|
||||||
|
if(showMessage && !font.isNull())
|
||||||
|
{
|
||||||
|
int x = rd->getWidth()/2;
|
||||||
|
int y = rd->getHeight()/2;
|
||||||
|
int width = rd->getWidth()/2 + 100;
|
||||||
|
int height = width / 3;
|
||||||
|
Draw::box(Box(Vector3(x-(width/2), y-(height/2), 0), Vector3(x+(width/2), y+(height/2), 0)), rd, Color4::fromARGB(0x55B2B2B2), Color3::fromARGB(0xB2B2B2));
|
||||||
|
font->draw2D(rd, message, Vector2(x,y), height/8, Color3::white(), Color4::clear(), GFont::XALIGN_CENTER, GFont::YALIGN_CENTER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WorkspaceInstance* DataModelInstance::getWorkspace()
|
WorkspaceInstance* DataModelInstance::getWorkspace()
|
||||||
{
|
{
|
||||||
return workspace;
|
return workspace;
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ class DataModelInstance :
|
|||||||
public:
|
public:
|
||||||
DataModelInstance(void);
|
DataModelInstance(void);
|
||||||
~DataModelInstance(void);
|
~DataModelInstance(void);
|
||||||
|
void setMessage(std::string);
|
||||||
|
void clearMessage();
|
||||||
|
void drawMessage(RenderDevice*);
|
||||||
|
GFontRef font;
|
||||||
WorkspaceInstance* getWorkspace();
|
WorkspaceInstance* getWorkspace();
|
||||||
Instance* getGuiRoot();
|
Instance* getGuiRoot();
|
||||||
float mousex;
|
float mousex;
|
||||||
|
|||||||
BIN
Dialogs.aps
BIN
Dialogs.aps
Binary file not shown.
53
main.cpp
53
main.cpp
@@ -667,7 +667,7 @@ void Demo::onInit() {
|
|||||||
dataModel = new DataModelInstance();
|
dataModel = new DataModelInstance();
|
||||||
dataModel->setParent(NULL);
|
dataModel->setParent(NULL);
|
||||||
dataModel->name = "undefined";
|
dataModel->name = "undefined";
|
||||||
|
dataModel->font = fntdominant;
|
||||||
Globals::dataModel = dataModel;
|
Globals::dataModel = dataModel;
|
||||||
|
|
||||||
initGUI();
|
initGUI();
|
||||||
@@ -919,7 +919,7 @@ void Demo::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
|
|||||||
|
|
||||||
//User Input
|
//User Input
|
||||||
void Demo::onUserInput(UserInput* ui) {
|
void Demo::onUserInput(UserInput* ui) {
|
||||||
if (GetKeyState(VK_ESCAPE) >> 1) {
|
if (ui->keyPressed(SDLK_F4) && ui->keyDown(SDLK_LALT)) {
|
||||||
// Even when we aren't in debug mode, quit on escape.
|
// Even when we aren't in debug mode, quit on escape.
|
||||||
//endApplet = true;
|
//endApplet = true;
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
@@ -992,23 +992,27 @@ void Demo::onUserInput(UserInput* ui) {
|
|||||||
dataModel->mousex = ui->getMouseX();
|
dataModel->mousex = ui->getMouseX();
|
||||||
dataModel->mousey = ui->getMouseY();
|
dataModel->mousey = ui->getMouseY();
|
||||||
dataModel->mouseButton1Down = ui->keyDown(SDL_LEFT_MOUSE_KEY);
|
dataModel->mouseButton1Down = ui->keyDown(SDL_LEFT_MOUSE_KEY);
|
||||||
if(GetKeyState(VK_UP) >> 1)
|
|
||||||
|
if(GetKeyState('U') >> 1)
|
||||||
{
|
{
|
||||||
forwards = true;
|
forwards = true;
|
||||||
}
|
}
|
||||||
else if(GetKeyState(VK_DOWN) >> 1)
|
else if(GetKeyState('J') >> 1)
|
||||||
{
|
{
|
||||||
backwards = true;
|
backwards = true;
|
||||||
}
|
}
|
||||||
if(GetKeyState(VK_LEFT) >> 1)
|
if(GetKeyState('H') >> 1)
|
||||||
{
|
{
|
||||||
left = true;
|
left = true;
|
||||||
}
|
}
|
||||||
else if(GetKeyState(VK_RIGHT) >> 1)
|
else if(GetKeyState('K') >> 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
right = true;
|
right = true;
|
||||||
}
|
}
|
||||||
|
if(ui->keyDown('U'))
|
||||||
|
{
|
||||||
|
forwards = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(GetKeyState(SDL_LEFT_MOUSE_KEY))
|
if(GetKeyState(SDL_LEFT_MOUSE_KEY))
|
||||||
{
|
{
|
||||||
@@ -1274,6 +1278,7 @@ void Demo::onGraphics(RenderDevice* rd) {
|
|||||||
rd->window()->setInputCaptureCount(1);
|
rd->window()->setInputCaptureCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LightingParameters lighting(G3D::toSeconds(11, 00, 00, AM));
|
LightingParameters lighting(G3D::toSeconds(11, 00, 00, AM));
|
||||||
renderDevice->setProjectionAndCameraMatrix(debugCamera);
|
renderDevice->setProjectionAndCameraMatrix(debugCamera);
|
||||||
|
|
||||||
@@ -1356,6 +1361,7 @@ void Demo::onGraphics(RenderDevice* rd) {
|
|||||||
|
|
||||||
|
|
||||||
drawButtons(rd);
|
drawButtons(rd);
|
||||||
|
dataModel->drawMessage(rd);
|
||||||
rd->pushState();
|
rd->pushState();
|
||||||
rd->beforePrimitive();
|
rd->beforePrimitive();
|
||||||
|
|
||||||
@@ -1585,7 +1591,7 @@ int main(int argc, char** argv) {
|
|||||||
wc.hInstance = hInstance;
|
wc.hInstance = hInstance;
|
||||||
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW);
|
||||||
wc.lpszMenuName = NULL;
|
wc.lpszMenuName = NULL;
|
||||||
wc.lpszClassName = "containerHWND";
|
wc.lpszClassName = "containerHWND";
|
||||||
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
|
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
|
||||||
@@ -1606,21 +1612,46 @@ int main(int argc, char** argv) {
|
|||||||
600,
|
600,
|
||||||
NULL, // parent
|
NULL, // parent
|
||||||
NULL, // menu
|
NULL, // menu
|
||||||
hThisInstance,
|
hInstance,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
ShowWindow(hwndMain, SW_SHOW);
|
|
||||||
if(hwndMain == NULL)
|
if(hwndMain == NULL)
|
||||||
{
|
{
|
||||||
MessageBox(NULL, "Failed to create HWND","Dynamica Crash", MB_OK);
|
MessageBox(NULL, "Failed to create HWND","Dynamica Crash", MB_OK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
ShowWindow(hwndMain, SW_SHOW);
|
||||||
|
|
||||||
Win32Window* win32Window = Win32Window::create(settings.window,hwndMain);
|
Win32Window* win32Window = Win32Window::create(settings.window,hwndMain);
|
||||||
Demo demo = Demo(settings,win32Window);
|
Demo demo = Demo(settings,win32Window);
|
||||||
|
|
||||||
SetWindowLongPtr(hwndMain,GWL_USERDATA,(LONG)&demo);
|
SetWindowLongPtr(hwndMain,GWL_USERDATA,(LONG)&demo);
|
||||||
demo.run();
|
demo.run();
|
||||||
|
/*
|
||||||
|
LONG lStyle = GetWindowLong(hwnd, GWL_STYLE);
|
||||||
|
lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU);
|
||||||
|
SetWindowLong(hwnd, GWL_STYLE, lStyle);
|
||||||
|
|
||||||
|
LONG lExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
|
||||||
|
lExStyle &= ~(WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE);
|
||||||
|
SetWindowLong(hwnd, GWL_EXSTYLE, lExStyle);
|
||||||
|
SetWindowLongPtr(hwndMain, GWL_USERDATA, (LONG)&app);
|
||||||
|
HICON hicon = (HICON)LoadImage(GetModuleHandleW(NULL), (LPCSTR)MAKEINTRESOURCEW(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_DEFAULTSIZE);
|
||||||
|
SendMessage(hwndMain, WM_SETICON, ICON_BIG, (LPARAM)hicon);
|
||||||
|
SetWindowPos(hwndMain, NULL, 0, 0, 800, 600, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
if(GetClientRect(hwndMain, &rect))
|
||||||
|
{
|
||||||
|
width = rect.right - rect.left;
|
||||||
|
height = rect.bottom - rect.top;
|
||||||
|
}
|
||||||
|
SetWindowPos(hwnd, NULL, 0, 0, width, height, NULL);
|
||||||
|
|
||||||
|
app.run();
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user