GUI system


Any one develop UI editor to get the UI or sence layout done?


I’m thinking of editor for my hard coded routines in game cycle:

typedef struct
    ScreenFieldValues typField;
    ScreenElementTypes typElement;
    pair< int, int> whElement;
    int sizeStretch;
    int deltaX;
    int deltaY;
} ScreenFieldType;
typedef pair< ScreenFieldType, ScreenFieldType > HV_Field;
map< string, HV_Field > ScreenModel::SetupGameOptions();

vector< pair< string, HV_Field > > ScreenInterface::SetupGameOptions(CCArray* rElements);

class GameOptions : public CCLayer
        vector< pair< string, HV_Field > > mPosMenuItems;
        CCArray* mMenuItems;

        virtual bool init();
        static cocos2d::CCScene* scene();

        void SetupScene();
        void SetTarget(CCObject* rElement, string rName);
        void menuBackCallback(CCObject* pSender);
        CREATE_FUNC(GameOptions );

void GameOptions ::SetupScene()
    int capacity = GameOptions ::GetScreenInterface()->CapacityOptions();
    mMenuItems  = CCArray::createWithCapacity(capacity);
    mPosMenuItems = MainMenu::GetScreenInterface()->SetupGameOptions(mMenuItems);

void GameOptions ::SetTarget(CCObject* rElement, string rName)
    if ...

    else if (rName == "BTN_MAIN_MENU")
bool GameOptions ::init()
    if ( !CCLayer::init() )
         return false;
    CCMenu *menu = CCMenu::create();
    vector< pair< string, HV_Field > >::iterator pos_iter = mPosMenuItems.begin();
    CCObject* element;

    CCARRAY_FOREACH(mMenuItems, element)
        SetTarget(element, (*pos_iter).first);
        if (
                ((*pos_iter).second.first.typElement == SCET_BUTTON)
                ((*pos_iter).second.first.typElement == SCET_IF_BUTTON)
                ((*pos_iter).second.first.typElement == SCET_ONOFF_BUTTON)
            menu->addChild((static_cast(element)), 0);
            this->addChild((static_cast(element)), 0);

    menu->setPosition(ccp(float (0), float (0)));
    GameOptions ::GetScreenInterface()->SetupPositions(mMenuItems, mPosMenuItems, landscape);

    return true;

So basicaly I could make an editor with tool for picking object types and area for drawing rectangles. Saving could create gameOptions.xml ready to parse ScreenModel::SetupGameOptions and coresponding ScreenInterface::SetupGameOptions and ScreenModel::CapacityGameOptions. For now my non-generioc methods looks like:

int ScreenInterface::CapacityGameOptions()

vector< pair< string, HV_Field > > ScreenInterface::SetupGameOptions (CCArray* rElements)
    map< string, HV_Field > game_options;
    ScreenModel model(false);
    game_options = model.SetupGameOptions ();
    return ParseGenericScreen(rElements, game_options;

map< string, HV_Field > ScreenModel::SetupGameOptions ()
    map< string, HV_Field > game_options;
    buttons[0]      = {{pg_left, 0},{0, pg_left}};
    button_sizes[0] = {{area_height, area_height},{area_height, area_height}};

    game_options["BTN_GO_SPEED"]    = SetupScreenField(


Have you check CocoStudio Project?

Here is the link:


CocoStudio is preparing its international version, I mean English version in about one month.


So this is something like cocos builder for windows? Can’t wait to see english version :slight_smile:


Are there any plans for a cross-platform version?


Too much work. Maybe GNUstep can help, but I’m not sure that all required APIs implemented in it.