Beispiel #1
0
void BriefMenu::handleTick(int elapsed)
{
    if (g_Session.updateTime(elapsed)) {
        updateClock();
    }
    drawMinimap(elapsed);
}
Beispiel #2
0
void display()
{
	drawMainView();
	drawMinimap();

	/*glViewport(0,0,VIEWPORT_W/2,VIEWPORT_H/2);
	glutSolidCone(10,10,10,10);

	glViewport(0,0,VIEWPORT_W,VIEWPORT_H);*/

	glutSwapBuffers();

}
void SistemWindowView::draw() {
	int viewWidth = viewMax.getX() - viewMin.getX();
	int viewHeight = viewMax.getY() - viewMin.getY();
	int windowWidth = windowMax.getX() - windowMin.getX();
	int windowHeight = windowMax.getY() - windowMin.getY();
	float ratio_x = (float)viewWidth/windowWidth;
	float ratio_y = (float)viewHeight/windowHeight;
	point move1(-windowMin.getX(),-windowMin.getY());
	point move2(viewMin.getX(),viewMin.getY());

	map.clip(windowMin,windowMax)
		.hasilGeser(move1)
		.hasilSkala(ratio_x,ratio_y)
		.hasilGeser(move2).draw();

	drawMinimap();
}
Beispiel #4
0
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
                    nextline = strchr(nextline + 1, '\x0a');
                while (nextline
                        && (nextline[0] != '\x0a' || nextline[1] != '\x0a'));

                if (*miss == ' ')
                    miss++;

                if (nextline == NULL)
                    nextline = miss + strlen(miss);

                while (strchr(miss, '\x0a')
                       && strchr(miss, '\x0a') < nextline) {
                    *strchr(miss, '\x0a') = ' ';
                }
            }
            else
                getOption(nextButId_)->setVisible(false);
        } while (miss && *miss && line_count < start_line_ + 14);

        free(mbriefing);        // using free because allocated this
    }
#ifdef EXECUTION_SPEED_TIME
    printf("+++++++++++++++++++++++++++");
    printf("end time %i.%i\n", SDL_GetTicks()/1000, SDL_GetTicks()%1000);
#endif
    // NOTE: enhance levels: 0 = 10px(5), 1 = 8px(4), 2 = 6px(3), 3 - 4px(2),
    // 4 - 2px(1) + enemy peds; x = 502(251), y = 218(109), 124x124(62x62)
    // 640x400(320x200), (504, 220) = (252, 110)
    // g_Screen.scale2x(10, 100, pMission->mmax_x_, pMission->mmax_y_,
    //     pMission->minimap_overlay_,0, false);

    drawMinimap(0);
}