当前位置: 首页>>代码示例>>C++>>正文


C++ Globals::values方法代码示例

本文整理汇总了C++中Globals::values方法的典型用法代码示例。如果您正苦于以下问题:C++ Globals::values方法的具体用法?C++ Globals::values怎么用?C++ Globals::values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Globals的用法示例。


在下文中一共展示了Globals::values方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

    void
    Outro::on_draw()
    {
        if (m_snd_game_exit != NULL)
        {
            if (timer_elapsed() > static_cast<unsigned int>(m_snd_game_exit->length_in_ms) + 100)
            {
                next_state();
            }
        }

        Globals g;

        g.render().DrawTile(0,0, g.values().res_w(), g.values().res_h(), m_img_mainmenu);

        string text1 = g.snd2txt().text();
        string text2 = "";

        if (text1.length() >= 25)
        {
            text2 = text1;
            text1.erase(25, string::npos);
            text2.erase(0, 25);
        }
        g.render().DrawText(500, 400, 1.0, 1.0, 1.0, text1);
        g.render().DrawText(500, 450, 1.0, 1.0, 1.0, text2);
    }
开发者ID:mmatyas,项目名称:Atomic-Bomberman,代码行数:27,代码来源:stateoutro.cpp

示例2:

void
ConfigureKeys::on_draw()
{
#ifndef DISABLE_LIBSIGC
    Globals g;

    // background image
    g.render().DrawTile(0, 0, g.values().res_w(), g.values().res_h(), m_bg);

    int width  = g.values().res_w();
    int half   = width / 2;
    int quarter= width / 4;

    SDL_Rect top = {quarter - 220, 80, width - 2*(quarter-220), 80};
    SDL_Rect rl  = {quarter - 220, 170, half - 50, 500};
    SDL_Rect rr  = {half + (half -(quarter - 220 + (half - 50))), 170, half - 50, 500};

    g.render().FillRect(top,.0, .0, .0, 0.5f);
    g.render().FillRect(rl ,.0, .0, .0, 0.5f);
    g.render().FillRect(rr ,.0, .0, .0, 0.5f);

    m_con_active.draw_all();
    m_con_passive.draw_all();

    draw_player_keys();

    m_anim_bomb.Update();

    if (mb_grab_key)
    {
        draw_grab_key();
        m_anim_bomb.Draw(quarter - 185, 740, 50, 50);
        m_anim_bomb.Draw(quarter - 220 + (width - 2*(quarter-220)) - 45, 740, 50, 50);
    }
    else
    {
        int index = m_con_active.current_focused();
        m_anim_bomb.Draw(quarter-145 + 512*(index>5?1:0), 142 + 75*((index>5?(index-6):index)+1), 50, 50);
    }
#endif // DISABLE_LIBSIGC
}
开发者ID:mmatyas,项目名称:Atomic-Bomberman,代码行数:41,代码来源:stateconfigurekeys.cpp

示例3: switch

void
ConfigureKeys::draw_grab_key()
{
    Globals g;
    int width  = g.values().res_w();
    int height = g.values().res_h();
    int quarter= width / 4;

    SDL_Rect r = {quarter - 220, 680, width - 2*(quarter-220), 70};

    g.render().FillRect(r, .0, .0, .0, .5f);

    string str = "Press a key for ";

    switch (m_which_player)
    {
        case 0: str += "Player 1!"; break;
        case 1: str += "Player 2!"; break;
    }

    g.render().SetTextSizes(24, 24);
    g.render().DrawText(r, 255, 255, 255, str);
}
开发者ID:mmatyas,项目名称:Atomic-Bomberman,代码行数:23,代码来源:stateconfigurekeys.cpp

示例4: PushButton

void
ConfigureKeys::create_gui()
{
#ifndef DISABLE_LIBSIGC
    Globals g;

    int width  = g.values().res_w();
    int height = g.values().res_h();
    int half   = width / 2;
    int quarter= half / 2;

    // create buttons
    m_btn_p1_head    = new PushButton("Player 1");
    m_btn_p1_up      = new PushButton("Up");
    m_btn_p1_down    = new PushButton("Down");
    m_btn_p1_left    = new PushButton("Left");
    m_btn_p1_right   = new PushButton("Right");
    m_btn_p1_drop    = new PushButton("Drop bomb");
    m_btn_p1_special = new PushButton("Special key");

    m_btn_p2_head    = new PushButton("Player 2");
    m_btn_p2_up      = new PushButton("Up");
    m_btn_p2_down    = new PushButton("Down");
    m_btn_p2_left    = new PushButton("Left");
    m_btn_p2_right   = new PushButton("Right");
    m_btn_p2_drop    = new PushButton("Drop bomb");
    m_btn_p2_special = new PushButton("Special key");

    int d = 75;

    // positions
    m_btn_p1_head    ->wnd_set_rect(quarter - 200, 100, 400, 40);
    m_btn_p1_up      ->wnd_set_rect(quarter - 100, 100 + 1*d, 200, 40);
    m_btn_p1_down    ->wnd_set_rect(quarter - 100, 100 + 2*d, 200, 40);
    m_btn_p1_left    ->wnd_set_rect(quarter - 100, 100 + 3*d, 200, 40);
    m_btn_p1_right   ->wnd_set_rect(quarter - 100, 100 + 4*d, 200, 40);
    m_btn_p1_drop    ->wnd_set_rect(quarter - 100, 100 + 5*d, 200, 40);
    m_btn_p1_special ->wnd_set_rect(quarter - 100, 100 + 6*d, 200, 40);

    m_btn_p2_head    ->wnd_set_rect(3*quarter - 200, 100, 400, 40);
    m_btn_p2_up      ->wnd_set_rect(3*quarter - 100, 100 + 1*d, 200, 40);
    m_btn_p2_down    ->wnd_set_rect(3*quarter - 100, 100 + 2*d, 200, 40);
    m_btn_p2_left    ->wnd_set_rect(3*quarter - 100, 100 + 3*d, 200, 40);
    m_btn_p2_right   ->wnd_set_rect(3*quarter - 100, 100 + 4*d, 200, 40);
    m_btn_p2_drop    ->wnd_set_rect(3*quarter - 100, 100 + 5*d, 200, 40);
    m_btn_p2_special ->wnd_set_rect(3*quarter - 100, 100 + 6*d, 200, 40);

    // font size
    m_btn_p1_head    ->set_font_size(24, 24);
    m_btn_p1_up      ->set_font_size(16, 16);
    m_btn_p1_down    ->set_font_size(16, 16);
    m_btn_p1_left    ->set_font_size(16, 16);
    m_btn_p1_right   ->set_font_size(16, 16);
    m_btn_p1_drop    ->set_font_size(16, 16);
    m_btn_p1_special ->set_font_size(16, 16);

    m_btn_p2_head    ->set_font_size(24, 24);
    m_btn_p2_up      ->set_font_size(16, 16);
    m_btn_p2_down    ->set_font_size(16, 16);
    m_btn_p2_left    ->set_font_size(16, 16);
    m_btn_p2_right   ->set_font_size(16, 16);
    m_btn_p2_drop    ->set_font_size(16, 16);
    m_btn_p2_special ->set_font_size(16, 16);

    // text alignment
/*    m_btn_p1_head    ->set_text_alignment(TAL_CENTER);
    m_btn_p1_up      ->set_text_alignment(TAL_LEFT);
    m_btn_p1_down    ->set_text_alignment(TAL_LEFT);
    m_btn_p1_left    ->set_text_alignment(TAL_LEFT);
    m_btn_p1_right   ->set_text_alignment(TAL_LEFT);
    m_btn_p1_drop    ->set_text_alignment(TAL_LEFT);
    m_btn_p1_special ->set_text_alignment(TAL_LEFT);

    m_btn_p2_head    ->set_text_alignment(TAL_CENTER);
    m_btn_p2_up      ->set_text_alignment(TAL_LEFT);
    m_btn_p2_down    ->set_text_alignment(TAL_LEFT);
    m_btn_p2_left    ->set_text_alignment(TAL_LEFT);
    m_btn_p2_right   ->set_text_alignment(TAL_LEFT);
    m_btn_p2_drop    ->set_text_alignment(TAL_LEFT);
    m_btn_p2_special ->set_text_alignment(TAL_LEFT);
*/

    m_btn_p1_up      ->set_border_type(BT_MOUSE_OVER);
    m_btn_p1_down    ->set_border_type(BT_MOUSE_OVER);
    m_btn_p1_left    ->set_border_type(BT_MOUSE_OVER);
    m_btn_p1_right   ->set_border_type(BT_MOUSE_OVER);
    m_btn_p1_drop    ->set_border_type(BT_MOUSE_OVER);
    m_btn_p1_special ->set_border_type(BT_MOUSE_OVER);

    m_btn_p2_up      ->set_border_type(BT_MOUSE_OVER);
    m_btn_p2_down    ->set_border_type(BT_MOUSE_OVER);
    m_btn_p2_left    ->set_border_type(BT_MOUSE_OVER);
    m_btn_p2_right   ->set_border_type(BT_MOUSE_OVER);
    m_btn_p2_drop    ->set_border_type(BT_MOUSE_OVER);
    m_btn_p2_special ->set_border_type(BT_MOUSE_OVER);

    m_con_active.add(m_btn_p1_up     );
    m_con_active.add(m_btn_p1_down   );
    m_con_active.add(m_btn_p1_left   );
    m_con_active.add(m_btn_p1_right  );
//.........这里部分代码省略.........
开发者ID:mmatyas,项目名称:Atomic-Bomberman,代码行数:101,代码来源:stateconfigurekeys.cpp


注:本文中的Globals::values方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。