Exemplo n.º 1
0
bool ONScripter::clickWait( char *out_text )
{
    flush( REFRESH_NONE_MODE );
    skip_mode &= ~SKIP_TO_EOL;

    if (script_h.checkClickstr(script_h.getStringBuffer() + string_buffer_offset) != 1) string_buffer_offset++;
    string_buffer_offset++;

    if ( (skip_mode & (SKIP_NORMAL | SKIP_TO_EOP) || ctrl_pressed_status) && !textgosub_label ){
        clickstr_state = CLICK_NONE;
        if ( out_text ){
            drawChar( out_text, &sentence_font, false, true, accumulation_surface, &text_info );
        }
        else{ // called on '@'
            flush(refreshMode());
        }
        num_chars_in_sentence = 0;

        event_mode = IDLE_EVENT_MODE;
        if ( waitEvent(0) ) return false;
    }
    else{
        if ( out_text ){
            drawChar( out_text, &sentence_font, true, true, accumulation_surface, &text_info );
            num_chars_in_sentence++;
        }

        while( (!(script_h.getEndStatus() & ScriptHandler::END_1BYTE_CHAR) &&
                script_h.getStringBuffer()[ string_buffer_offset ] == ' ') ||
               script_h.getStringBuffer()[ string_buffer_offset ] == '\t' ) string_buffer_offset ++;

        if ( textgosub_label ){
            saveon_flag = false;

            textgosub_clickstr_state = CLICK_WAIT;
            if (script_h.getStringBuffer()[string_buffer_offset] == 0x0)
                textgosub_clickstr_state |= CLICK_EOL;
            gosubReal( textgosub_label, script_h.getNext(), true );

            event_mode = IDLE_EVENT_MODE;
            waitEvent(0);

            return false;
        }

        // if this is the end of the line, pretext becomes enabled
        if (script_h.getStringBuffer()[string_buffer_offset] == 0x0)
            line_enter_status = 0;

        clickstr_state = CLICK_WAIT;
        if (doClickEnd()) return false;

        clickstr_state = CLICK_NONE;

        if (pagetag_flag) processEOT();
        page_enter_status = 0;
    }

    return true;
}
Exemplo n.º 2
0
/*********************************************************************************************************
** Function name:           drawFloat
** Descriptions:            drawFloat
*********************************************************************************************************/
int ePaper::drawFloat(float floatNumber, int decimal, int poX, int poY)
{
    unsigned long temp=0;
    float decy=0.0;
    float rounding = 0.5;
    unsigned char f=0;
    
    float eep = 0.000001;
    
    int sumX    = 0;
    int xPlus   = 0;
    
    if(floatNumber-0.0 < eep)       // floatNumber < 0
    {
        xPlus = drawChar('-',poX, poY);
        floatNumber = -floatNumber;

        poX  += xPlus; 
        sumX += xPlus;
    }
    
    for (unsigned char i=0; i<decimal; ++i)
    {
        rounding /= 10.0;
    }
    
    floatNumber += rounding;

    temp = (long)floatNumber;
    
    
    xPlus = drawNumber(temp,poX, poY);

    poX  += xPlus; 
    sumX += xPlus;

    if(decimal>0)
    {
        xPlus = drawChar('.',poX, poY);
        poX += xPlus;                                       /* Move cursor right            */
        sumX += xPlus;
    }
    else
    {
        return sumX;
    }
    
    decy = floatNumber - temp;
    for(unsigned char i=0; i<decimal; i++)                                      
    {
        decy *= 10;                                                      /* for the next decimal         */
        temp = decy;                                                    /* get the decimal              */
        xPlus = drawNumber(temp,poX, poY);
        
        poX += xPlus;                                       /* Move cursor right            */
        sumX += xPlus;
        decy -= temp;
    }
    return sumX;
}
Exemplo n.º 3
0
void LedMatrix::writeMessage(char *message) {
  int display_len = 16;//width*displays/font_width;
  int i, pix;
  int msg_len = strlen(message);


for (i=0; i < display_len; i++) {
	modules[i].init();
}

 clearMatrix();

  for (i=0; i < msg_len; i++ ) {

      char c = message[i];
      drawChar(c, 0, offscreen);

      for (pix = 0; pix < fontWidth; pix++){
	scrollMatrixOnce(pix);
      }
  }

  for (i=0; i < display_len; i++ ) {

      char c = ' ';
      drawChar(c, 0, offscreen);

      for (pix = 0; pix < fontWidth; pix++){
  scrollMatrixOnce(pix);
      }
  }

}
Exemplo n.º 4
0
int main(void)
{
    //ClockInit();

    InitMatrix();
    LAT_CS = 0;
    BlankMatrix();
    LAT_CS = 1;

    drawChar('1', 0, 0);
    drawChar('2', 5, 0);
    drawChar(':', 10, 0);
    drawChar('3', 15, 0);
    drawChar('4', 20, 0);

    while(1)
    {
        /*
        //moved to ISR
        if(matrixDoesNeedService())
        {
            LAT_CS = 0;
            ScanMatrix();
            LAT_CS = 1;
        }
        */
    }
    return 0;
}
Exemplo n.º 5
0
void drawSaveMenu(SaveMenu* sm){
	Font* font = InitFont();
	drawBitmap(sm->Exit, Exit3X, Exit3Y, ALIGN_LEFT, 0);
	if (sm->exit == 1) {
		drawBitmap(sm->Highlight, Exit3X, Exit3Y, ALIGN_LEFT, 0);
	} else if (sm->flag1 == 1) {
		drawBitmap(sm->Highlight2, 500, 235, ALIGN_LEFT, 0);
	} else if (sm->flag2 == 1) {
		drawBitmap(sm->Highlight2, 550, 235, ALIGN_LEFT, 0);
	} else if (sm->flag3 == 1) {
		drawBitmap(sm->Highlight2, 600, 235, ALIGN_LEFT, 0);
	}
	drawChar(font, sm->Letter1, 500, 200);
	drawChar(font, sm->Letter3, 600, 200);
	drawChar(font, sm->Letter2, 550, 200);
	char str[15];
	sprintf(str, "%d", sm->score);
	char score[] = "SCORE";
	char name[] = "NAME";
	drawText(font, name, 300, 200);
	drawText(font, score, 270, 400);
	drawText(font, str, 500, 400);
	deleteFont(font);

}
void ONScripterLabel::endRuby(bool flush_flag, bool lookback_flag, SDL_Surface *surface, AnimationInfo *cache_info)
{
    char out_text[3]= {'\0', '\0', '\0'};
    if ( rubyon_flag ){
        ruby_font.clear();
        const char *buf = ruby_struct.ruby_start;
        while( buf < ruby_struct.ruby_end ){
            out_text[0] = *buf;
            if ( IS_TWO_BYTE(*buf) ){
                out_text[1] = *(buf+1);
                drawChar( out_text, &ruby_font, flush_flag, lookback_flag, surface, cache_info );
                buf++;
            }
            else{
                out_text[1] = '\0';
                drawChar( out_text, &ruby_font, flush_flag,  lookback_flag, surface, cache_info );
                if ( *(buf+1) ){
                    out_text[1] = *(buf+1);
                    drawChar( out_text, &ruby_font, flush_flag,  lookback_flag, surface, cache_info );
                    buf++;
                }
            }
            buf++;
        }
    }
    ruby_struct.stage = RubyStruct::NONE;
}
Exemplo n.º 7
0
Arquivo: ui.c Projeto: witheld9/Torch
void _drawTorchFuel() {
    int x, barWidth = WINDOW_WIDTH;
    float fuelMod;
    character *player = getPlayer();

    if (!player) {
        return;
    }

    if (player->itemLight) {
        fuelMod = player->itemLight->fuel / (float)player->itemLight->fuelMax;

        barWidth = clip(barWidth * fuelMod, 1, WINDOW_WIDTH - 2);
    } else {
        barWidth = 1;
    }

    drawChar(UI_CONSOLE, 1, 0, '[', TCOD_color_RGB(200, 200, 200), TCOD_color_RGB(65, 65, 65));
    drawChar(UI_CONSOLE, WINDOW_WIDTH - 2, 0, ']', TCOD_color_RGB(200, 200, 200), TCOD_color_RGB(65, 65, 65));

    for (x = 2; x < barWidth; x++) {
        drawCharBackEx(UI_CONSOLE, x, 0, TCOD_color_RGB(255 - x, (255 * fuelMod), 150 * fuelMod), TCOD_BKGND_SET);
    }

    for (x = barWidth; x < WINDOW_WIDTH - 2; x++) {
        drawCharBackEx(UI_CONSOLE, x, 0, TCOD_color_RGB(35, 35, 35), TCOD_BKGND_SET);
    }
}
/***************************************************************************************
 ** Function name:           drawFloat
 ** Descriptions:            drawFloat
 ***************************************************************************************/
ICACHE_FLASH_ATTR int Adafruit_GFX_AS::drawFloat(float floatNumber, uint8_t decimal, uint16_t poX, uint16_t poY, uint8_t size)
{
	unsigned long temp=0;
	float decy=0.0;
	float rounding = 0.5;

	float eep = 0.000001;

	int sumX    = 0;
	uint16_t xPlus   = 0;

	if(floatNumber-0.0 < eep)       // floatNumber < 0
			{
		xPlus = drawChar('-',poX, poY, size);
		floatNumber = -floatNumber;

		poX  += xPlus;
		sumX += xPlus;
			}

	for (unsigned char i=0; i<decimal; ++i)
	{
		rounding /= 10.0;
	}

	floatNumber += rounding;

	temp = (long)floatNumber;


	xPlus = drawNumber(temp,poX, poY, size);

	poX  += xPlus;
	sumX += xPlus;

	if(decimal>0)
	{
		xPlus = drawChar('.',poX, poY, size);
		poX += xPlus;                                       /* Move cursor right            */
		sumX += xPlus;
	}
	else
	{
		return sumX;
	}

	decy = floatNumber - temp;
	for(unsigned char i=0; i<decimal; i++)
	{
		decy *= 10;                                                      /* for the next decimal         */
		temp = decy;                                                    /* get the decimal              */
		xPlus = drawNumber(temp,poX, poY, size);

		poX += xPlus;                                       /* Move cursor right            */
		sumX += xPlus;
		decy -= temp;
	}
	return sumX;
}
Exemplo n.º 9
0
void _drawActor(character *actor) {
	if (actor->hp <= 0 || (isTransitionInProgress() && actor->itemLight && actor->itemLight->sizeMod == 0)) {
		return;
	}

	_actorOnDraw(actor);
	
	TCOD_color_t foreColor = actor->foreColor;
	int nx, ny, occupiedPosition = 0, chr = actor->chr;
	float healthPercentage = (float)actor->hp / (float)actor->hpMax;
	character *actorPtr = getActors(), *player = getPlayer();
	
	if (getAnimateFrame() / 60.f >= .5) {
		if (actor->stanceFlags & IS_STUCK_WITH_LODGED_WEAPON) {
			foreColor.r = 255;
			foreColor.g = 0;
			foreColor.b = 0;
			
			chr = getItemLodgedInActor(actor)->chr;
		} else if (actor->stanceFlags & IS_CRAWLING && actor->stanceFlags & IS_STUNNED) {
			chr = 25;
		} else if (actor->stanceFlags & IS_STUNNED) {
			chr = (int)'*';
		} else if (actor->stanceFlags & IS_CASTING) {
			chr = (int)'!';
		}
	}
	
	if (healthPercentage <= .75) {
		if ((getAnimateFrame() % (int)(60 * ((healthPercentage / .75)))) == 0) {
			foreColor.r = 255;
			foreColor.g = 0;
			foreColor.b = 0;
		}
	}
	
	drawChar(ACTOR_CONSOLE, actor->x, actor->y, chr, foreColor, actor->backColor);
	
	if ((actor->vx || actor->vy) && (!player || actor->delay < getMovementCost(player) - 1)) {
		nx = actor->x + actor->vx;
		ny = actor->y + actor->vy;
		
		while (actorPtr) {
			if (actorPtr->x == nx && actorPtr->y == ny) {
				occupiedPosition = 1;
				
				break;
			}
			
			actorPtr = actorPtr->next;
		}
		
		if (!occupiedPosition || getAnimateFrame() / 60.f >= .5) {
			drawChar(ACTOR_CONSOLE, nx, ny, 176, foreColor, actor->backColor);
		}
	}
}
Exemplo n.º 10
0
unsigned char TFT::drawFloat(float floatNumber,unsigned int poX, unsigned int poY,unsigned int size,unsigned int fgcolor)
{
    unsigned char decimal=2;
    unsigned int temp=0;
    float decy=0.0;
    float rounding = 0.5;
    unsigned char f=0;
    if(floatNumber<0.0)                                                 /* floatNumber < 0              */
    {
        drawChar('-',poX, poY, size, fgcolor);                          /* add a '-'                    */
        floatNumber = -floatNumber;
        if(poX < MAX_X)
        {
            poX+=FONT_SPACE*size;                                       /* Move cursor right            */
        }
        f =1;
    }
    for (unsigned char i=0; i<decimal; ++i)
    {
        rounding /= 10.0;
    }
    floatNumber += rounding;

    temp = (unsigned int)floatNumber;
    unsigned char howlong=drawNumber(temp,poX, poY, size, fgcolor);
    f += howlong;
    if((poX+8*size*howlong) < MAX_X)
    {
        poX+=FONT_SPACE*size*howlong;                                   /* Move cursor right            */
    }


    if(decimal>0)
    {
        drawChar('.',poX, poY, size, fgcolor);
        if(poX < MAX_X)
        {
            poX += FONT_SPACE*size;                                     /* Move cursor right            */
        }
        f +=1;
    }
    decy = floatNumber-temp;                                            /* decimal part,                */
    for(unsigned char i=0;i<decimal;i++)
    {
        decy *=10;                                                      /* for the next decimal         */
        temp = decy;                                                    /* get the decimal              */
        drawNumber(temp,poX, poY, size, fgcolor);
        floatNumber = -floatNumber;
        if(poX < MAX_X)
        {
            poX += FONT_SPACE*size;                                     /* Move cursor right            */
        }
        decy -= temp;
    }
    f += decimal;
    return f;
}
Exemplo n.º 11
0
void ONScripterLabel::restoreTextBuffer()
{
    text_info.fill( 0, 0, 0, 0 );

    char out_text[3] = { '\0','\0','\0' };
    FontInfo f_info = sentence_font;
    f_info.clear();
    for ( int i=0 ; i<current_page->text_count ; i++ ){
        if ( current_page->text[i] == 0x0a ){
            f_info.newLine();
        }
        else{
            out_text[0] = current_page->text[i];
#ifndef FORCE_1BYTE_CHAR            
            if (out_text[0] == '('){
                startRuby(current_page->text + i + 1, f_info);
                continue;
            }
            else if (out_text[0] == '/' && ruby_struct.stage == RubyStruct::BODY ){
                f_info.addLineOffset(ruby_struct.margin);
                i = ruby_struct.ruby_end - current_page->text - 1;
                if (*ruby_struct.ruby_end == ')'){
                    endRuby(false, false, NULL, &text_info);
                    i++;
                }
                continue;
            }
            else if (out_text[0] == ')' && ruby_struct.stage == RubyStruct::BODY ){
                ruby_struct.stage = RubyStruct::NONE;
                continue;
            }
#endif
            if ( IS_TWO_BYTE(out_text[0]) ){
                out_text[1] = current_page->text[i+1];
                
                if (IS_KINSOKU( current_page->text+i+2 )){
                    int i = 2;
                    while (!f_info.isEndOfLine(i) &&
                           IS_KINSOKU( current_page->text+i+2 )){
                        i += 2;
                    }
                    if (f_info.isEndOfLine(i)) f_info.newLine();
                }
            }
            else{
                out_text[1] = '\0';
                drawChar( out_text, &f_info, false, false, NULL, &text_info );
                
                if (i+1 == current_page->text_count) break;
                out_text[0] = current_page->text[i+1];
                if (out_text[0] == 0x0a) continue;
            }
            i++;
            drawChar( out_text, &f_info, false, false, NULL, &text_info );
        }
    }
}
Exemplo n.º 12
0
INT8U TFT::drawFloat(float floatNumber,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor)
{
    INT8U decimal=2;
    INT16U temp=0;
    float decy=0.0;
    float rounding = 0.5;
    INT8U f=0;
    if(floatNumber<0.0)                                                 /* floatNumber < 0              */
    {
        drawChar('-',poX, poY, size, fgcolor);                          /* add a '-'                    */
        floatNumber = -floatNumber;
        if(poX < MAX_X)
        {
            poX+=FONT_SPACE*size;                                       /* Move cursor right            */
        }
        f =1;
    }
    for (INT8U i=0; i<decimal; ++i)
    {
        rounding /= 10.0;
    }
    floatNumber += rounding;

    temp = (INT16U)floatNumber;
    INT8U howlong=drawNumber(temp,poX, poY, size, fgcolor);
    f += howlong;
    if((poX+8*size*howlong) < MAX_X)
    {
        poX+=FONT_SPACE*size*howlong;                                   /* Move cursor right            */
    }


    if(decimal>0)
    {
        drawChar('.',poX, poY, size, fgcolor);
        if(poX < MAX_X)
        {
            poX += FONT_SPACE*size;                                     /* Move cursor right            */
        }
        f +=1;
    }
    decy = floatNumber-temp;                                            /* decimal part,                */
    for(INT8U i=0;i<decimal;i++)
    {
        decy *=10;                                                      /* for the next decimal         */
        temp = decy;                                                    /* get the decimal              */
        drawNumber(temp,poX, poY, size, fgcolor);
        floatNumber = -floatNumber;
        if(poX < MAX_X)
        {
            poX += FONT_SPACE*size;                                     /* Move cursor right            */
        }
        decy -= temp;
    }
    f += decimal;
    return f;
}
int PonscripterLabel::clickWait(bool display_char)
{
    const char* c = script_h.getStrBuf(string_buffer_offset);

    if ((skip_flag || draw_one_page_flag || ctrl_pressed_status) &&
        !textgosub_label) {
        clickstr_state = CLICK_NONE;
        skip_to_wait = 0;
        int bytes;
        if (display_char)
            bytes = drawChar(c, &sentence_font, false, true,
                             accumulation_surface, &text_info);
        else {
            bytes = 1; // @, \, etc...?
            flush(refreshMode());
        }
        string_buffer_offset += bytes;
        num_chars_in_sentence = 0;
        return RET_CONTINUE | RET_NOREAD;
    }
    else {
        if (current_read_language == -1 || current_read_language == current_language) {
            clickstr_state   = CLICK_WAIT;
        }
        if (skip_to_wait || (sentence_font.wait_time == 0)) {
            skip_to_wait = 0;
            flush(refreshMode());
        }
        key_pressed_flag = false;
        if (display_char) {
            drawChar(c, &sentence_font, false, true, accumulation_surface,
                     &text_info);
            ++num_chars_in_sentence;
        }
        if (textgosub_label) {
            const char* next_text = c + 1;
            
            saveoffCommand("saveoff");
            textgosub_clickstr_state =
                (next_text[0] == 0x0a)
                ? CLICK_WAITEOL : CLICK_WAIT;

            gosubDoTextgosub();
            
            indent_offset = 0;        // Do we want to reset all these?
            line_enter_status = 0;
            string_buffer_offset = 0;
            return RET_CONTINUE;
        }

        doClickEnd();

        return RET_WAIT | RET_NOREAD;
    }
}
Exemplo n.º 14
0
void StackLayout::drawNumber(uint8_t *pixelData, int dataOffset, int i)
{
	int p = currentNumberWidth;
	drawChar(pixelData, dataOffset, ':', p);
	if (i == 0)
		drawChar(pixelData, dataOffset, '0', p);
	else {
		while (i) {
			drawChar(pixelData, dataOffset, '0' + i % 10, p);
			i /= 10;
		}
	}
}
Exemplo n.º 15
0
/* prints an array of characters (string) on the screen */
void printStr(unsigned int x, unsigned int y, char* str)
{
	int i = 0;
	
	if(str[i] == '\0')
		drawChar (x+i, y, '0');
	
	//use a loop to draw all the chars one by one
	while(str[i] != '\0')
	{
		int ch = str[i];
		drawChar (x+i, y, ch);
		i++;
	}
}
Exemplo n.º 16
0
intptr_t ConsoleDrv::Write(const void* buffer, size_t bufSize)
{
	const char* buf = (const char*)buffer;
	const char* bufEnd = buf + bufSize;
	SemaphoreDown(&conMutex);
	while (buf != bufEnd)
	{
		int c = *buf++;
		if (c == '\n')
			newline();
		else if (c == '\t')
		{
			m_conX = (m_conX&~7) + 8;
			if (m_conX >= m_conW)
				newline();
		} else
		{
			drawChar(m_conX++, m_conY, c);
			if (m_conX >= m_conW)
				newline();
		}
	}
	SemaphoreUp(&conMutex);
	return bufSize;
}
Exemplo n.º 17
0
void ofTrueTypeFont::createStringMesh(string c, float x, float y){
	GLint		index	= 0;
	GLfloat		X		= x;
	GLfloat		Y		= y;
	int newLineDirection		= 1;

	if(!ofIsVFlipped()){
		// this would align multiline texts to the last line when vflip is disabled
		//int lines = ofStringTimesInString(c,"\n");
		//Y = lines*lineHeight;
		newLineDirection = -1;
	}

	int len = (int)c.length();

	while(index < len){
		int cy = (unsigned char)c[index] - NUM_CHARACTER_TO_START;
		if (cy < nCharacters){ 			// full char set or not?
		  if (c[index] == '\n') {

				Y += lineHeight*newLineDirection;
				X = x ; //reset X Pos back to zero

		  }else if (c[index] == ' ') {
				 int cy = (int)'p' - NUM_CHARACTER_TO_START;
				 X += cps[cy].setWidth * letterSpacing * spaceSize;
		  } else if(cy > -1){
				drawChar(cy, X, Y);
				X += cps[cy].setWidth * letterSpacing;
		  }
		}
		index++;
	}
}
Exemplo n.º 18
0
size_t GOFi2cOLED::write(uint8_t c) {
#else
void GOFi2cOLED::write(uint8_t c) {
#endif
   if (c == '\n') {
    cursor_y += textsize*8;
    cursor_x = 0;
  } else if (c == '\r') {
    // skip em
  } else {
    drawChar(cursor_x, cursor_y, c, textcolor, textbgcolor, textsize);
    cursor_x += textsize*6;
    if (wrap && (cursor_x > (_width - textsize*6))) {
      cursor_y += textsize*8;
      cursor_x = 0;

    }
  }
/*    if(C < 32 || C > 127) //Ignore non-printable ASCII characters. This can be modified for multilingual font.
    {
    C=' '; //Space
    }	
    unsigned char i=0;
    for(i=0;i<8;i++)
    {
       //read bytes from code memory
       sendData(pgm_read_byte(&BasicFont[C-32][i])); //font array starts at 0, ASCII starts at 32. Hence the translation
    }

*/

#if ARDUINO >= 100
  return 1;
#endif
}
Exemplo n.º 19
0
	void Graphics2D::drawString(RPG2kString const& str, Vector2D const& p, uint color)
	{
		Vector2D cur = p;
		RPG2kString::const_iterator it = str.begin();

		while( it != str.end() ) cur[0] += drawChar(it, cur, color);
	}
Exemplo n.º 20
0
static void vid_drawcursor(char update) {
  if(cursor==0) return;
  if(cursor<0) cursor_blink=1;
  else if((frame%cursor)==0) cursor_blink=!cursor_blink;
  drawChar(screen,font,cursor_blink?CURSOR_CHR:' ',cursorX+xoffset,cursorY+yoffset,1,font_scale);
  if(update) SDL_UpdateRect(screen,cursorX+xoffset,cursorY+yoffset,8*font_scale,8*font_scale);
}
Exemplo n.º 21
0
Arquivo: font.cpp Projeto: cyxx/f2bgl
void Game::drawString(int x, int y, const char *str, int font, int color) {
	font &= 31;
	assert(font < kFontTableSize);
	Font *ft = &_fontsTable[font];
	SpriteImage *spr;
	int chrX = x;
	int chrY = y;
	int chr;
	while ((chr = (unsigned char)*str++) != 0) {
		switch (chr) {
		case '\t':
			chrX += 8 * ft->w;
			break;
		case '@':
		case '|':
			if (font == kFontNameCineTypo) {
				return;
			}
			chrY += ft->h;
			chrX = x;
			break;
		case ' ':
			chrX += ft->w;
			break;
		default:
			chr -= 33;
			assert(chr >= 0 && chr < kFontGlyphsCount);
			spr = &ft->glyphs[chr];
			drawChar(chrX, chrY + ft->h - spr->h, spr, color);
			chrX += spr->w + ft->spacing;
			break;
		}
	}
}
Exemplo n.º 22
0
void drawString(uint8_t x, uint8_t y, char *string) {
	uint8_t xs = x;
	while (*string) {
		drawChar(xs, y, *string++);
		xs += 6;
	}
}
Exemplo n.º 23
0
void ScheduleScreen::renderOffTime()
{
    char buf[3];

    uint8_t hr = LGDB::read_hour(device_idx, scheduleScreenCurrentDay, false);

    if(hr >=12 )
        drawString(85, 220, "PM", WHITE, BLACK, 2);
    else
        drawString(85, 220, "AM", WHITE, BLACK, 2);

    hr = hr % 12;
    if(hr == 0)
        hr = 12;
    twodigit(buf, hr);
    drawString(85, 136, buf, WHITE, BLACK, 2);

    drawChar(85, 170, ':', WHITE, BLACK, 2);

    uint8_t min = LGDB::read_minute(device_idx, scheduleScreenCurrentDay, false);
    twodigit(buf, min);
    drawString(85, 190, buf, WHITE, BLACK, 2);



}
Exemplo n.º 24
0
void drawText(char* a, int alen, int X, int Y, int size, unsigned char R, unsigned char G, unsigned char B, unsigned char alpha){
    int onecharspace = calculateOneCharSpace(size);
    int i;
    for (i=0;i<alen; i++){
        drawChar(a[i],X+(onecharspace)*i,Y,size,R,G,B,alpha);
    }
}
Exemplo n.º 25
0
void InsetMathChar::draw(PainterInfo & pi, int x, int y) const
{
	//lyxerr << "drawing '" << char_ << "' font: " << pi.base.fontname << endl;
	int const em = mathed_char_width(pi.base.font, 'M');
	if (isBinaryOp(char_))
		x += static_cast<int>(0.25*em+0.5);
	else if (char_ == '\'')
		x += static_cast<int>(0.0833*em+0.5);
#if 1
	if (char_ == '=' && has_math_fonts) {
		FontSetChanger dummy(pi.base, "cmr");
		pi.draw(x, y, char_);
	} else if ((char_ == '>' || char_ == '<') && has_math_fonts) {
		FontSetChanger dummy(pi.base, "cmm");
		pi.draw(x, y, char_);
	} else if (!slanted(char_) && pi.base.fontname == "mathnormal") {
		ShapeChanger dummy(pi.base.font, UP_SHAPE);
		pi.draw(x, y, char_);
	} else {
		pi.draw(x, y, char_);
	}
#else
	drawChar(pain, font_, x, y, char_);
#endif
}
Exemplo n.º 26
0
void ShellService::echo(char ch) {
	
//	int length = echo.size();
//	int* params = new int[length + 1];

	
    int posX = SHELL_X_START + (_currentColumn * COLUMN_WIDTH);
    if (posX >= SHELL_X_END) {
        newLine();
        posX = SHELL_X_START;
    }
    
    int posY = SHELL_Y_START + (_currentLine * LINE_HEIGHT);
    if (posY > SHELL_Y_END) {
        setColor(0x0);
        moveTo(SHELL_X_START, SHELL_Y_START - (LINE_HEIGHT + 5));
        drawRect(SHELL_X_END, SHELL_Y_END);
        _currentColumn = 0;
        _currentLine = 0;
        posY = SHELL_Y_START;
        posX = SHELL_X_START;
    }
    while (!hasScreen());
    setColor(0xFFFFFF);
	moveTo(posX, posY);
    drawChar(ch, 2);
    _currentColumn++;
    
//	params[0] = 0; //  HDMI WRITE COMMAND :)
//	for (int i = 0; i < length; i++) {
//		params[i + 1] = (int)(echo.c_str()[i]);
//	}
//	performServiceCall(DISPLAY_SERVICE_ID, 2, params);
}
Exemplo n.º 27
0
void drawText(uchar* d, uchar* text) {
  uchar c;
  for(;c=*text; text++) {
    drawChar(d, c);
    d += 2; 
  }
}
Exemplo n.º 28
0
void Font::drawChar(ManagedSurface *dst, uint32 chr, int x, int y, uint32 color) const {
	drawChar(&dst->_innerSurface, chr, x, y, color);

	Common::Rect charBox = getBoundingBox(chr);
	charBox.translate(x, y);
	dst->addDirtyRect(charBox);
}
Exemplo n.º 29
0
void ImageBuffer::drawText(int imageX, int imageY, std::string text) {
    const char* str = text.c_str();

    for (unsigned int i = 0; i < text.size(); i++) {
        drawChar(imageX + i * 9, imageY, str[i]);
    }
}
Exemplo n.º 30
0
void GLFont::drawText(int x, int y, const char *pszText)
{
    char prevCh = 0;
    char ch = 0;
    int dx = x;
    int dy = y;
    int charHeight = getCellHeight();
    int whitespaceWidth = getChar(' ').width;

    while (*pszText != '\0')
    {
        prevCh = ch;
        ch = *pszText++;

        if (ch == ' ')
        {
            if (prevCh != '\r')
                dx += whitespaceWidth;
        }
        else if (ch == '\n' || ch == '\r')
        {
            dx = x;
            dy += charHeight;
        }
        else if (ch == '\t')
        {
            dx += whitespaceWidth * TAB_SPACES;
        }
        else if (ch >= CHAR_FIRST && ch <= CHAR_LAST)
        {
            drawChar(ch, dx, dy);
            dx += getChar(ch).width;
        }
    }
}