Exemple #1
0
TaskWindow::TaskWindow(Eris::Entity * e) : m_entity(e)
{
  assert(e != 0);

  gcn::Color base = getBaseColor();
  base.a = 128;
  setBaseColor(base);

  // setTitleBarHeight(0);
  setMovable(false);

  // setOpaque(true);

  m_vbox = new gcn::VBox(2);
  m_widgets.push_back(SPtr<gcn::Widget>(m_vbox));

  m_progressBar = new gcn::Bar;
  m_widgets.push_back(SPtr<gcn::Widget>(m_progressBar));
  m_progressBar->setWidth(100);
  m_progressBar->setHeight(6);
  m_progressBar->setValue(0.0);
  m_progressBar->setForegroundColor(gcn::Color(0xaaaaaa));
  m_progressBar->setBaseColor(gcn::Color(0,0,0,25));
  m_vbox->pack(m_progressBar);

  add(m_vbox);
  resizeToContent();
}
AudioOptions::AudioOptions(RootWidget * top) : gcn::Window("Audio"),
                                               m_top(top)
{
  gcn::Color base = getBaseColor();
  base.a = 128;
  setBaseColor(base);

  setOpaque(true);

  gcn::Box * vbox = new gcn::VBox(6);
  m_widgets.push_back(SPtr<gcn::Widget>(vbox));

  gcn::Box * hbox = new gcn::HBox(6);
  m_widgets.push_back(SPtr<gcn::Widget>(hbox));

  gcn::Button * b = new gcn::Button("Apply");
  m_widgets.push_back(SPtr<gcn::Widget>(b));
  b->setActionEventId("apply");
  b->setFocusable(false);
  b->addActionListener(this);
  hbox->pack(b);

  b = new gcn::Button("Close");
  m_widgets.push_back(SPtr<gcn::Widget>(b));
  b->setActionEventId("close");
  b->setFocusable(false);
  b->addActionListener(this);
  hbox->pack(b);

  vbox->pack(hbox);

  add(vbox);

  resizeToContent();
}
Exemple #3
0
LoginBox::LoginBox() :
    usernameLabel(new gcn::Label("Username: "******"Password: "******"")),
    passwordTextField(new PasswordField(""))
    //passwordField(new PasswordField)
{
    setCaption("Login");
    setBaseColor(gcn::Color(204,235,150));

    usernameTextField->setWidth(100);
    passwordTextField->setWidth(100);

    usernameLabel->setPosition(10,10);
    usernameTextField->setPosition(usernameLabel->getWidth()+usernameLabel->getX(),10);

    passwordLabel->setPosition(10, usernameLabel->getY()+usernameLabel->getHeight()+5);
    passwordTextField->setPosition( passwordLabel->getX()+passwordLabel->getWidth(),
                                    passwordLabel->getY() );

    doneButton->addMouseListener(this);

    add(usernameLabel);
    add(usernameTextField);
    add(passwordLabel);
    add(passwordTextField);

    resizeToContent();
    setWidth(getWidth()+10);

    InfoForm::positionDefaultBtns();
}
Exemple #4
0
PauseDialog::PauseDialog() {
    LinearLayout* layout = new LinearLayout(LinearLayout::Direction::Vertical, this);

    Button* buttonContinue = new Button("Continue");
    buttonContinue->resize(BUTTON_WINDTH, BUTTON_HEIGHT);
    buttonContinue->clicked.connect([&]() {
        this->close();
    });
    layout->appendChild(buttonContinue);

    Button* buttonSave = new Button("Save game");
    buttonSave->resize(BUTTON_WINDTH, BUTTON_HEIGHT);
    buttonSave->clicked.connect([&]() {
        this->close();
        World::save();
    });
    layout->appendChild(buttonSave);

    Button* buttonLoad = new Button("Load game");
    buttonLoad->resize(BUTTON_WINDTH, BUTTON_HEIGHT);
    buttonLoad->clicked.connect([&]() {
        this->close();
        Window::get()->pushScreen(std::make_shared<LoadWorldScreen>());
    });
    layout->appendChild(buttonLoad);

    Button* buttonSettings = new Button("Settings");
    buttonSettings->resize(BUTTON_WINDTH, BUTTON_HEIGHT);
    buttonSettings->clicked.connect([&]() {
        this->close();
        Window::get()->pushScreen(std::make_shared<SettingsScreen>());
    });
    layout->appendChild(buttonSettings);

    Button* buttonMenu = new Button("Menu");
    buttonMenu->resize(BUTTON_WINDTH, BUTTON_HEIGHT);
    buttonMenu->clicked.connect([&]() {
        this->close();
        Window::get()->pushScreen(std::make_shared<MenuScreen>());
    });
    layout->appendChild(buttonMenu);

    Button* buttonExit = new Button("Exit");
    buttonExit->resize(BUTTON_WINDTH, BUTTON_HEIGHT);
    buttonExit->clicked.connect([&]() {
        Game::quit();
    });
    layout->appendChild(buttonExit);

    resizeToContent();

    Window::get()->getCurrentScreen()->pause();
}
Exemple #5
0
AnimToolBar::AnimToolBar(){
    //set caption of window
    setCaption("Select Animation Type");

    //load images
    InfraellyImageLoader loader;

    //load tileset buttons as tileset
    cache::tilesets.loadResource("tilesets/animatorButtons.xml");
    //store the pointer locally to make code more readble
    Tileset *btn_ptr = cache::tilesets.get("tilesets/animatorButtons.xml");

    //initialise buttons with tiles from above tileset
    typeItemBtn = new gcn::ImageButton(   loader.load( Tile(btn_ptr, 0, 0)  )   );
    typeCharBtn = new gcn::ImageButton(   loader.load( Tile(btn_ptr, 1, 0)  )   );
    typeObjectBtn = new gcn::ImageButton( loader.load( Tile(btn_ptr, 2, 0)  )   );
    typeClipBtn = new gcn::ImageButton(   loader.load( Tile(btn_ptr, 3, 0)  )   );

    // set sizes
    typeItemBtn->setFrameSize(0);
    typeCharBtn->setFrameSize(0);
    typeObjectBtn->setFrameSize(0);
    typeClipBtn->setFrameSize(0);

    //set othr properties
    typeItemBtn->setFocusable(false);
    typeCharBtn->setFocusable(false);
    typeObjectBtn->setFocusable(false);
    typeClipBtn->setFocusable(false);


    //position stuff
    typeItemBtn->setPosition(0, 0);
    typeCharBtn->setPosition(typeItemBtn->getX()+typeItemBtn->getWidth(), 0);
    typeObjectBtn->setPosition(typeCharBtn->getX()+typeCharBtn->getWidth(), 0);
    typeClipBtn->setPosition(typeObjectBtn->getX()+typeObjectBtn->getWidth(), 0);


    //set colours


    //add
    add(typeItemBtn);
    add(typeCharBtn);
    add(typeObjectBtn);
    add(typeClipBtn);

    resizeToContent();
}
StatusWindow::StatusWindow(Eris::Entity * e) : m_entity(e)
{
  assert(e != 0);

  gcn::Color base = getBaseColor();
  base.a = 128;
  setBaseColor(base);

  // setTitleBarHeight(0);
  setMovable(false);

  setCaption(e->getName());

  // setOpaque(true);

  m_vbox = new gcn::VBox(2);
  m_widgets.push_back(SPtr<gcn::Widget>(m_vbox));

  m_healthBar = new gcn::Bar;
  m_widgets.push_back(SPtr<gcn::Widget>(m_healthBar));
  m_healthBar->setWidth(100);
  m_healthBar->setHeight(6);
  m_healthBar->setValue(0.3);
  m_healthBar->setForegroundColor(gcn::Color(0xff0000));
  m_healthBar->setBaseColor(gcn::Color(0,0,0,25));
  m_vbox->pack(m_healthBar);

  m_staminaBar = new gcn::Bar;
  m_widgets.push_back(SPtr<gcn::Widget>(m_staminaBar));
  m_staminaBar->setWidth(100);
  m_staminaBar->setHeight(6);
  m_staminaBar->setValue(0.6);
  m_staminaBar->setForegroundColor(gcn::Color(0xeeeeee));
  m_staminaBar->setBaseColor(gcn::Color(0,0,0,25));
  m_vbox->pack(m_staminaBar);

  m_manaBar = new gcn::Bar;
  m_widgets.push_back(SPtr<gcn::Widget>(m_manaBar));
  m_manaBar->setWidth(100);
  m_manaBar->setHeight(6);
  m_manaBar->setValue(0.9);
  m_manaBar->setForegroundColor(gcn::Color(0x0000ff));
  m_manaBar->setBaseColor(gcn::Color(0,0,0,25));
  m_vbox->pack(m_manaBar);

  add(m_vbox);
  resizeToContent();
}
MouseSelectionMenu::MouseSelectionMenu(int x, int y)
:   gcn::Window("Mouse Selection Menu")
{
    try {
        setPosition(x, y);
        setOpaque(true);
        setMovable(false);
        this->setTitleBarHeight(0);

        setVisible(true);
        resizeToContent();

        Gui::current().addWidget(this);
    } catch (gcn::Exception e) {
        cout << e.getMessage() << endl;
    }
}
Exemple #8
0
    void WorldEditor::action(const gcn::ActionEvent& actionEvent)
    {
        if (actionEvent.getSource() == mNewRoomDialogCancelButton)
        {
            mNewRoomDialogWindow->setVisible(false);
        }
        else if (actionEvent.getSource() ==  mNewRoomDialogOKButton)
        {
            mNewRoomDialogWindow->setVisible(false);
            std::string name = mNewRoomDialogNameTextField->getText();

            if (name.empty())
            {
                return;
            }

            int newRoomNumber = ResourceHandler::getInstance()->newRoomBitmap(mNewRoomWidth / 20,
                                                                              mNewRoomHeight / 15,
                                                                              name);

            WorldPiece* worldPiece = new WorldPiece(newRoomNumber);
            worldPiece->setPosition(mNewRoomX, mNewRoomY);
            worldPiece->addActionListener(this);
            mWorldPieces[newRoomNumber] = worldPiece;
            add(worldPiece);

            mRoomSelector->setSelectedRoom(newRoomNumber);
        }
        else
        {
            WorldPiece* worldPiece = static_cast<WorldPiece*>(actionEvent.getSource());
            mRoomSelector->setSelectedRoom(worldPiece->getRoomNumber());

            resizeToContent();
        }
    }
ControlsOptions::ControlsOptions(RootWidget * top) : gcn::Window("Controls"),
                                                     m_top(top)
{
  gcn::Color base = getBaseColor();
  base.a = 128;
  setBaseColor(base);

  setOpaque(true);

  gcn::Box * vbox = new gcn::VBox(6);
  m_widgets.push_back(SPtr<gcn::Widget>(vbox));

  m_controlText = new gcn::TextBox;
  m_widgets.push_back(SPtr<gcn::Widget>(m_controlText));
  m_controlText->setEditable(false);
  m_controlText->setOpaque(false);
  m_controlText->setFocusable(false);
  m_controlText->setEnabled(false);
  gcn::ScrollArea * control_scroll = new gcn::ScrollArea(m_controlText,
                                                         gcn::ScrollArea::SHOW_AUTO,
                                                         gcn::ScrollArea::SHOW_ALWAYS);
  m_widgets.push_back(SPtr<gcn::Widget>(control_scroll));
  control_scroll->setWidth(500);
  control_scroll->setHeight(300);
  control_scroll->setFrameSize(1);
  vbox->pack(control_scroll);

  readBindings();

  gcn::Box * hbox = new gcn::HBox(6);
  m_widgets.push_back(SPtr<gcn::Widget>(hbox));

  gcn::Label * l = new gcn::Label("Key");
  m_widgets.push_back(SPtr<gcn::Widget>(l));
  hbox->pack(l);

  m_key = new gcn::TextField("          ");
  m_widgets.push_back(SPtr<gcn::Widget>(m_key));
  m_key->setText("");
  hbox->pack(m_key);

  l = new gcn::Label("Action");
  m_widgets.push_back(SPtr<gcn::Widget>(l));
  hbox->pack(l);

  m_action = new gcn::TextField("                                        ");
  m_widgets.push_back(SPtr<gcn::Widget>(m_action));
  m_action->setText("");
  hbox->pack(m_action);

  gcn::Button * b = new gcn::Button("Bind");
  m_widgets.push_back(SPtr<gcn::Widget>(b));
  b->setActionEventId("bind");
  b->setFocusable(false);
  b->addActionListener(this);
  hbox->pack(b);

  vbox->pack(hbox);

  hbox = new gcn::HBox(6);
  m_widgets.push_back(SPtr<gcn::Widget>(hbox));

  b = new gcn::Button("Apply");
  m_widgets.push_back(SPtr<gcn::Widget>(b));
  b->setActionEventId("apply");
  b->setFocusable(false);
  b->addActionListener(this);
  hbox->pack(b);

  b = new gcn::Button("Close");
  m_widgets.push_back(SPtr<gcn::Widget>(b));
  b->setActionEventId("close");
  b->setFocusable(false);
  b->addActionListener(this);
  hbox->pack(b);

  vbox->pack(hbox);

  add(vbox);

  resizeToContent();
}
void InnerDropdown::setMaxHeight(int newMaxHeight) {
	_maxHeight = newMaxHeight;
	resizeToContent();
}
Exemple #11
0
    WorldEditor::WorldEditor(RoomSelector* roomSelector)
        : mRoomSelector(roomSelector),
          mDrawingNewRoom(false)
    {
        addMouseListener(this);

        unsigned int i;
        for (i = 0; i < World::getInstance()->getRoomNumberList().size(); i++)
        {
            int roomNumber = World::getInstance()->getRoomNumberList()[i];

            WorldPiece* worldPiece = new WorldPiece(roomNumber);
            mWorldPieces[roomNumber] = worldPiece;
            worldPiece->setX(World::getInstance()->getRoomPosition(roomNumber).x);
            worldPiece->setY(World::getInstance()->getRoomPosition(roomNumber).y);
            worldPiece->addActionListener(this);
            add(worldPiece);
        }

        resizeToContent();

        mNewRoomDialogWidthLabel = new gcn::Label();
        mNewRoomDialogHeightLabel = new gcn::Label();
        mNewRoomDialogNameLabel = new gcn::Label("Name");
        mNewRoomDialogNameTextField = new gcn::TextField();
        mNewRoomDialogNameTextField->setWidth(100);
        mNewRoomDialogNameTextField->setBackgroundColor(gcn::Color(0x000000));
        mNewRoomDialogNameTextField->setForegroundColor(gcn::Color(0xffffff));
        mNewRoomDialogCancelButton = new gcn::Button("Cancel");
        mNewRoomDialogCancelButton->addActionListener(this);
        mNewRoomDialogCancelButton->setBaseColor(gcn::Color(255, 150, 200));
        mNewRoomDialogOKButton = new gcn::Button("OK");
        mNewRoomDialogOKButton->addActionListener(this);
        mNewRoomDialogOKButton->setWidth(mNewRoomDialogCancelButton->getWidth());
        mNewRoomDialogOKButton->setBaseColor(gcn::Color(255, 150, 200));
        mNewRoomDialogWindow = new gcn::Window("New room");
        mNewRoomDialogWindow->setBaseColor(gcn::Color(255, 150, 200));
        mNewRoomDialogWindow->add(mNewRoomDialogWidthLabel, 
                                  10, 
                                  10);
        mNewRoomDialogWindow->add(mNewRoomDialogHeightLabel, 
                                  10, 
                                  20);
        mNewRoomDialogWindow->add(mNewRoomDialogNameLabel, 
                                  10, 
                                  38);
        mNewRoomDialogWindow->add(mNewRoomDialogNameTextField,
                                  50,
                                  38);
        mNewRoomDialogWindow->resizeToContent();
        mNewRoomDialogWindow->add(mNewRoomDialogOKButton,
                                  mNewRoomDialogWindow->getWidth() / 2 
                                   - 5 - mNewRoomDialogOKButton->getWidth(),
                                  60);
        mNewRoomDialogWindow->add(mNewRoomDialogCancelButton,
                                  mNewRoomDialogWindow->getWidth() / 2 + 5,
                                  60);
        mNewRoomDialogWindow->resizeToContent();
        mNewRoomDialogWindow->setMovable(false);
        mNewRoomDialogWindow->setVisible(false);
        mNewRoomDialogWindow->setPosition(320 - mNewRoomDialogWindow->getWidth() / 2,
                                          240 - mNewRoomDialogWindow->getHeight() / 2);
        add(mNewRoomDialogWindow);
    }
Exemple #12
0
ItemMakerBox::ItemMakerBox() :
    filenameLbl(new gcn::Label("Filename: ")),
    filenameFld(new gcn::TextField("data/items/")),
    nameLbl(new gcn::Label("Name: ")),
    nameFld(new gcn::TextField("")),
    //------------------------
    typeLbl(new gcn::Label("Type")),
    typeLst(new StringList),
    typeDropDown(new gcn::DropDown),

    genderLbl(new gcn::Label("Gender")),
    genderLst(new StringList),
    genderDropDown(new gcn::DropDown),

    dropableLbl(new gcn::Label("Dropable: ")),
    dropableCheckBox(new gcn::CheckBox("", false)),
    stackableLbl(new gcn::Label("Stackable")),
    stackableCheckBox(new gcn::CheckBox("", false)),
    duraLbl(new gcn::Label("Durability: ")),
    duraFld(new NumberField("1")),
    //------------------------
    thumbLbl(new gcn::Label("Image: ")),
    thumbFld(new gcn::TextField("tsprites/")),
    spriteLbl(new gcn::Label("Sprite: ")),
    spriteFld(new gcn::TextField("tsprites/")),
    animLbl(new gcn::Label("Animation: ")),
    animFld(new gcn::TextField("anim/")),
    //------------------------
    augLbl(new gcn::Label("Auguments:")),
    augArea(new gcn::Container),        //placeholder
    //------------------------
    actionsLbl(new gcn::Label("Actions: ")),
    actionsArea(new gcn::Container),      //placeholder
    //------------------------
    descLbl(new gcn::Label("Description: ")),
    descFld(new gcn::TextBox("")),
    descScroller(new gcn::ScrollArea(descFld)),
    //------------------------
    loadBtn(new gcn::Button("Load")),
    saveBtn(new gcn::Button("Save"))
{
    setCaption(caption_);


    //initialise drop down lists
    typeLst->addElement("Food");
    typeLst->addElement("Weapon");
    typeLst->addElement("Amour");
    typeLst->addElement("Quest");
    typeLst->addElement("Misc");
    typeDropDown->setListModel(typeLst);

    genderLst->addElement("Asexual");
    genderLst->addElement("Female");
    genderLst->addElement("Male");
    genderDropDown->setListModel(genderLst);


    //confif widget appearance
    descScroller->setFrameSize(1);
    loadBtn->setFrameSize(0);
    saveBtn->setFrameSize(0);
    loadBtn->setFocusable(false);
    saveBtn->setFocusable(false);

    //set sizes of widgets
    filenameFld->setWidth(150);
    nameFld->setWidth(150);
    //------------------------
    typeDropDown->setWidth(150);
    genderDropDown->setWidth(150);
    stackableLbl->setWidth(150);
    duraFld->setWidth(150);
    //------------------------
    thumbFld->setWidth(150);
    spriteFld->setWidth(150);
    animFld->setWidth(150);
    //------------------------
    augArea->setWidth(240);        //placeholder
    augArea->setHeight(100);        //placeholder
    //------------------------
    actionsArea->setWidth(240);    //placeholder
    actionsArea->setHeight(100);    //placeholder
    //------------------------
    descScroller->setWidth(240);
    descScroller->setHeight(75);


    //position widgets
    filenameLbl->setPosition(10, 10);
    filenameFld->setPosition(100, 10);
    nameLbl->setPosition(10, 35);
    nameFld->setPosition(100, 35);
    //------------------------
    typeLbl->setPosition(10, 60);
    typeDropDown->setPosition(100, 60);
    genderLbl->setPosition(10, 85);
    genderDropDown->setPosition(100, 85);
    dropableLbl->setPosition(10, 110);
    dropableCheckBox->setPosition(100, 110);
    stackableLbl->setPosition(10, 135);
    stackableCheckBox->setPosition(100, 135);
    duraLbl->setPosition(10, 160);
    duraFld->setPosition(100, 160);
    //------------------------
    thumbLbl->setPosition(10, 185);
    thumbFld->setPosition(100, 185);
    spriteLbl->setPosition(10, 210);
    spriteFld->setPosition(100, 210);
    animLbl->setPosition(10, 235);
    animFld->setPosition(100, 235);
    //------------------------
    augLbl->setPosition(10, 265);
    augArea->setPosition(10, 280);       //placeholder
    //------------------------
    actionsLbl->setPosition(10, 400);
    actionsArea->setPosition(10, 430);    //placeholder
    //------------------------
    descLbl->setPosition(10, 550);
    descScroller->setPosition(10, 570);
    //------------------------
    loadBtn->setPosition(10, 652);
    saveBtn->setPosition(50, 652);


    //add widgets to window
    add(filenameLbl);
    add(filenameFld);
    add(nameLbl);
    add(nameFld);
    //------------------------
    add(typeLbl);
    add(typeDropDown);
    add(genderLbl);
    add(genderDropDown);
    add(dropableLbl);
    add(dropableCheckBox);
    add(stackableLbl);
    add(stackableCheckBox);
    add(duraLbl);
    add(duraFld);
    //------------------------
    add(augLbl);
    add(augArea);        //placeholder
    //------------------------
    add(actionsLbl);
    add(actionsArea);    //placeholder
    //------------------------
    add(thumbLbl);
    add(thumbFld);
    add(spriteLbl);
    add(spriteFld);
    add(animLbl);
    add(animFld);
    //------------------------
    add(descLbl);
    add(descScroller);
    //------------------------
    add(saveBtn);
    add(loadBtn);


    // set size of window
    resizeToContent();
    setWidth(getWidth()+10);
    setHeight(getHeight()+10);
}