Exemplo n.º 1
0
void Font::drawString(Surface *dst, const Common::String &str,
                      int x, int y, int with_color, int spacing, bool markDirty) const {
    assert(dst != NULL);
    assert(x >= 0);
    assert(y >= 0);

    uint widest = getStringWidth(str, spacing);

    int curx = x + (widest - getLineWidth(str, 0, spacing)) / 2;
    int cury = y;

    for (uint i = 0; i < str.size(); ++i) {

        // If we encounter the '|' char (newline and end of string marker),
        // skip it and go to the start of the next line
        if (str[i] == '|') {
            cury += getFontHeight();
            curx = x + (widest - getLineWidth(str, i+1, spacing) - 1) / 2;
            continue;
        }

        // Break early if there's no more space on the screen
        if (curx >= dst->w - 1 || cury >= dst->h - 1) {
            break;
        }

        drawChar(dst, str[i], curx, cury, with_color);
        curx += getCharWidth(str[i]) + spacing;
    }

    if (markDirty) {
        Common::Rect r(x, y, x + widest, y + getStringHeight(str));
        dst->markDirtyRect(r);
    }
}
//ensure the surface is large enough
void drawContextFltkStringTexture::drawString(const char *str)
{
  GLfloat pos[4], color[4];
  glGetFloatv(GL_CURRENT_RASTER_POSITION, pos);
  glGetFloatv(GL_CURRENT_COLOR, color);
  queueString::element elem = {str, pos[0], pos[1], pos[2], color[0], color[1], color[2], color[3],
    _currentFontSize, _currentFontId, getStringWidth(str) + 1, getStringHeight()};
  _queue->append(elem);
}
void Matrix::writeString(char* _c, bool _m, uint16_t _t, int16_t _xy) {
  setFontMode(_m);
  int c1 = (_m ? getWidth() : getHeight()) * 8;
  int c2 = -(_m ? getStringWidth(_c) : getStringHeight(_c))  - c1;
  for (int a = c1; a > c2; a--) {
    setCursor((_m ? a : _xy), (_m ? _xy : a));
    print(_c);
    delay(_t);
#ifdef WDT
    wdt_reset();
#endif
  }
}
Exemplo n.º 4
0
void SmushFont::drawString(const char *str, byte *buffer, int dst_width, int dst_height, int x, int y, bool center) {
	debugC(DEBUG_SMUSH, "SmushFont::drawString(%s, %d, %d, %d)", str, x, y, center);

	while (str) {
		char line[256];
		char *pos = (char *)strchr(str, '\n');
		if (pos) {
			memcpy(line, str, pos - str - 1);
			line[pos - str - 1] = 0;
			str = pos + 1;
		} else {
			strcpy(line, str);
			str = 0;
		}
		drawSubstring(line, buffer, dst_width, center ? (x - getStringWidth(line) / 2) : x, y);
		y += getStringHeight(line);
	}
}
Exemplo n.º 5
0
CCMutableArray<StringLabel*>* TagString::parse( bool useTag )
{
    string cut = "";
    int start_idx = 0;
    
    float zen_width = 0;

    
    // 全角幅を取得
    {
        StringLabel* label_zen = StringLabel::init( "1", ccc3(0,0,0), baseFontSize );

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
        zen_width = (int)(label_zen->getContentSize().width);
#else
        zen_width = label_zen->getContentSize().width;
#endif
    }
    

    
    /////////////////////////////////////////////
    // 変数タグの置換
    start_idx = 0;
    
    for( ;; )
    {
        int tag_start1 = tagStr.find( "<param=", start_idx );
        if( tag_start1 == string::npos ) break;
        
        int tag_start2 = tagStr.find( ">", tag_start1 );
        
        string param_str = tagStr.substr( tag_start1+7, tag_start2-(tag_start1+7) );
        
        // 変数の値取得
        string value = ParamList::shared()->getValue( param_str );
        
        if( !value.empty() )
        {
            // 文字列の置換
            tagStr.replace( tag_start1, tag_start2-tag_start1+1, value );
            start_idx = 0;
            continue;
        }
        
        start_idx = tag_start2 + 1;
    }
    
    //tagStr->getStringWidth()
      
    /////////////////////////////////////////////
    // 自動改行チェック
    if( autoKaigyouFlg )
    {
        vector< string > list = StringComparator::comparate( tagStr );
        
        bool tag_start = false;

        float total_size = 0;
        
        string conv_str = "";
        
        for( int i = 0; i < list.size(); i++ )
        {
            if (useTag)
            {
                if( list[i] == "<" )
                {
                    tag_start = true;
                }
                
                if( list[i] == ">" )
                {
                    tag_start = false;
                    conv_str.append( list[i] );
                    continue;
                }
            
                if( tag_start )
                {
                    // 改行チェック
                    if( list[i] == "b" )
                    {
                        if( list[i+1] == "r" )
                        {
                            total_size = 0;
                        }
                    }
                    
                    conv_str.append( list[i] );
                    continue;
                }
            }
            
            float strw = 0;

            // 半角
            if( list[i].length() == 1 )
            {
                StringLabel* label = StringLabel::init( list[i].c_str(), ccc3(0,0,0), baseFontSize );
                strw = label->getContentSize().width;
            }
            // 全角
            else
            {
                strw = zen_width;
            }
            
            
            total_size += strw;
            
            // 改行を挿入
            if( width > 0 && total_size > width )
            {
                //CCLog( "kaigyou2 total_size=%d", total_size );
                
                // 改行コードを入れる
                conv_str.append( "<br>" );
                total_size = strw;
            }

            else
            {
                if (list[i] == "\n")  total_size = 0;
            }
            conv_str.append( list[i] );
            
            
        }
        
        tagStr = conv_str;
    }
  
    
    /////////////////////////////////////////////
    // 改行、カラー、フォントサイズ、アンカー解析
   
    int line = 0;
    
    start_idx = 0;
    
    int active_anchor = 0;
    int active_font_size = baseFontSize;
    ccColor3B active_color = baseColor;
    
    //CCLog( "tag_str=%s", tagStr.c_str() );

    bool brflg = false;

    for( ;; )
    {
        
        // 開始タグ判定
        int tag_start = tagStr.find( "<", start_idx );
        

        if( tag_start != string::npos && useTag )
        {
            //  表示文字列を取得
            cut = tagStr.substr( start_idx, tag_start - (start_idx) );
            
            //CCLog( "cut=%s actuve=%d", cut.c_str(), active_anchor );
            
            if( !cut.empty() || brflg )
            {
                parseList->addObject( new ColorString( cut, active_color, active_font_size, line, active_anchor ) );
            }
            
                
            int tag_close = tagStr.find( ">", tag_start );
            
            // タグ文字列取得
            string param_str = tagStr.substr( tag_start+1, tag_close-(tag_start+1) );
            
            // アンカー
            if( param_str.find( "left" ) != string::npos )
            {
                active_anchor = ALIGN_LEFT;
            }
        
            if( param_str.find( "center" ) != string::npos )
            {
                active_anchor = ALIGN_CENTER;
            }
            
            if( param_str.find( "right" ) != string::npos )
            {
                active_anchor = ALIGN_RIGHT;
            }
            
            // 改行
            if( param_str.find( "br" ) != string::npos )
            {
                line += 1;
                brflg = true;
            }
                
            // カラー設定
            if( param_str.find( "color=" ) != string::npos )
            {
                // 色情報の切り出し
                string color_str = param_str.substr( 6, param_str.length()-6 );
                
                // 色成分に分解
                char *csv = const_cast<char*>( color_str.c_str() );
                int red   = CommonUtils::StrToInt( strtok(  csv, ":" ) );
                int green = CommonUtils::StrToInt( strtok( NULL, ":" ) );
                int blue  = CommonUtils::StrToInt( strtok( NULL, ":" ) );
                
                active_color = ccc3( red, green, blue );
                
            }
            
            // フォントサイズ
            if( param_str.find( "size=" ) != string::npos )
            {
                string size_str = param_str.substr( 5, param_str.length()-5 );
                
                active_font_size = CommonUtils::StrToInt( size_str );
            }
            
            // カラー 終了タグ
            if( param_str.find( "/color" ) != string::npos )
            {
                active_color = baseColor;
            }

            // アンカー 終了タグ
            if( param_str.find( "/center" ) != string::npos )
            {
                active_anchor = ALIGN_LEFT;
            }
            
            if( param_str.find( "/right" ) != string::npos )
            {
                active_anchor = ALIGN_LEFT;
            }
            
            // フォントサイズ 終了タグ
            if( param_str.find( "/size" ) != string::npos )
            {
                active_font_size = baseFontSize;
            }
            
            start_idx = tag_close + 1;
        }
        
        else
        {
            /*
            for( ;; )
            {
                // 改行コードがある場合
                tag_start = tagStr.find( "\n", start_idx );
                if (tag_start != string::npos)
                {
                    //  表示文字列を取得
                    cut = tagStr.substr( start_idx, tag_start - (start_idx) );
                    
                    if( !cut.empty() )
                    {
                        parseList->addObject( new ColorString( cut, active_color, active_font_size, line, active_anchor ) );
                        line += 1;
                    }
                    start_idx = tag_start + 1;
                }
                else
                {
                    break;
                }
            }
            */
            cut = tagStr.substr( start_idx, tagStr.length() - (start_idx) );
            
            if( !cut.empty() )
            {
                //CCLog( "cut=%s", cut.c_str() );
                
                parseList->addObject( new ColorString( cut, active_color, active_font_size, line, active_anchor ) );
            }
            
            break;
        }
        
    }
    

    
    int linecnt = getLineCount();
    
    float basex = 0;
    float basey = 0;
    
    
    
    // アライン設定
    if( baseAlign == TEXT_ALIGN_CENTER_TOP )
    {
        basex = ( ( width - getStringWidth() )/2 );
    }
    
    if( baseAlign == TEXT_ALIGN_RIGHT_TOP )
    {
        basex = width - getStringWidth();
    }
    
    if( baseAlign == TEXT_ALIGN_LEFT_MIDDLE )
    {
        basey = ( ( height - getStringHeight() )/2 );
    }
    
    if( baseAlign == TEXT_ALIGN_CENTER_MIDDLE )
    {
        basex = ( ( width  - getStringWidth()  )/2 );
        basey = ( ( height - getStringHeight() )/2 );
    }
    
    if( baseAlign == TEXT_ALIGN_RIGHT_MIDDLE )
    {
        basex = width - getStringWidth();
        basey = ( ( height - getStringHeight() )/2 );
    }
    
    if( baseAlign == TEXT_ALIGN_CENTER_BOTTOM )
    {
        basex = ( ( width  - getStringWidth()  )/2 );
        basey = height - getStringHeight();
    }
    
    if( baseAlign == TEXT_ALIGN_RIGHT_BOTTOM )
    {
        basex = width - getStringWidth();
        basey = height - getStringHeight();
    }
    
    if( baseAlign == TEXT_ALIGN_LEFT_BOTTOM )
    {
        basey = height - getStringHeight();
    }
    
    float dispx = basex;
    float dispy = basey;
    
    // 返却用のリスト
    CCMutableArray<StringLabel*>* ret = new CCMutableArray<StringLabel*>;
    ret->autorelease();
    
    // ラベルを生成
    for( int i = 0; i < linecnt; i++ )
    {
        CCMutableArray<ColorString*> *list = getStringList( i );
        
        float lh = getStringLineHeight( i );
        float lw = getStringLineWidth( i );
        
        // 下合わせ
        dispy += lh;
        
        for( int j = 0; j < list->count(); j++ )
        {
            ColorString* cstr = list->getObjectAtIndex( j );
            
            // アライン
            if( j == 0 )
            {
                if( cstr->getAlign() == ALIGN_LEFT   ) dispx = 0;
                if( cstr->getAlign() == ALIGN_CENTER ) dispx = ((width-lw)/2);
                if( cstr->getAlign() == ALIGN_RIGHT  ) dispx = width - lw;
            }    
            
            // テキストを設定
            StringLabel* label = cstr->getStrLabel();
            
            label->setAlign( TEXT_ALIGN_LEFT_BOTTOM );
            //label->setPosition( dispx, dispy );
            label->setOffsetX( dispx );
            label->setOffsetY( dispy );
            
            ret->addObject( label );
            
            // ラベルサイズ取得
            CCSize size = label->getContentSize();
            dispx += size.width;
        }
        
        dispx  = basex;
    }
    
    
    return ret;
    
    
    
    
}
Exemplo n.º 6
0
void SmushFont::drawStringWrap(const char *str, byte *buffer, int dst_width, int dst_height, int x, int y, int left, int right, bool center) {
	debugC(DEBUG_SMUSH, "SmushFont::drawStringWrap(%s, %d, %d, %d, %d, %d)", str, x, y, left, right, center);

	const int width = right - left;
	char *s = strdup(str);
	char *words[MAX_WORDS];
	int word_count = 0;

	char *tmp = s;
	while (tmp) {
		assert(word_count < MAX_WORDS);
		words[word_count++] = tmp;
		tmp = strpbrk(tmp, " \t\r\n");
		if (tmp == 0)
			break;
		*tmp++ = 0;
	}

	int i = 0, max_width = 0, height = 0, line_count = 0;

	char *substrings[MAX_WORDS];
	int substr_widths[MAX_WORDS];
	const int space_width = getCharWidth(' ');

	i = 0;
	while (i < word_count) {
		char *substr = words[i++];
		int substr_width = getStringWidth(substr);

		while (i < word_count) {
			int word_width = getStringWidth(words[i]);
			if ((substr_width + space_width + word_width) >= width)
				break;
			substr_width += word_width + space_width;
			*(words[i]-1) = ' ';	// Convert 0 byte back to space
			i++;
		}

		substrings[line_count] = substr;
		substr_widths[line_count++] = substr_width;
		if (max_width < substr_width)
			max_width = substr_width;
		height += getStringHeight(substr);
	}

	if (y > dst_height - height) {
		y = dst_height - height;
	}

	if (center) {
		max_width = (max_width + 1) / 2;
		x = left + width / 2;

		if (x < left + max_width)
			x = left + max_width;
		if (x > right - max_width)
			x = right - max_width;

		for (i = 0; i < line_count; i++) {
			drawSubstring(substrings[i], buffer, dst_width, x - substr_widths[i] / 2, y);
			y += getStringHeight(substrings[i]);
		}
	} else {
		if (x > dst_width - max_width)
			x = dst_width - max_width;

		for (i = 0; i < line_count; i++) {
			drawSubstring(substrings[i], buffer, dst_width, x, y);
			y += getStringHeight(substrings[i]);
		}
	}

	free(s);
}
Exemplo n.º 7
0
void MainWindow::resizeWidgets()
{
	int menuBarHeigth = menuBar()->height();
	//int statusBarHeight = statusBar()->height();
	int statusBarHeight = 0;
	if( statusBarVisible )
		statusBarHeight = statusBar()->height();
		
	
	int squareFrameNumOnRow = CENTRAL_TABLE_ROW_COUNT+1;
	int squareFrameNumOnColumn = CENTRAL_TABLE_COLUMN_COUNT+1;
	
	//
	//CentralTable
	//
	
	//The maximum size (width, height) what the central table can use
	//4 widget distance before 3 widget on horizontal, and between 4 free space
	int maxWidthForCentralTable = width() - SCORE_NUMBER_WIDTH - NEXT_SHAPE_TABLE_SIZE - 4*WIDGET_DISTANCE;
	int maxHeightForCentralTable = height()-menuBarHeigth-statusBarHeight;
	
	double rate = (double)(CENTRAL_TABLE_COLUMN_COUNT+squareFrameNumOnColumn)/(CENTRAL_TABLE_ROW_COUNT+squareFrameNumOnRow);
	
	int newWidth, newHeight;
	
	if( maxHeightForCentralTable*rate <= maxWidthForCentralTable ){
        newWidth = maxHeightForCentralTable*rate;
		newHeight = maxHeightForCentralTable;
    }else{
        rate = (double)CENTRAL_TABLE_ROW_COUNT/CENTRAL_TABLE_COLUMN_COUNT;
	
        newWidth = maxWidthForCentralTable;
		newHeight = maxWidthForCentralTable*rate;
    }
    
    //Remove the excess pixels
    int centralTableSquareSize = (newHeight-squareFrameNumOnRow*SQUARE_FRAME)/CENTRAL_TABLE_ROW_COUNT;
	centralTable->setSquareSize( centralTableSquareSize );
	
	newWidth = centralTableSquareSize*CENTRAL_TABLE_COLUMN_COUNT + (CENTRAL_TABLE_COLUMN_COUNT+1)*SQUARE_FRAME;
	newHeight = centralTableSquareSize*CENTRAL_TABLE_ROW_COUNT + (CENTRAL_TABLE_ROW_COUNT+1)*SQUARE_FRAME;
    
    //Central table position on x coordinate
    int centralTablePosOnX = (width()-newWidth)/2;
    
	centralTable->setGeometry( centralTablePosOnX, menuBarHeigth, newWidth, newHeight );
	
	//Position to the widgets
	QPoint pos;
	//Size to the widgets
	QSize size;
	
	//   --Left part--
	int leftFreeSpaceCenter = centralTablePosOnX / 2;
	
	
	//
	//ScoreNumberLabel
	//
	pos.setX( leftFreeSpaceCenter - getStringWidth( scoreNumberLabel->text() )/2 );
	pos.setY( menuBarHeigth );
	
	//scoreNumberLabel->move( pos );
	size.setWidth( getStringWidth( scoreNumberLabel->text() ) );
	size.setHeight( getStringHeight() );
	scoreNumberLabel->setGeometry( QRect( pos, size ) );
	
	//
	//ScoreNumber
	//
	pos.setX( leftFreeSpaceCenter - SCORE_NUMBER_WIDTH/2 );
	pos.setY( menuBarHeigth + getStringHeight() + WIDGET_DISTANCE );
	
	size.setWidth( SCORE_NUMBER_WIDTH );
	size.setHeight( SCORE_NUMBER_HEIGTH );
	
	scoreNumber->setGeometry( QRect( pos, size ) );
	
	//
	//RemovedLineLabel
	//
	pos.setX( leftFreeSpaceCenter - getStringWidth( removedLinesLabel->text() )/2 );
	pos.setY( (height() - SCORE_NUMBER_HEIGTH)/2 - getStringHeight() - WIDGET_DISTANCE );
	
	//removedLinesLabel->move( pos );
	size.setWidth( getStringWidth( removedLinesLabel->text() ) );
	size.setHeight( getStringHeight() );
	removedLinesLabel->setGeometry( QRect( pos, size ) );
	
	//
	//RemovedLineNumber
	//
	pos.setX( leftFreeSpaceCenter - REMOVED_LINES_WIDTH/2 );
	pos.setY( (height() - REMOVED_LINES_HEIGHT)/2 );
	
	size.setWidth( REMOVED_LINES_WIDTH );
	size.setHeight( REMOVED_LINES_HEIGHT );
	
	removedLinesNumber->setGeometry( QRect( pos, size ) );
	
	//
	//LevelLabel
	//
	pos.setX( leftFreeSpaceCenter - getStringWidth( levelLabel->text() )/2 );
	pos.setY( height() - statusBarHeight - LEVEL_NUMBER_HEIGHT - getStringHeight() - 2*WIDGET_DISTANCE );
	
	//levelLabel->move( pos );
	size.setWidth( getStringWidth( levelLabel->text() ) );
	size.setHeight( getStringHeight() );
	levelLabel->setGeometry( QRect( pos, size ) );
	
	//
	//LevelNumber
	//
	pos.setX( leftFreeSpaceCenter - LEVEL_NUMBER_WIDTH/2 );
	pos.setY( height() - statusBarHeight - LEVEL_NUMBER_HEIGHT - WIDGET_DISTANCE );
	
	size.setWidth( LEVEL_NUMBER_WIDTH );
	size.setHeight( LEVEL_NUMBER_HEIGHT );
	
	levelNumber->setGeometry( QRect( pos, size ) );
	
	
	//   --Right part--
	int rightFreeSpaceCenter = centralTablePosOnX + newWidth + ( width() - newWidth )/4;
	
	
	//
	//NextShapeLabel
	//
	pos.setX( rightFreeSpaceCenter - getStringWidth( nextShapeLabel->text() )/2 );
	pos.setY( menuBarHeigth );
	
	size.setWidth( getStringWidth( nextShapeLabel->text() ) );
	size.setHeight( getStringHeight() );
	nextShapeLabel->setGeometry( QRect( pos, size ) );
	
	//
	//NextShapeTable
	//
	nextShapeTable->setSquareSize( NEXT_SHAPE_SQUARE_SIZE );
	
	pos.setX( rightFreeSpaceCenter - NEXT_SHAPE_TABLE_SIZE/2 );
	pos.setY( menuBarHeigth + getStringHeight() + WIDGET_DISTANCE );
	
	size.setWidth( NEXT_SHAPE_TABLE_SIZE );
	size.setHeight( NEXT_SHAPE_TABLE_SIZE );
	
	nextShapeTable->setGeometry( QRect( pos, size ) );
}
CreditContext::CreditContext() :
    previousScreen(duplicateSurface(screen)),
    fontSize(24),
    y( screen->h )
{
    // Set window caption
    SDL_WM_SetCaption("Infraelly Credits", NULL);

    //set fps
    fpsManager.setMaxFps(30);

    // player music
    InfraellyMixer::stopMusic();
    InfraellyMixer::playMusic("audio/always_alone.ogg",-1, 1000);


    /* credit listing. Vector is used opposed to array to avoid having
        to re-number all elements, after each new insertion*/
    creditListing.push_back("-._.-~~-._.-~~-._.-~~-.");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("Thank you to the authors of the following libraries, used in Infraelly");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("SDL - Simple Directmedia Layer");
    creditListing.push_back("SDL_mixer");
    creditListing.push_back("SDL_TTF");
    creditListing.push_back("SDL_image");
    creditListing.push_back("SDL_net");
    creditListing.push_back("SDL_gfx");
    creditListing.push_back("Net2");
    creditListing.push_back("Libpng (used by SDL_image)");
    creditListing.push_back("Zlib (used by Libpng)");
    creditListing.push_back("FreeType Project (used by SDL_ttf)");
    creditListing.push_back("guichan");
    creditListing.push_back("TinyXml");
    creditListing.push_back("Crypto++");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("Default Fonts");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("Thank you to Larabie Fonts to for their excellent free fonts");
    creditListing.push_back("The following fonts were used:");
    creditListing.push_back("Forgotten Futurist (TrueType)");
    creditListing.push_back("Effloresce (TrueType)");
    creditListing.push_back("Credit Valley (TrueType)");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("Infraelly Music and Sound effects");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("insanepotato");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("Infraelly Graphics and Design");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("mah SiSteR");
    creditListing.push_back("insanepotato");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("Infraelly Website");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("xtiaDesign");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("Infraelly Programing");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("insanepotato");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("Contacting me");
    creditListing.push_back("~-------------------------~");
    creditListing.push_back("If there are any problems or bugs you would like to discuss with me;");
    creditListing.push_back("or even if you just want to chat, you can contact me via");
    creditListing.push_back("");
    creditListing.push_back("E-mail: [email protected]");
    creditListing.push_back("MSN-IM: [email protected]");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("~-----------------------~");
    creditListing.push_back("Thank you");
    creditListing.push_back("~-----------------------~");
    creditListing.push_back("Thank YOU for choosing Infraelly =)");
    creditListing.push_back("");
    creditListing.push_back("A final thanks to the authors and contributors of the afore mentioned libraries");
    creditListing.push_back("I love you all long time <3");
    creditListing.push_back("");
    creditListing.push_back("BloodShed Software for making an awesome IDE");
    creditListing.push_back("");
    creditListing.push_back("The Code::Blocks team for making an even better IDE!");
    creditListing.push_back("");
    creditListing.push_back("CrossFire MMORPG... i had a peek at your server's source code ;D");
    creditListing.push_back("");
    creditListing.push_back("Mr. Jacobs");
    creditListing.push_back("");
    creditListing.push_back("Aloo");
    creditListing.push_back("");
    creditListing.push_back("AsianFace, you showed me hell <3");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("");
    creditListing.push_back("Have a nice day =)");

    //used to draw text down the screen in 'lines'
    line = getStringHeight(font::creditFont.at(fontSize), "IPYHGgyipqQeoSa 0");
    line += 15;

    /*total height of the credit listing. 50 is added to the end,
    after its finished scrolling, there is a delay before it reappears at the bottom*/
    totalHeight = -line*creditListing.size()-3*line;

    //black box so "Press ESC to return" will appears on top of listing
    SDL_Rect escBox;
    escBox.x = 0;
    escBox.y = 0;
    escBox.w = screen->w;
    escBox.h = 15;

    //fade to black (fade into credits)
    fadeTo(screen, colour::black, 1000);

    run();
}