Beispiel #1
0
int scanDirCallback(char *dirName){
    oslStartDrawing();
    drawCommonGraphics();
    drawButtonBar(MODE_MEDIA_LIBRARY);

    int startX = (480 - scanBkg->sizeX) / 2;
    int startY = (272 - scanBkg->sizeY) / 2;
    oslDrawImageXY(scanBkg, startX, startY);
    skinGetColor("RGBA_POPUP_TITLE_TEXT", tempColor);
    skinGetColor("RGBA_POPUP_TITLE_TEXT_SHADOW", tempColorShadow);
    setFontStyle(fontNormal, defaultTextSize, RGBA(tempColor[0], tempColor[1], tempColor[2], tempColor[3]), RGBA(tempColorShadow[0], tempColorShadow[1], tempColorShadow[2], tempColorShadow[3]), INTRAFONT_ALIGN_LEFT);
    oslDrawString((480 - oslGetStringWidth(langGetString("SCANNING"))) / 2, startY + 3, langGetString("SCANNING"));
    skinGetColor("RGBA_POPUP_MESSAGE_TEXT", tempColor);
    skinGetColor("RGBA_POPUP_MESSAGE_TEXT_SHADOW", tempColorShadow);
    setFontStyle(fontNormal, defaultTextSize, RGBA(tempColor[0], tempColor[1], tempColor[2], tempColor[3]), RGBA(tempColorShadow[0], tempColorShadow[1], tempColorShadow[2], tempColorShadow[3]), INTRAFONT_ALIGN_LEFT);
    getFileName(dirName, buffer);
    if (strlen(buffer) > 70)
       buffer[70] = '\0';
    oslDrawString((480 - oslGetStringWidth(buffer)) / 2, startY + 30, buffer);

    oslReadKeys();
    oslEndDrawing();
    oslEndFrame();
    oslSyncFrame();
    return 0;
}
Beispiel #2
0
int oslGetTextBoxByWordsHeight(int width, int maxHeight, const char *text, int format)
{
	char buffer[50];
	int contaCaratteri;
	unsigned char c;
	int x,y, x2; //x2 => width della parola
	x = 0;//x0;
	y = 0;//y0;
    const char *text2;
    text2=text;
    while(*text2)
    {
        memset(buffer,'\0',50);
        //estrae una parola
        contaCaratteri = 0;
		x2 = 0;
        while (*text2 != '\n' && *text2 != ' ' && *text2) {
            contaCaratteri++;
			text2++;
        }
        if (contaCaratteri > 0 ) {
            strncpy( buffer, text, contaCaratteri);
			x2 = oslGetStringWidth(buffer);
			if ((x+x2)> width)
            {
            	x = width;
				y += osl_curFont->charHeight;
				if (y > maxHeight) break;

            }
 			text+=contaCaratteri;
			x += x2;
        }
        if (*text2 == ' ') {
			c = *text;
            x += osl_curFont->charWidths[c];
			text2++; text++;
        }
        if (*text2 == '\n') {
			x = width;
			y += osl_curFont->charHeight;
			if (y> maxHeight) break;
			text2++; text++;
        }
    }

	return y;
}
Beispiel #3
0
void oslDrawTextBoxByWords(int x0, int y0, int x1, int y1, const char *text, int format)
{
	char buffer[50];
	int contaCaratteri;
	unsigned char c;
	int x,y, x2; //x2 => width della parola
	x = x0;
	y = y0;
    const char *text2;
    text2=text;
    while(*text2)
    {
        memset(buffer,'\0',50);
        //estrae una parola
        contaCaratteri = 0;
		x2 = 0;
        while (*text2 != '\n' && *text2 != ' ' && *text2) {
            contaCaratteri++;
			text2++;
        }
        if (contaCaratteri > 0 ) {
            strncpy( buffer, text, contaCaratteri);
			x2 = oslGetStringWidth(buffer);
			if ((x+x2)> x1)
            {
            	x = x0;
				y += osl_curFont->charHeight;
				if (y > y1) break;

            }
            oslDrawString(x, y, buffer);
			text+=contaCaratteri;
			x += x2;
        }
        if (*text2 == ' ') {
			c = *text;
            x += osl_curFont->charWidths[c];
			text2++; text++;
        }
        if (*text2 == '\n') {
			x = x0;
			y += osl_curFont->charHeight;
			if (y> y1) break;
			text2++; text++;
        }
    }
}
Beispiel #4
0
float Text::width() const
{
#ifdef __WIN32__

	sf::Text text;
	Font* f = Font::getGlobalFont();
	if(f)
		text.setFont(f->handle);
	text.setColor(gawColorToSfColor(color));
	text.setPosition(m_position.x, m_position.y);
	text.setString(str);
	text.setCharacterSize(15);

	sf::FloatRect r = text.getLocalBounds();
	return r.width - r.left;
#else

	oslGetStringWidth(this->str.c_str());
#endif
}
Beispiel #5
0
/*
  call-seq: getLength
  Returns the width of a text if it were drawn on the screen with the actual
  fonts.
 */
VALUE getTextSize(VALUE self, VALUE text)
{
    int val = oslGetStringWidth(StringValuePtr(text));
    return INT2FIX(val);
}