• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ draw_char函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中draw_char函数的典型用法代码示例。如果您正苦于以下问题:C++ draw_char函数的具体用法?C++ draw_char怎么用?C++ draw_char使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了draw_char函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: console_putc

int console_putc(int ch) {
#if defined (ARM_ALLOW_MULTI_CORE)
	while (__sync_lock_test_and_set(&lock, 1) == 1);
#endif

	if (ch == (int)'\n') {
		newline();
	} else if (ch == (int)'\r') {
		current_x = 0;
	} else if (ch == (int)'\t') {
		current_x += 4;
	} else {
		draw_char(ch, current_x * FB_CHAR_W, current_y * FB_CHAR_H, cur_fore, cur_back);
		current_x++;
		if (current_x == FB_WIDTH / FB_CHAR_W) {
			newline();
		}
	}

#if defined (ARM_ALLOW_MULTI_CORE)
	__sync_lock_release(&lock);
#endif

	return ch;
}
开发者ID:vanvught,项目名称:rpidmx512,代码行数:25,代码来源:console_fb.c


示例2: draw_string

static void draw_string(int x, int y, const char *s, int w) {
	if (s == NULL)
		return;
	for (; *s && w; w--) {
		draw_char(x++,y,*(s++));
	}
}
开发者ID:CrashSerious,项目名称:PS3Roar,代码行数:7,代码来源:ui_gp32.c


示例3: fill_rect

void fill_rect( int left, int top, int width, int height, char ch )
{

	int right = left + width - 1;
	int bottom = top + height - 1;

	if( width <= 0 || height <= 0 )
	{
	}
	else if( width == 1 && height == 1 )
	{
		draw_char( left, top, ch );
	}
	else if( width == 1 )
	{
		draw_line( left, top, left, bottom, ch );
	}
	else if ( height == 1 )
	{
		draw_line( left, top, right, top, ch );
	}
	else
	{
		for( int i = 0; i < height; i++ )
		{
			draw_line( left, top + i, right, top + i, ch );
		}
	}
}
开发者ID:NathanRamage,项目名称:CAB202,代码行数:29,代码来源:fill_rect.c


示例4: scroll

static void scroll(void) {
	int i;

	for (i = 0; i < (40 * 29); i++) {
		const int ch = (int) shadow_ram[i + 40].ch;
		const uint16_t fore = shadow_ram[i + 40].fore;
		const uint16_t back = shadow_ram[i + 40].back;
		const uint32_t x = i / 40;
		const uint32_t y = i - 40 * x;

		draw_char(ch, x, y, fore, back);
	}

	for (i = 0; i < 40; i++) {
		draw_char(' ', 29, i, cur_fore, cur_back);
	}
}
开发者ID:vanvught,项目名称:rpidmx512,代码行数:17,代码来源:ili9340.c


示例5: draw_text

void draw_text(int x, int y, const char *text, color_t  c) {
    int counter =0;
    while(text[counter] != '\0') {
        draw_char(x,y,text[counter], c);
        x+=8;
        counter++;
    }
}
开发者ID:Chris-grant1995,项目名称:CS1550,代码行数:8,代码来源:library.c


示例6: while

void Display::draw_text(uint16_t x, uint16_t y, const char* c)
{
    while (*c != 0) {
        draw_char(x, y, *c);
        x += 7;
        c++;
    }
}
开发者ID:ArmaJo,项目名称:ardupilot,代码行数:8,代码来源:Display.cpp


示例7: draw_text_line

static void draw_text_line(duc_graph *g, double x, double y, double size, char *text, int l)
{
	int i;
	
	for(i=0; i<l; i++) {
		x += draw_char(g, x, y, size, text[i]);
	}
}
开发者ID:Solertis,项目名称:duc,代码行数:8,代码来源:graph-opengl.c


示例8: show_route

void show_route(void)
{
   int k;
   for(k=route_count-1; k>=0; k--)
   {
      draw_char(route[k].x, route[k].y, ' ', 0x47);
   }
}
开发者ID:375670450,项目名称:BugEat,代码行数:8,代码来源:bugeatwc.c


示例9: draw_string

void draw_string(int x, int y, char *s)
{
	int i;

	for (i = 0; i < strlen(s); i++)
	{
		draw_char(x + i, y, s[i]);
	}
}
开发者ID:Crazedpeanut,项目名称:WindowsConsoleGameEngine,代码行数:9,代码来源:Display.c


示例10: tfont_draw_string

void tfont_draw_string(const char* s) {
    if(!tfont_init())
        sys_err("tfont not initialized");
    while(*s) {
        unsigned char ch = (unsigned char) *s++;
        draw_char(ch);
        glTranslatef(_bm_w, 0, 0);
    }
}
开发者ID:mmmmhack,项目名称:vblend,代码行数:9,代码来源:tfont.c


示例11: gamelib_mainmenu

void gamelib_mainmenu(){
	int n,j;
	int t = 0;
	double d=0;
	char *text;

	time_t current_time;
	struct tm * time_info;
	char timeString[8];



	while(nunchuck_read()){
		nunchuck_init();
		//nunchuck_read();
		mvprintw(6,0,"nunchuck reinited\n");
	}
	while(buttonC && buttonZ){
		while(nunchuck_read()){
			nunchuck_init();
			//nunchuck_read();
			mvprintw(6,0,"nunchuck reinited\n");
		}
		
		if(t%800 < 100){
			text = "PLAY";
			d = 3.03;
		}
		else if(t%800 < 200) {
			text = "GAMES";
			d = 0.03;
		}	
		else{
			time(&current_time);
			time_info = localtime(&current_time);
			strftime(timeString, 8, "%H:%M", time_info);
			
			if(current_time%2){
				timeString[2] = ' ';
			}
			text = timeString;
			d=0.03;
		}
		
		n=0;
		while(text[n] && n < 6){
			draw_char(n*6+d, text[n]);
			n++;
		}
		blit();
		update();
		
		t++;
	}


}	
开发者ID:armageddon421,项目名称:blinkenpi,代码行数:57,代码来源:gamelib.c


示例12: draw_text

void draw_text(uint8_t x, uint8_t y, const char *text, uint8_t r,uint8_t g,uint8_t b)
{
	while (*text)
	{
		draw_char(x,y,*text,r,b,g);
		x+=6;
		text++;
	}

}
开发者ID:sebseb7,项目名称:oled,代码行数:10,代码来源:text.c


示例13: draw_cursor

/* 
	We do not want to redraw our input window every time the cursor blinks.
	We only redraw the character under the cursor.
	For that we have to known the position in the text at which the cursor is.
	If the cursor is past the last character in the window text, we draw a space.
*/	
static uint8_t
draw_cursor(struct Window *win, uint8_t cursor_pos, uint8_t reversed){
	char ch;
	int cc;
	
	set_font(win->font);			// necessary !
	cc = cursor_col(cursor_pos);
	
	/* If we are past the text length, draw space */
	if (cursor_pos >= win->text_len) ch = ' ';
	else ch = win->txt[cursor_pos];
	
	if (reversed)
		draw_char(win_txt_row(win), win_txt_col(win)+ cc, ch, win->bg_color, win->fg_color, txt_col_lim(win) - cc ); 
	else	
		draw_char(win_txt_row(win), win_txt_col(win)+ cc, ch, win->fg_color, win->bg_color, txt_col_lim(win) - cc ); 
	
	return 1;
};
开发者ID:HerrSchrader,项目名称:McBetty,代码行数:25,代码来源:window.c


示例14: draw_string

//Draw a string of chars
void draw_string(char s[], int x, int y) {

	int i;

	for (i = 0; i < strlen(s); i++) {
	
		draw_char(s[i],x,y);
		x += 20;
	}
}
开发者ID:RastaCat,项目名称:EssiInvaders,代码行数:11,代码来源:si.c


示例15: draw_page_title

static void draw_page_title(void)
{
	int x, tpos, tlen = strlen(ACTIVE_PAGE.title);

	if (tlen > 0) {
		tpos = 41 - ((tlen + 1) / 2);

		for (x = 1; x < tpos - 1; x++)
			draw_char(154, x, 11, 1, 2);
		draw_char(0, tpos - 1, 11, 1, 2);
		draw_text(ACTIVE_PAGE.title, tpos, 11, 0, 2);
		draw_char(0, tpos + tlen, 11, 1, 2);
		for (x = tpos + tlen + 1; x < 79; x++)
			draw_char(154, x, 11, 1, 2);
	} else {
		for (x = 1; x < 79; x++)
			draw_char(154, x, 11, 1, 2);
	}
}
开发者ID:HybridDog,项目名称:schismtracker,代码行数:19,代码来源:page.c


示例16: main

void main() {
	char * map =
		"####  ####"
		"#  ####  #"
		"#        #"
		"##      ##"
		" #      # "
		" #      # "
		"##      ##"
		"#        #"
		"#  ####  #"
		"####  ####";
	int map_w = 10;

	POINT player = { 2, 2 };
	unsigned char scancode = 0;
	unsigned char ascii = 0;

	clear();
	draw_map(map, 0, 0, map_w, 5);

	do {
		draw_char(' ', player.x, player.y, 15);
		switch (scancode) {
		case 72:
			move(map, &player, player.x, player.y - 1,map_w);
			break;
		case 80:
			move(map, &player, player.x, player.y + 1,map_w);
			break;
		case 75:
			move(map, &player, player.x - 1, player.y,map_w);
			break;
		case 77:
			move(map, &player, player.x + 1, player.y,map_w);
			break;
		}
		draw_char('@', player.x, player.y, 15);

		get_key(&scancode, &ascii);
	}while (scancode != 1);
}
开发者ID:HiroinaProtagonist,项目名称:SimpleRL,代码行数:42,代码来源:SimpleRL.c


示例17: draw_text

void
draw_text(u32 *pixels, u32 *font, zplString str, i32 font_w, Rect rect) {
    i32 str_len = zpl_string_length(str);
    i32 n = 0;
    
    do {
        draw_char(pixels, font, str[n++], font_w, rect);
        rect.x += rect.w;
    }
    while (--str_len > 0);
}
开发者ID:zpl-c,项目名称:zpl-tests,代码行数:11,代码来源:swtest.c


示例18: redraw_top_info

static void redraw_top_info(void)
{
	char buf[8];

	update_current_instrument();

	draw_text_len(song_get_basename(), 18, 12, 4, 5, 0);
	draw_text_len(current_song->title, 25, 12, 3, 5, 0);

	if ((status.flags & (CLASSIC_MODE | SONG_NEEDS_SAVE)) == SONG_NEEDS_SAVE)
		draw_char('+', 29, 4, 4, 0);

	update_current_order();
	update_current_pattern();
	update_current_row();

	draw_text(numtostr(3, song_get_current_speed(), buf), 50, 4, 5, 0);
	draw_text(numtostr(3, song_get_current_tempo(), buf), 54, 4, 5, 0);
	draw_char('0' + kbd_get_current_octave(), 50, 5, 5, 0);
}
开发者ID:HybridDog,项目名称:schismtracker,代码行数:20,代码来源:page.c


示例19: while

void Display::draw_text(uint16_t x, uint16_t y, const char* c)
{
    if (nullptr == c) {
        return;
    }
    while (*c != 0) {
#ifndef AP_NOTIFY_DISPLAY_USE_EMOJI
        if (*c >= ' ' && *c <= '~') {
            draw_char(x, y, *c - ' ');
        } else {
            // convert oob characters to spaces
            draw_char(x, y, 0);
        }
#else
        draw_char(x, y, *c);
#endif
        x += 7;
        c++;
    }
}
开发者ID:goredhawk,项目名称:ardupilot,代码行数:20,代码来源:Display.cpp


示例20: show_maze

void show_maze(int x0, int y0, int x1, int y1)
{
   int x, y;
   for(y=y0; y<=y1; y++)
   {
      for(x=x0; x<=x1; x++)
      {
         draw_char(x, y, maze[x][y].shape, maze[x][y].color);
      }
   }
}
开发者ID:375670450,项目名称:BugEat,代码行数:11,代码来源:bugeatwc.c



注:本文中的draw_char函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ draw_circle函数代码示例发布时间:2022-05-30
下一篇:
C++ draw_box函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap