Пример #1
0
void GameGui::init(){
    //disable tabbing
    setTabbingEnabled(0);

    //make statbox + chatbox
    statBox = new StatBox;
    chatBox = new ChatBox;
    healthBox = new HealthBox;
    inventoryBox = new InventoryBox;

    //put the gui objects into the container
    container->add(statBox);
    container->add(chatBox);
    container->add(healthBox);
    container->add(inventoryBox);
}
Пример #2
0
void MapperGui::init(){
    //enable tabbing
    setTabbingEnabled( true );

    // used to regen map prev when map is edited
    mapTouched = 1;

    //init "world"
    world = NULL;

    //curent actoin
    action = NOTHING;

    // this is where the AreaMap object draws to
    worldImage = NULL;

    worldImagePlaceHolder = new gcn::Container;
    worldImagePlaceHolder->addMouseListener(this);
    worldImagePlaceHolder->setOpaque( false );


    worldScroller = new InfraellyScroller( worldImagePlaceHolder );
    worldScroller->setOpaque( false );



    // fileToolBar
    fileToolBar = new MapperFileToolBar;
    fileToolBar->addMouseListener(this);

    // layer box
    layerToggleBox = new MapperLayerToggleBox;

    // Tileset box
    tilesetBox = new MapperTilesetBox;
    tilesetBox->addMouseListener(this);
    tilesetBox->getTilesetDropDown()->addSelectionListener(this);

    //init the load tileset dialogue
    loadTilesetBox = new LoadTilesetBox;
    loadTilesetBox->addWidgetListener(this);
    //init the make tileset dialogue
    makeTilesetBox = new MakeTilesetBox;
    makeTilesetBox->addWidgetListener(this);
    //tileset details
    tilesetDetailsBox = new TilesetDetailsBox;
    mapDetailsBox = new MapDetailsBox;

    //map loading box
    loadMapBox = new LoadMapBox;
    loadMapBox->addWidgetListener(this);


    //file name getter
    filenameBox = new FilenameBox("Please input a filename");
    filenameBox->addWidgetListener(this);


    //put the gui objects into the container
    add(worldScroller);
    add(fileToolBar);
    add(layerToggleBox);
    add(tilesetBox);
    add(tilesetDetailsBox);
    add(mapDetailsBox);
    add(loadTilesetBox);
    add(makeTilesetBox);
    add(loadMapBox);
    add(filenameBox);
}
Пример #3
0
void Console::init(){
    if( !initialised ){
        setTabbingEnabled(false);

        username = "";
        lines = 1;
        textW = 640;
        textH = 400;

        container->setOpaque(0);

        //initialise the form objects
        textArea = new gcn::TextBox("Welcome to the Infraelly Console");
        textScroller = new InfraellyScroller(textArea);
        inputField = new gcn::TextField;
        sendButton = new gcn::Button("Send");

        //add objects to self
        container->add(textScroller);
        container->add(inputField);
        container->add(sendButton);


        //set the console as the gui's top widget
        setTop(container);



        //CONFIGURE FORM OBJECTS
        // add 'this' as a mouse listener
        sendButton->addMouseListener(this);
        //add the input field as key listener
        inputField->addKeyListener(this);
        //make the text area non editable
        textArea->setEditable(0);
        //make the scroll bars (dis)appear automaticaly
        textScroller->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
        textScroller->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
        //not focus
        sendButton->setFocusable(0);
        textArea->setFocusable(0);
        //dont allow tabbing
        container->setTabOutEnabled(false);
        textArea->setTabOutEnabled(false);
        textScroller->setTabOutEnabled(false);
        inputField->setTabOutEnabled(false);
        sendButton->setTabOutEnabled(false);

        //set the colours of the objects
        // bases
        container->setBaseColor( gcn::Color(0, 0, 0) );             //the bg black
        inputField->setBaseColor( gcn::Color(0, 0, 200) );          //input d_black
        textArea->setForegroundColor( gcn::Color(255, 255, 255) );  //scoller (white)
        textScroller->setBaseColor( gcn::Color(0, 100, 200) );      //scoller (blue)
        sendButton->setBaseColor( gcn::Color(0, 0, 0) );            //the button (black)
        // background
        inputField->setBackgroundColor( gcn::Color(0, 0, 0) );      // black
        textScroller->setBackgroundColor( gcn::Color(0, 0, 0) );    //scoller (black)
        sendButton->setBackgroundColor( gcn::Color(0, 0, 0) );      //the button (black)
        //foreground (text color)
        inputField->setForegroundColor( gcn::Color(0, 255, 0) );    //input(green)
        textArea->setForegroundColor( gcn::Color(255, 255, 255) );          //text (white)
        textScroller->setForegroundColor( gcn::Color(255, 255, 255) );  //scroller (white)
        sendButton->setForegroundColor( gcn::Color(255, 0, 0) );        //the button (red)


        //give it a readable font
        textArea->setFont(font::guiTitleFont.at(font::stdGuiTitleFontSize));
        inputField->setFont(font::guiTitleFont.at(font::stdGuiTitleFontSize));
        sendButton->setFont(font::guiTitleFont.at(font::stdGuiTitleFontSize));

        //give the button no border
        sendButton->setFrameSize(0);
        //make the text area not opaque
        textArea->setOpaque(0);

        //set sizes
        //textArea
        //100 px hight
        textArea->setHeight(100);
        //500px wide
        textArea->setWidth(500);
        //textScroller
        // match textArea
        textScroller->setDimension( textArea->getDimension() );
        //input field
        // match the textArea in width, but leave space for the button
        inputField->setWidth( textArea->getWidth() - sendButton->getWidth() );
        inputField->setHeight( 20 );
        //button
        //make button same hight as input field
        sendButton->setHeight( inputField->getHeight() );


        //set the x-y
        resetPositions();

        inputField->requestFocus();

        // set initialised
        initialised = 1;
    }
}