Correct air include path for OptionsModel, correct Window debugmode logic, justifications for sign
This commit is contained in:
parent
7758fe52cb
commit
41e1d28c56
@ -5,10 +5,12 @@
|
||||
#include "interface/Button.h"
|
||||
#include "interface/Label.h"
|
||||
#include "interface/Textbox.h"
|
||||
#include "interface/DropDown.h"
|
||||
|
||||
class SignWindow: public ui::Window
|
||||
{
|
||||
public:
|
||||
ui::DropDown * justification;
|
||||
ui::Textbox * textField;
|
||||
SignTool * tool;
|
||||
Simulation * sim;
|
||||
@ -29,11 +31,11 @@ public:
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
if(prompt->signID==-1 && prompt->textField->GetText().length())
|
||||
{
|
||||
prompt->sim->signs.push_back(sign(prompt->textField->GetText(), prompt->signPosition.X, prompt->signPosition.Y, sign::Left));
|
||||
prompt->sim->signs.push_back(sign(prompt->textField->GetText(), prompt->signPosition.X, prompt->signPosition.Y, (sign::Justification)prompt->justification->GetOption().second));
|
||||
}
|
||||
else if(prompt->textField->GetText().length())
|
||||
{
|
||||
prompt->sim->signs[prompt->signID] = sign(sign(prompt->textField->GetText(), prompt->signPosition.X, prompt->signPosition.Y, sign::Left));
|
||||
prompt->sim->signs[prompt->signID] = sign(sign(prompt->textField->GetText(), prompt->signPosition.X, prompt->signPosition.Y, (sign::Justification)prompt->justification->GetOption().second));
|
||||
}
|
||||
prompt->SelfDestruct();
|
||||
}
|
||||
@ -56,6 +58,13 @@ SignWindow::SignWindow(SignTool * tool_, Simulation * sim_, int signID_, ui::Poi
|
||||
okayButton->SetActionCallback(new OkayAction(this));
|
||||
AddComponent(okayButton);
|
||||
|
||||
justification = new ui::DropDown(ui::Point(4, 18), ui::Point(50, 16));
|
||||
AddComponent(justification);
|
||||
justification->AddOption(std::pair<std::string, int>("Left", (int)sign::Left));
|
||||
justification->AddOption(std::pair<std::string, int>("Centre", (int)sign::Centre));
|
||||
justification->AddOption(std::pair<std::string, int>("Right", (int)sign::Right));
|
||||
justification->SetOption(0);
|
||||
|
||||
textField = new ui::Textbox(ui::Point(4, 32), ui::Point(Size.X-8, 16), "");
|
||||
textField->SetAlignment(AlignLeft, AlignBottom);
|
||||
AddComponent(textField);
|
||||
|
@ -79,7 +79,8 @@ public:
|
||||
DropDown::DropDown(Point position, Point size):
|
||||
Component(position, size),
|
||||
isMouseInside(false),
|
||||
optionIndex(-1)
|
||||
optionIndex(-1),
|
||||
callback(NULL)
|
||||
{
|
||||
background = activeBackground = Colour(0, 0, 0);
|
||||
activeText = text = activeBackground = border = activeBorder = Colour(255, 255, 255);
|
||||
@ -114,6 +115,15 @@ void DropDown::Draw(const Point& screenPos)
|
||||
|
||||
}
|
||||
|
||||
std::pair<std::string, int> DropDown::GetOption()
|
||||
{
|
||||
if(optionIndex!=-1)
|
||||
{
|
||||
return options[optionIndex];
|
||||
}
|
||||
return std::pair<std::string, int>("", -1);
|
||||
}
|
||||
|
||||
void DropDown::SetOption(std::string option)
|
||||
{
|
||||
for(int i = 0; i < options.size(); i++)
|
||||
|
@ -33,6 +33,7 @@ class DropDown: public ui::Component {
|
||||
std::vector<std::pair<std::string, int> > options;
|
||||
public:
|
||||
DropDown(Point position, Point size);
|
||||
std::pair<std::string, int> GetOption();
|
||||
void SetOption(int option);
|
||||
void SetOption(std::string option);
|
||||
void AddOption(std::pair<std::string, int> option);
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <iostream>
|
||||
#include "Window.h"
|
||||
#include "Component.h"
|
||||
#include "interface/Point.h"
|
||||
@ -209,7 +210,7 @@ void Window::DoTick(float dt)
|
||||
void Window::DoKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if(character = 'd' && ctrl && shift)
|
||||
if(key == KEY_TAB && ctrl)
|
||||
debugMode = !debugMode;
|
||||
if(debugMode)
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Author: Simon
|
||||
*/
|
||||
|
||||
#include "Air.h"
|
||||
#include "simulation/Air.h"
|
||||
#include "OptionsModel.h"
|
||||
|
||||
OptionsModel::OptionsModel(Simulation * sim_) {
|
||||
|
Reference in New Issue
Block a user