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


C++ Mission::briefing方法代码示例

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


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

示例1: handleRender

void BriefMenu::handleRender() {

    g_Screen.drawLogo(18, 14, g_Session.getLogo(), g_Session.getLogoColour());

    Mission *pMission = g_Session.getMission();

    // write briefing
#ifdef EXECUTION_SPEED_TIME
    printf("---------------------------");
    printf("start time %i.%i\n", SDL_GetTicks()/1000, SDL_GetTicks()%1000);
#endif
    if (pMission->briefing()) {
        int sizeStr = strlen(pMission->briefing()) + 2;
        char *mbriefing = (char *)malloc(sizeStr);
        assert(mbriefing != NULL);
        strcpy(mbriefing, pMission->briefing());
        char *miss = mbriefing;
        char *nextline = miss - 1;

        do
            nextline = strchr(nextline + 1, '\x0a');
        while (nextline && (nextline[0] != '\x0a' || nextline[1] != '\x0a'));

        int line_count = 0;
        int lvls = 0;

        do {
            if (nextline) {
                char *tmp = new char[nextline - miss + 1];

                do {
                    memcpy(tmp, miss, nextline - miss);
                    tmp[nextline - miss] = 0;
                    nextline--;
                } while (g_App.fonts().textWidth(tmp, FontManager::SIZE_2) > 470);

                delete[] tmp;
                /* is this faster?
                char tmp;
                bool found;

                do {
                    tmp = *nextline;
                    *nextline = 0;
                    found = g_App.fonts().textWidth(miss, FontManager::SIZE_2) > 470;
                    *nextline = tmp;
                    nextline--;
                } while (found);
                */

                nextline++;

                while (nextline[0] != '\x0a' && nextline[0] != ' '
                       && nextline[0] != 0) {
                    nextline--;
                }
            }

            if (*miss == '|') {
                lvls++;

                if (lvls > g_Session.getSelectedBlock().infoLevel) {
                    getOption(nextButId_)->setVisible(false);
                    break;
                }

                nextline = miss + 1;
            }
            else {
                if (line_count >= start_line_) {
                    char tmp = 0;

                    if (nextline) {
                        tmp = *nextline;
                        *nextline = 0;
                    }

                    g_App.fonts().drawText(24,
                                           88 + (line_count -
                                                 start_line_) * 16, miss,
                                                 FontManager::SIZE_2, false);
                    if (nextline)
                        *nextline = tmp;
                }

                line_count++;
            }
            if (nextline && nextline[0] == '\x0a') {
                miss = nextline + 2;

                if (line_count != 14)
                    line_count++;
            }
            else
                miss = nextline;

            if (miss && *miss) {
                nextline = miss - 1;

                do
//.........这里部分代码省略.........
开发者ID:spippolatore,项目名称:freesynd,代码行数:101,代码来源:briefmenu.cpp


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