예제 #1
0
 HelpPage()
 {
     Box *vbox = new VBox();
     ScrollArea* scroll = new ScrollArea();
     scroll->fitToParent(true);
     RichText *text = new RichText(help_text_html, help_text_html_len);
     scroll->virtualSize(Vec2(SCREEN_WIDTH,text->layout(SCREEN_WIDTH)));
     text->fitToParent(true);
     text->alpha(100);
     scroll->add(text,0,0);
     vbox->add( scroll, 0, 1 );
     vbox->add( new Button(PROJECT_HOMEPAGE,Event::SELECT), 36, 0 );
     m_content->add(vbox,0,0);
 }
예제 #2
0
 HelpPage()
 {
   Box *vbox = new VBox();
   ScrollArea* scroll = new ScrollArea();
   scroll->fitToParent(true);
   RichText *text = new RichText(HELP_TEXT);
   scroll->virtualSize(Vec2(SCREEN_WIDTH,text->layout(SCREEN_WIDTH)));
   text->fitToParent(true);
   text->alpha(100);
   scroll->add(text,0,0);
   vbox->add( scroll, 0, 1 );
   vbox->add( new Button("http://numptyphysics.garage.maemo.org",Event::SELECT), 36, 0 );
   m_content->add(vbox,0,0);
 }
예제 #3
0
    LevelSelector(GameControl* game, int initialLevel)
        : m_game(game),
          m_levels(game->m_levels),
          m_collection(0),
          m_dispbase(0),
          m_dispcount(0)
    {
        m_scroll = new ScrollArea();
        m_scroll->fitToParent(true);
        m_scroll->virtualSize(Vec2(SCREEN_WIDTH,SCREEN_HEIGHT));

        m_content->add(m_scroll,0,0);
        fitToParent(true);

        int levelInC;
        m_collection = m_levels->collectionFromLevel(initialLevel,&levelInC);
        setCollection(m_collection, levelInC);
    }
예제 #4
0
    void setCollection(int c, int levelInC)
    {
        if (c < 0 || static_cast<unsigned int>(c) >=m_levels->numCollections()) {
            return;
        }
        m_collection = c;
        m_dispbase = 0;
        m_dispcount = m_levels->collectionSize(c);
        m_scroll->virtualSize(Vec2(SCREEN_WIDTH,150+(SCREEN_HEIGHT/ICON_SCALE_FACTOR+40)*((m_dispcount+2)/3)));

        m_scroll->empty();
        Box *vbox = new VBox();
        vbox->add( new Spacer(),  10, 0 );
        Box *hbox = new HBox();
        Widget *w = new Button("<<",Event::PREVIOUS);
        w->border(false);
        hbox->add( w, BUTTON_WIDTH, 0 );
        hbox->add( new Spacer(), 10, 0 );
        Label *title = new Label(m_levels->collectionName(c));
        title->font(Font::headingFont());
        title->alpha(100);
        hbox->add( title, BUTTON_WIDTH, 4 );
        w= new Button(">>",Event::NEXT);
        w->border(false);
        hbox->add( new Spacer(), 10, 0 );
        hbox->add( w, BUTTON_WIDTH, 0 );
        vbox->add( hbox, 64, 0 );
        vbox->add( new Spacer(),  10, 0 );

        hbox = new HBox();
        hbox->add( new Spacer(),  0, 1 );
        int accumw = 0;
        for (int i=0; i<m_dispcount; i++) {
            accumw += SCREEN_WIDTH / ICON_SCALE_FACTOR + 10;
            if (accumw >= SCREEN_WIDTH) {
                vbox->add(hbox, SCREEN_HEIGHT/ICON_SCALE_FACTOR+30, 4);
                vbox->add( new Spacer(),  10, 0 );
                hbox = new HBox();
                hbox->add( new Spacer(),  0, 1 );
                accumw = SCREEN_WIDTH / ICON_SCALE_FACTOR;
            }
            m_thumbs[i] = new IconButton("--","",Event(Event::PLAY, //SELECT,
                                         m_levels->collectionLevel(c,i)));
            m_thumbs[i]->font(Font::blurbFont());
            m_thumbs[i]->setBg(SELECTED_BG);
            m_thumbs[i]->border(false);
            hbox->add( m_thumbs[i],  SCREEN_WIDTH / ICON_SCALE_FACTOR, 0 );
            hbox->add( new Spacer(), 0, 1 );
        }
        vbox->add(hbox, SCREEN_HEIGHT/ICON_SCALE_FACTOR+30, 4);
        vbox->add( new Spacer(), 110, 10 );
        m_scroll->add(vbox,0,0);

        for (int i=0; i<THUMB_COUNT && i+m_dispbase<m_dispcount; i++) {
            Canvas temp( SCREEN_WIDTH, SCREEN_HEIGHT );
            Scene scene( true );
            unsigned char buf[64*1024];
            int level = m_levels->collectionLevel(c,i);
            int size = m_levels->load( level, buf, sizeof(buf) );
            if ( size && scene.load( buf, size ) ) {
                scene.draw( temp, FULLSCREEN_RECT );
                m_thumbs[i]->text( m_levels->levelName(level) );
                m_thumbs[i]->canvas( temp.scale( ICON_SCALE_FACTOR ) );
                m_thumbs[i]->transparent(m_dispbase+i!=levelInC);
            }
        }
    }