Ejemplo n.º 1
0
void DrawingBezier::calculateBezier()
{
	vertices.clear();
	for(int i = 0; i<= resolution; ++i)
	{
		float percentage = 1/resolution*i;
		sf::Vector2f tmp = CalculateBezier3th(start,firstpoint,secondpoint,end,percentage);
		sf::Vertex toadd(tmp,color);
		vertices.push_back(toadd);
	}
}
CParseDsrSymbolTable::CParseDsrSymbolTable( int is_local ) :
	m_table( 64, 0, 64 ), m_used_xvar( 16, 0, 16 ), m_used_dxvar( 16, 0, 16 )
{
	static LDsr2Var kdfa;
	m_infile = _T("");
	m_is_local = is_local;
	m_var_number = 1;
	m_fun_number = 1;
	if( !is_local )
	{
		CParseDsrSymbol toadd( _T(""), SMBTABLE_TYPE_KEYWORD );
		for( long i = kdfa.getKeywordStartIdx(); i < kdfa.getKeywordNumber(); i++ )
		{
			toadd.name = kdfa.getKeyword( i );
			toadd.setDataType( getTypeTable().makeDataTypeNode( DSRDATA_TYPE_KEYWORD ) );
			Add( toadd );
		}
		::ml_InitOperatorSmbTable( this );
		::ml_InitFunctionSmbTable( this );
		::ml_InitFormulaSmbTable( this );
		::ml_InitConstSmbTable( this );
		setMessanger();
	}
}
Ejemplo n.º 3
0
void TextureManager::addNewTexture(const std::string path) {
    raw_texture* newtexture = loadFromFile(path);
    std::pair<std::string, raw_texture*> toadd(path, newtexture);
    texturemap.insert(toadd);
}
Ejemplo n.º 4
0
//convert current clock time into a displayable value
SDL_Surface* timeToSurface(Uint32 clock, TTF_Font* font)
{
    Uint32 milli = 0;
    Uint32 sec = 0;
    Uint32 min = 0;
    Uint32 hour = 0;
    Uint32 days = 0;
    std::string output("");
    char buffer[80];
    std::string toadd("");
    SDL_Color textColor = { 0xFF, 0xFF, 0x00 };




    milli = clock % 1000; //grab millisecond units
    clock = clock / 1000; //scrap milliseconds
    itoa(milli/10,buffer,10);
    toadd = buffer;
    output = "" + toadd;

    if(clock > 0) //check if there are seconds
    {
        sec = clock % 60; //grab seconds
        clock = clock / 60; //scrap seconds
        itoa(sec,buffer,10);
        toadd = buffer;

        output = "" + toadd + ":" + output;

        if(clock > 0)
        {
            min = clock % 60;
            clock = clock / 60;
            itoa(min,buffer,10);
            toadd = buffer;

            output = "" + toadd + ":" + output;

            if(clock > 0)
            {
                hour = clock % 24;
                clock = clock / 24;
                itoa(hour,buffer,10);
                toadd = buffer;

                output = "" + toadd + ":" + output;

                if(clock > 0)
                {
                    days = clock % 7;
                    clock = days / 7;
                    itoa(days,buffer,10);
                    toadd = buffer;

                    output = "" + toadd + ":" + output;
                }
            }
        }
    }
    output = "Time: " + output;
    return TTF_RenderText_Solid(font,output.c_str(),textColor);


}