Пример #1
0
void SelectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    Q_UNUSED(option);
    Q_UNUSED(widget);

    // delay load song info
    loadSong();

    QRectF rect = boundingRect().adjusted(BAR_PAD,BAR_PAD,0 - BAR_PAD,0 - BAR_PAD);

    // draw header
    QRectF rectHead = QRectF(rect.topLeft(),QSizeF(rect.width(),HEAD_HEIGHT));
    painter->fillRect(rectHead,backColor_);

    // draw body
    QRectF rectBody = QRectF(rectHead.bottomLeft(),QSizeF(rect.width(),rect.height() - HEAD_HEIGHT));
    painter->drawPixmap(
                rectBody.left(),rectBody.top(),
                barLeftPixmap_.width(),rectBody.height(),
                barLeftPixmap_);
    painter->drawPixmap(
                rectBody.right() - barRightPixmap_.width(),rectBody.top(),
                barRightPixmap_.width(),rectBody.height(),
                barRightPixmap_);
    painter->drawPixmap(
                rectBody.left() + barLeftPixmap_.width(),rectBody.top(),
                rectBody.width() - barLeftPixmap_.width() - barRightPixmap_.width(),rectBody.height(),
                barMidPixmap_);

    rectBody.adjust(BAR_MARGIN,BAR_MARGIN,0 - BAR_MARGIN,0 - BAR_MARGIN);

    painter->setFont(QFont(Ts::GUI_FONT_NAME,15));
    if (rect_.width() == Ts::BAR_EXPAND)
    {
        painter->setPen(foreColor_);
        painter->drawText(rectHead,Qt::AlignCenter,QString("%1/%2").arg(index_).arg(total_));

        painter->setPen(Qt::black);
        painter->drawText(
                    rectBody.right() - 30,rectBody.top(),30,rectBody.height(),
                    Qt::AlignHCenter,title_);
        painter->drawText(
                    rectBody.right() - 60,rectBody.top(),30,rectBody.height(),
                    Qt::AlignHCenter | Qt::AlignBottom,subTitle_);

        // show courses
        courses_.show();

    }
    else
    {
        painter->setPen(foreColor_);
        painter->drawText(rectHead,Qt::AlignCenter,QString::number(index_));

        painter->setPen(Qt::black);
        painter->drawText(rectBody,Qt::AlignCenter,title_);

        courses_.hide();
    }
}
Пример #2
0
void playerGameover(Game* game)
{
    if(game->doGameover == 1){
        int i;
        char text[200];

        sprintf(text, "Press ENTER");
        loadSong(1,"data/sounds/gameover.mp3",game);

        while(game->input->enter == 0)
        {
        i = SDL_GetTicks();

        drawImage(game->gameover,0,0, game);
        drawString(text, 350, 400, 150, 150, 150, game->fontGameover,game);
        SDL_Flip(game->screen);
        while(SDL_GetTicks()-i != 500 && game->input->enter == 0)
        getInput(game->input,game);
        drawImage(game->gameover,0,0, game);
        SDL_Flip(game->screen);
        while(SDL_GetTicks()-i != 1000 && game->input->enter == 0)
        getInput(game->input,game);

        }
        game->input->enter = 0;

        loadGame(game);
        initializePlayer(game->player);

    }

}
Пример #3
0
void HiRes5Engine::init() {
	_graphics = new Graphics_v3(*_display);

	insertDisk(2);

	StreamPtr stream(_disk->createReadStream(0x5, 0x0, 0x02));
	loadRegionLocations(*stream, kRegions);

	stream.reset(_disk->createReadStream(0xd, 0x2, 0x04));
	loadRegionInitDataOffsets(*stream, kRegions);

	stream.reset(_disk->createReadStream(0x7, 0xe));
	_strings.verbError = readStringAt(*stream, 0x4f);
	_strings.nounError = readStringAt(*stream, 0x8e);
	_strings.enterCommand = readStringAt(*stream, 0xbc);

	stream.reset(_disk->createReadStream(0x7, 0xc));
	_strings.lineFeeds = readString(*stream);

	stream.reset(_disk->createReadStream(0x8, 0x3, 0x00, 2));
	_strings_v2.saveInsert = readStringAt(*stream, 0x66);
	_strings_v2.saveReplace = readStringAt(*stream, 0x112);
	_strings_v2.restoreInsert = readStringAt(*stream, 0x180);
	_strings.playAgain = readStringAt(*stream, 0x247, 0xff);

	_messageIds.cantGoThere = 110;
	_messageIds.dontUnderstand = 112;
	_messageIds.itemDoesntMove = 114;
	_messageIds.itemNotHere = 115;
	_messageIds.thanksForPlaying = 113;

	stream.reset(_disk->createReadStream(0xe, 0x1, 0x13, 4));
	loadItemDescriptions(*stream, kItems);

	stream.reset(_disk->createReadStream(0x8, 0xd, 0xfd, 1));
	loadDroppedItemOffsets(*stream, 16);

	stream.reset(_disk->createReadStream(0xb, 0xa, 0x05, 1));
	loadItemPicIndex(*stream, kItems);

	stream.reset(_disk->createReadStream(0x7, 0x8, 0x01));
	for (uint i = 0; i < kItems; ++i)
		_itemTimeLimits.push_back(stream->readByte());

	if (stream->eos() || stream->err())
		error("Failed to read item time limits");

	stream.reset(_disk->createReadStream(0x8, 0x2, 0x2d));
	_gameStrings.itemTimeLimit = readString(*stream);

	stream.reset(_disk->createReadStream(0x8, 0x7, 0x02));
	_gameStrings.carryingTooMuch = readString(*stream);

	stream.reset(_disk->createReadStream(0xc, 0xb, 0x20));
	loadSong(*stream);
}
Пример #4
0
void endLevel(Game* game)
{

    int i;
    char text[200];


    sprintf(text, "Press ENTER to CONTINUE");
    loadSong(1,"data/music/Victory Theme (Faded).mp3",game);


    while(game->input->enter == 0)
    {
    i = SDL_GetTicks();

    drawImage(game->endLevel,0,0, game);
    drawString(text, 160, 560, 250, 250, 250, game->fontGameover,game);
    SDL_Flip(game->screen);
    while(SDL_GetTicks()-i != 500 && game->input->enter == 0)
    getInput(game->input, game);
    drawImage(game->endLevel,0,0, game);
    SDL_Flip(game->screen);
    while(SDL_GetTicks()-i != 1000 && game->input->enter == 0)
    getInput(game->input,game);

    }
    game->input->enter = 0;

    if(game->level <= LEVEL_MAX){

        initializePlayer(game->player);
        loadGame(game);
    }

    else{

        game->level = 1;
        loadGame(game);
        game->onMenu = 1;
        game->menuType = START;
    }
}
Пример #5
0
/* fonction qui permet de charger le jeu*/
void loadGame(void)
{
    map.background = loadImage("graphics/BGMenu.png");
    map.background2 = loadImage("graphics/BGgameover.png");
    map.tileSet = loadImage("graphics/BG2.png");
    map.missionDone = loadImage("graphics/missionDone.png");

    loadMap("map/map2.txt");

    jeu.vies = 3;
    jeu.score = 0;

    jeu.Icone_vie = loadImage("graphics/lifeSlug.png");
    jeu.Score_Icone = loadImage("graphics/score2.png");

    jeu.bouleFeu_image = loadImage("graphics/bullet.png");

    loadSong("music/Airship.mp3");

    loadSound();

    jeu.onMenu = 1;
    jeu.menuType = START;
}