本文整理汇总了C++中drawChar函数的典型用法代码示例。如果您正苦于以下问题:C++ drawChar函数的具体用法?C++ drawChar怎么用?C++ drawChar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drawChar函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:xmoeproject,项目名称:X-moe,代码行数:60,代码来源:ONScripter_text.cpp
示例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;
}
开发者ID:Seeed-Studio,项目名称:Small_ePaper_Shield,代码行数:64,代码来源:ePaper.cpp
示例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);
}
}
}
开发者ID:vramdal,项目名称:pi-led,代码行数:33,代码来源:LedMatrix.cpp
示例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;
}
开发者ID:ufanders,项目名称:protestSign,代码行数:29,代码来源:main.c
示例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);
}
开发者ID:rsafeup,项目名称:LCOM-BattalionTanks,代码行数:25,代码来源:menu.c
示例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;
}
开发者ID:nuo0024,项目名称:onscripter-zh,代码行数:27,代码来源:ONScripterLabel_text.cpp
示例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);
}
}
开发者ID:witheld9,项目名称:Torch,代码行数:28,代码来源:ui.c
示例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;
}
开发者ID:StephanHaag,项目名称:esp8266-devkit,代码行数:63,代码来源:Adafruit_GFX_AS.cpp
示例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);
}
}
}
开发者ID:witheld9,项目名称:Torch,代码行数:57,代码来源:actors.c
示例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;
}
开发者ID:Bazing4,项目名称:libraries,代码行数:57,代码来源:TFTv2.cpp
示例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 );
}
}
}
开发者ID:nuo0024,项目名称:onscripter-zh,代码行数:57,代码来源:ONScripterLabel_text.cpp
示例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;
}
开发者ID:0xPIT,项目名称:Arduino,代码行数:57,代码来源:TFTv2.cpp
示例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;
}
}
开发者ID:sekaiproject,项目名称:ponscripter-fork,代码行数:55,代码来源:PonscripterLabel_text.cpp
示例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;
}
}
}
开发者ID:dimdimdimdim,项目名称:geenie-firmware,代码行数:13,代码来源:stacklayout.cpp
示例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++;
}
}
开发者ID:nfattahi,项目名称:Hit-the-Balloons-Game,代码行数:16,代码来源:program.c
示例16: SemaphoreDown
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;
}
开发者ID:fincs,项目名称:FeOS-v2,代码行数:25,代码来源:drv-console.cpp
示例17: while
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++;
}
}
开发者ID:AnnaKolla,项目名称:openFrameworks,代码行数:34,代码来源:ofTrueTypeFont.cpp
示例18: if
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
}
开发者ID:hramrach,项目名称:GOFi2cOLED,代码行数:35,代码来源:GOFi2cOLED.cpp
示例19: while
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);
}
开发者ID:take-cheeze,项目名称:rpgtukuru-iphone,代码行数:7,代码来源:Graphics2D.cpp
示例20: vid_drawcursor
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);
}
开发者ID:callaa,项目名称:animtext,代码行数:7,代码来源:video.c
注:本文中的drawChar函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论