GameBoard::GameBoard(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::GameBoard)
{
    image_part = QSize(32.0,32.0);
    //画像読み込み
    ReloadTexture(GameSystem::Texture::Light);
    ui->setupUi(this);
    for(int i = 0; i < TEAM_COUNT; i++){
        this->team_score[i] = 0;
    }
    leave_items = 0;
}
Example #2
0
void EditorUI::menuSetSpringDir()
{
    const char *r = fltk::input ("Enter S3O texture loading directory (for example c:\\games\\spring\\unittextures)", Texture::textureLoadDir.c_str());
    if (r) {
        Texture::textureLoadDir = r;
        string& tld = Texture::textureLoadDir;

        if (tld.rfind ('/') != tld.length () - 1 && tld.rfind ('\\') != tld.length () - 1)
            tld.push_back ('/');

        for (int a=0; a<2; a++)
            if (!model->textureNames[a].empty()) ReloadTexture(a);
    }
}
void GameBoard::setMap(const GameSystem::Map& map){
    field = map;
    this->texture = map.texture;
    ReloadTexture(texture);

    for(int i=0;i<TEAM_COUNT;i++){
        team_pos[i] = field.team_first_point[i];
    }
    map_height = field.field.size();
    map_width  = field.field[0].size();
    //オーバーレイ初期化
    overlay.resize(map_height);
    for(auto& v : overlay)v = QVector<GameSystem::MAP_OVERLAY>(map_width,GameSystem::MAP_OVERLAY::NOTHING);
    field.discover.resize(map_height);
    for(auto& v : field.discover)v = QVector<GameSystem::Discoverer>(map_width,GameSystem::Discoverer::Cool);
}
void GameBoard::resizeEvent(QResizeEvent *event){

    //常に同じアスペクト比になるようにする

    //int p = MIN(event->size().width(),event->size().height());
    //resize(p,p);

    //event->ignore();
    /*
    resize(event->size().height(),event->size().height());
    this->setMinimumSize(event->size().height(),event->size().height());
    */
    image_part.setWidth (static_cast<float>(event->size().width()) / field.size.x());
    image_part.setHeight(static_cast<float>(event->size().height()) / field.size.y());

    ReloadTexture(texture);
}
Example #5
0
void DrawOverlay( PTRANSFORM camera )
{
	if( l.active_ball && ( l.active_ball_forward_tick && ( l.active_ball_forward_tick < l.last_tick ) ) )
	{
		int bound = 0;
		int n;
		VECTOR corners[4];
		VECTOR out_corners[4];

		corners[0][0] = -512;
		corners[0][1] = 768/2;
		corners[0][2] = l.identity_depth[0]/2;
		corners[1][0] = 512;
		corners[1][1] = 768/2;
		corners[1][2] = l.identity_depth[0]/2;
		corners[2][0] = 512;
		corners[2][1] = -768/2;
		corners[2][2] = l.identity_depth[0]/2;
		corners[3][0] = -512;
		corners[3][1] = -768/2;
		corners[3][2] = l.identity_depth[0]/2;

		if( fl.flashdrive_global )
		{
			if( l.player_image )
				if( l.active_ball == fl.flashdrive_global->default_stream->player_appreciation_ball )
				{
					bound = 1;
					glBindTexture( GL_TEXTURE_2D, ReloadTexture( l.player_image, 0 ) );
					/* show player_ball overlay */
				}
			{
				INDEX idx;
				for( idx = 0; idx < fl.flashdrive_global->default_stream->nHotBalls; idx++ )
				{
					if( !l.hotball_image[idx] )
						continue;
					if( l.active_ball == fl.flashdrive_global->default_stream->hot_ball_order[idx] )
					{
						/* handle an offset?  Troll Ball Image? */
						/* show hotball X overlay */
						bound = 1;
						glBindTexture( GL_TEXTURE_2D, ReloadTexture( l.hotball_image[idx], 0 ) );
						break;
					}
				}
			}
			if( l.wild_image )
				if( TESTFLAG( fl.flashdrive_global->default_stream->marked, l.active_ball ) )
				{
					if( l.active_ball != fl.flashdrive_global->default_stream->ball_order[fl.flashdrive_global->default_stream->nBallsCalled-1] )
					{
						/* show wild overlay */
						bound = 1;
						glBindTexture( GL_TEXTURE_2D, ReloadTexture( l.wild_image, 0 ) );
					}
				}
		}
		if( bound )
		{
#ifndef __ANDROID__
			for( n = 0; n < 4; n++ )
				Apply( camera, out_corners[n], corners[n] );
			glDisable( GL_DEPTH );
			glDisable( GL_DEPTH_TEST );
			glBegin( GL_QUADS );
			for( n = 0; n < 4; n++ )
			{
				glColor3d( 1.0, 1.0, 1.0 );

				glTexCoord2d( n==0?0
					:n==1?1
					:n==2?1
					:n==3?0:0
					,  n==0?0
					:n==1?0
					:n==2?1
					:n==3?1:0 );
				glVertex3fv( out_corners[n] );
			}
			glEnd();
#endif
		}

	}
}
Example #6
0
/***********************************************************
Constructor
***********************************************************/
TextWritter::TextWritter()
: _initialized(false)
{
	ReloadTexture();
}