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


C++ Transporter::drawTransporters方法代码示例

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


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

示例1: game_loop


//.........这里部分代码省略.........
                key[keyS] = false;
                break;

                case ALLEGRO_KEY_D:
                key[keyD] = false;
                break;

                case ALLEGRO_KEY_C:
                key[keyC] = false;
                break;

                case ALLEGRO_KEY_LSHIFT:
                key[keyShift] = false;
                break;

                case ALLEGRO_KEY_SPACE:
                key[keySpace] = false;
                resetAttack(p1, stick);
                break;
            }
        }
        
        else if(event.type == ALLEGRO_EVENT_MOUSE_AXES || ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY)
        {
           crosshair_x = event.mouse.x - crosshairSize/2;
           crosshair_y = event.mouse.y - crosshairSize/2;
        }
        
        if (redraw && al_is_event_queue_empty(event_queue)) {
            redraw = false;
            //Clear screen to black
            al_clear_to_color(al_map_rgb(0, 0, 0));

            if (createCutscene == true)
            {
                al_set_target_bitmap(cutsceneBackdrop);
                al_clear_to_color(al_map_rgb(0, 0, 0));
            }

            //update_graphics();
            //graphics that will always be there
            if (!inCutscene)
            {
                drawDungeon(floorArray,currentRoom.walkArray);
                drawDungeon(floorArray,currentRoom.collideArray);
                for (int i = 0; i < 16; i++)
                {
                    for (int j = 0; j < 16; j++)
                    {
                        al_draw_textf(font, al_map_rgb(255,255,255),j*tileSize,i*tileSize,ALLEGRO_ALIGN_LEFT,"%d,%d",j+1,i+1);
                    }
                }

                if (transDebug) currentTrans.drawTransporters(currentArray.array);
                drawMonsters(currentMonsters);
                
                if (p1.getDir() != UP && p1.getDir() != LEFT)
                {
                    if (p1.blinking == false)
                    {
                        drawPlayer(p1);
                    }
                }
                drawWeapon(p1,stick);

                if (p1.getDir() == UP || p1.getDir() == LEFT)
                {
                    if (p1.blinking == false)
                    {
                        drawPlayer(p1);
                    }
                }

                al_draw_textf(font, al_map_rgb(255,255,255),0,tileSize*0,ALLEGRO_ALIGN_LEFT,"playerHP: %d",p1.getCurrentHP());
                for (int i = 1; i < numMonsters; i++)
                {
                    if (currentMonsters[i].getCurrentHP() > -10000 && currentMonsters[i].getCurrentHP() <10000)
                    {
                        al_draw_textf(font, al_map_rgb(255,255,255),tileSize * 4 * i,tileSize*15,ALLEGRO_ALIGN_LEFT,"monster %d HP: %d",i,currentMonsters[i].getCurrentHP());
                    }
                }
            }
            if (inCutscene)
            {
                currentCutscene.drawCutscene(1, 1);
            }
            //al_draw_bitmap(crosshair, crosshair_x, crosshair_y, 0);

            if (createCutscene == true)
            {
                inCutscene = true;
                createCutscene = false;
                al_set_target_bitmap(al_get_backbuffer(display));
                //al_lock_bitmap(cutsceneBackdrop);
                inCutscene = true;
            }
            al_flip_display();
        }
    }
}
开发者ID:apdisant,项目名称:AllegroGameProgramming,代码行数:101,代码来源:main.cpp


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