本文整理汇总了C++中drawChar函数的典型用法代码示例。如果您正苦于以下问题:C++ drawChar函数的具体用法?C++ drawChar怎么用?C++ drawChar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drawChar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flush
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;
}
示例2: drawChar
/*********************************************************************************************************
** 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;
}
示例3: strlen
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);
}
}
}
示例4: main
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;
}
示例5: drawSaveMenu
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);
}
示例6: while
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;
}
示例7: _drawTorchFuel
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);
}
}
示例8: drawChar
/***************************************************************************************
** 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;
}
示例9: _drawActor
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);
}
}
}
示例10: drawChar
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;
}
示例11: startRuby
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 );
}
}
}
示例12: drawChar
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;
}
示例13: drawChar
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;
}
}
示例14: drawChar
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;
}
}
}
示例15: printStr
/* 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++;
}
}