当前位置: 首页>>代码示例>>C++>>正文


C++ set_cursor函数代码示例

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


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

示例1: main

int main (void) {

  PINSEL10 = 0;                             /* Disable ETM interface */
  FIO2DIR = LEDMSK;                         /* LEDs, port 2, bit 0~7 output only */

  lcd_init();
  lcd_clear();
  lcd_print ("MCB2300 HID Demo");
  set_cursor (0, 1);
  lcd_print ("  www.keil.com  ");

  	Nr = 128;
	Nk = Nr / 32;
	Nr = Nk + 6;
	KeyExpansion(Key, Nk, Nr);

  USB_Init();                               /* USB Initialization */
  USB_Connect(TRUE);                        /* USB Connect */

  while (1);                                /* Loop forever */
}
开发者ID:hksonngan,项目名称:mytesgnikrow,代码行数:21,代码来源:demo.c

示例2: line_drawing_selected

void
line_drawing_selected(void)
{
    canvas_kbd_proc = (FCallBack)null_proc;
    canvas_locmove_proc = null_proc;
    canvas_leftbut_proc = (FCallBack)init_line_drawing;
    canvas_middlebut_proc = (FCallBack)init_line_freehand_drawing;
    set_cursor(crosshair_cursor);
    reset_action_on();
    if (cur_mode == F_POLYGON) {
	set_mousefun("first point", "freehand", "", "", "", "");
	min_num_points = 3;
	canvas_rightbut_proc = (FCallBack)null_proc;
    } else {
	set_mousefun("first point", "freehand", "single point", "dimension line", "", "");
	min_num_points = 1;
	num_point = 0;
	fix_x = fix_y = -1;
	canvas_rightbut_proc = (FCallBack)create_lineobject;
    }
}
开发者ID:coliveira,项目名称:xfignew,代码行数:21,代码来源:d_line.cpp

示例3: display_character

// 2 bytes are written: <color> then <character>
void display_character(uint8_t c) {
	uint16_t attr = color << 8; // first byte is color
	uint16_t *loc = video_memory + (80*cursor_y + cursor_x);

	// backspace
	if (c == 0x08 && !(cursor_x==0 && cursor_y==8)) {
		if (cursor_x == 0) {
			cursor_x = 79;
			cursor_y --;
		}
		else
			cursor_x--;
		*(loc-1) = ' ' | attr;
	}
	// tab
	else if (c == 0x09) cursor_x = 8 * ((cursor_x+8)/8);
	// carriage return
	else if (c == '\r') cursor_x = 0;
	// new line
	else if (c == '\n') {
		cursor_x = 0;
		cursor_y++;
	}	
	// other characters
	else if(c >= 32) {
		*loc = c | attr;
		cursor_x++;
	}

	// edge conditions
	if (cursor_x >= 80) { // goto next line
		cursor_x = 0;
		cursor_y++;
	}
	if (cursor_y >= 25) { // scroll screen up
		scroll_screen();
	}

	set_cursor(cursor_x,cursor_y);
}
开发者ID:Alecyte,项目名称:OSGroup1,代码行数:41,代码来源:display.c

示例4: getDisplay

void XAbstractGui::toggle_mouse_capture()
{
    XTextProperty titleProperty;
    Display       *dpy;
    const char    *title;
    char          **list;

    dpy = getDisplay();
    cursor_type = (cursor_type == FLX_DEFAULT_CURSOR) ?
                  FLX_INVISIBLE_CURSOR : FLX_DEFAULT_CURSOR;
    title = get_title();
    list  = const_cast<char **>(&title);

    if (XStringListToTextProperty(list, 1, &titleProperty) != 0)
    {
        XSetWMName(dpy, getWindow(FLX_MAIN), &titleProperty);
        XFree(titleProperty.value);
    }

    if (cursor_type == FLX_DEFAULT_CURSOR)
    {
        XUngrabPointer(dpy, CurrentTime);
    }
    else
    {
        unsigned int event_mask;

        event_mask = ButtonPressMask | ButtonReleaseMask |
                     EnterWindowMask | LeaveWindowMask | PointerMotionMask |
                     PointerMotionHintMask | Button1MotionMask |
                     Button2MotionMask | Button3MotionMask |
                     Button4MotionMask | Button5MotionMask |
                     ButtonMotionMask | KeymapStateMask;
        XGrabPointer(dpy, getWindow(), True, event_mask,
                     GrabModeAsync, GrabModeAsync, getWindow(),
                     None, CurrentTime);
    }

    set_cursor(cursor_type);
}
开发者ID:aladur,项目名称:flexemu,代码行数:40,代码来源:xabsgui.cpp

示例5: main

int main (void) {
  int i;
  

  Init_Timer1( );
  init_serial();                               /* Init UART                   */
  uart_init_0 ( );
  lcd_init();
  lcd_clear();
  lcd_print ("HSM AO Compare");
  set_cursor (0, 1);
  lcd_print ("EventDrivenSystem");

  for (i = 0; i < 10000; i++);       /* Wait for initial display           */
 

  comp_main();

 
 

}
开发者ID:roland-wilhelm,项目名称:eds,代码行数:22,代码来源:compmain.c

示例6: MenuAO_BrewStrengthMenu

/**
 * BrewStrengthMenu state handler
 **/
static QState MenuAO_BrewStrengthMenu(MenuAO *me, QEvent const *e)
{
    switch ( e->sig )
    {
    case Q_INIT_SIG:
    {
        return Q_HANDLED();
    }

    case Q_ENTRY_SIG:
    {
        // display brew strength menu (1st row of LCD)
        sprintf(output, "2: Strength %d", 2*me->brewStrength+2);
        lcd_clear();
        set_cursor(0, 0);
        lcd_print((unsigned char*)output);

        return Q_HANDLED();
    }

    case BUTTON_SHORTPRESS_SIG:
    {
        // short press > proceed to next submenu
        return Q_TRAN(&MenuAO_AlarmMenu);
    }

    case BUTTON_LONGPRESS_SIG:
    {
        return Q_TRAN(&MenuAO_ChangeBrewStrength);
    }

    case Q_EXIT_SIG:
    {
        return Q_HANDLED();
    }
    }

    return Q_SUPER(&MenuAO_Idle);
}
开发者ID:roland-wilhelm,项目名称:eds,代码行数:42,代码来源:menu_ao.c

示例7: assert

void
List::remove_local(uint32_t position)
{
	vector<ListItem *>::iterator iter;

	assert(position >= 0);
	assert(position < size());

	iter = items.begin() + position;
	assert(iter != items.end());
	assert(*iter);

	(*iter)->set_selected(false);
	delete *iter;
	items.erase(iter);

	if (cursor_position >= size()) {
		set_cursor(size() - 1);
	}

	set_selection_cache_valid(false);
}
开发者ID:reynhout,项目名称:pms,代码行数:22,代码来源:list.cpp

示例8: kernel_main

/* --- Kernel entrypoint --- */
int
kernel_main()
{
    /*
     * Tell the kernel memory allocator which memory it can't use.
     * It already knows not to touch kernel image.
     */

    /* Everything above 16M */
    lmm_remove_free( &malloc_lmm, (void*)USER_MEM_START, -8 - USER_MEM_START );
    
    /* Everything below 1M */
    lmm_remove_free( &malloc_lmm, (void*)0, 0x100000 );

    if(handler_install() < 0) {
      return 0;
    }

    /*
     * initialize the PIC so that IRQs and
     * exception handlers don't overlap in the IDT.
     */
    pic_init( BASE_IRQ_MASTER_BASE, BASE_IRQ_SLAVE_BASE );

    clear_console();

    show_cursor();

    set_term_color(FGND_GREEN | BGND_BLACK);

    set_cursor(12, 34);

    putbytes("Hello World!\n", 13);

    while(1) {
    }

    return 0;
}
开发者ID:kikimo,项目名称:pebble,代码行数:40,代码来源:410_test.c

示例9: print_char

/*
 Print a char on the screen at col, row, or at cursor position
*/
void print_char(char nChar, int nCol, int nRow, char nAttribute)
{
	unsigned char * pVidMem = (unsigned char*) VIDEO_ADDRESS;

	if (!nAttribute)
	{
		nAttribute = WHITE_ON_BLACK;
	}

	int offset = 0;
	
//	if (nCol >= 0 && nRow >= 0)
//	{
//		offset = get_screen_offset(nCol, nRow);
//	}	
//	else
//	{
		offset = get_cursor();
//	}


	
	if (nChar == '\n')
	{
		int rows = offset / (2*MAX_COLS);
		offset = get_screen_offset(79, rows);
		offset += 2;
	}
	else
	{
		pVidMem[offset] = nChar;
		pVidMem[offset + 1] = nAttribute;
		offset += 2;		
	}
	
	offset = handle_scrolling(offset);
	
	set_cursor(offset);
}
开发者ID:daomtquan,项目名称:MisaOS,代码行数:42,代码来源:screen.c

示例10: print_char

/* Print a char on the screen at col , row , or at cursor position */
void print_char(const char character, int col, int row, char attribute_byte)
{
  /* Create a byte ( char ) pointer to the start of video memory */
  unsigned char volatile *vidmem = VIDEO_ADDRESS;
  /* If attribute byte is zero , assume the default style . */
  if (!attribute_byte) {
    attribute_byte = WHITE_ON_BLACK;
  }
  /* Get the video memory offset for the screen location */
  int offset;
  /* If col and row are non - negative , use them for offset . */
  if (col >= 0 && row >= 0) {
    offset = get_screen_offset(col, row);
    /* Otherwise , use the current cursor position . */
  } else {
    offset = get_cursor();
  }
  // If we see a newline character , set offset to the end of
  // current row , so it will be advanced to the first col
  // of the next row.
  if (character == '\n') {
    int rows = offset / (2 * MAX_COLS);
    offset = get_screen_offset(79, rows);
    // Otherwise , write the character and its attribute byte to
    // video memory at our calculated offset .
  } else {
    vidmem[offset] = character;
    vidmem[offset + 1] = attribute_byte;
  }
  // Update the offset to the next character cell , which is
  // two bytes ahead of the current cell .
  offset += 2;
  // Make scrolling adjustment , for when we reach the bottom
  // of the screen .
  offset = handle_scrolling(offset);
  // Update the cursor position on the screen device .
  set_cursor(offset);
}
开发者ID:x1596357,项目名称:SimpleOS,代码行数:39,代码来源:screen.c

示例11: main

int main( int argc, char *argv[] ){
    int x,y;
    int quit = 0;
    init_cursor();
    bClick = 0;
    if( SDL_Init( SDL_INIT_VIDEO ) < 0){
        exit( -1 );
    }

    if( !SDL_SetVideoMode( 320, 200, 0, 0 ) ){
        SDL_Quit();
        exit( -1 );
    }

    time(&last_mouse);
    SDL_EnableUNICODE( 1 );
    set_cursor(x, y);
    while( !quit ){
        check_time();
        while( SDL_PollEvent( &event ) ){
            switch( event.type ){
                case SDL_KEYDOWN:
                    PrintKeyInfo( &event.key );
                    break;
                case SDL_QUIT:
                    quit = 1;
                    break;
                default:
                    checkHold();
                    break;
            }
        }
        sleep(.05);

    }
    SDL_Quit();
    exit( 0 );
}
开发者ID:PurdueSIGAI,项目名称:IRIS,代码行数:38,代码来源:Keylistener.c

示例12: init_screen

/**
 * Initialize the console of a certain tty.
 * 
 * @param tty  Whose console is to be initialized.
 *****************************************************************************/
PUBLIC void init_screen(TTY* tty)
{
	int nr_tty = tty - tty_table;
	CONSOLE * con = console_table + nr_tty;
	con->con_tty = tty;
	tty->tty_devwrite = cons_write;
	tty->tty_echo = out_char;
	kb_init(tty);
	/* 
	 * NOTE:
	 *   variables related to `position' and `size' below are
	 *   in WORDs, but not in BYTEs.
	 */
	int v_mem_size = V_MEM_SIZE >> 1; /* size of Video Memory */
	int size_per_con = v_mem_size / NR_CONSOLES;
	con->orig = nr_tty * size_per_con;
	con->con_size = size_per_con / SCR_WIDTH * SCR_WIDTH;
	con->cursor = con->crtc_start = con->orig;
	con->is_full = 0;

	tty->tty_dev = con;
	if (nr_tty == 0) {
		((CONSOLE *)tty->tty_dev)->cursor = disp_pos / 2;
		disp_pos = 0;
	}
	/*else {*/
		/* 
		 * `?' in this string will be replaced with 0, 1, 2, ...
		 */
	/*	const char prompt[] = "[tty #?]\n";

		const char * p = prompt;
		for (; *p; p++)
			out_char(tty, *p == '?' ? nr_tty + '0' : *p);
	}*/

	set_cursor(((CONSOLE *)tty->tty_dev)->cursor);
}
开发者ID:Jimx-,项目名称:lyos,代码行数:43,代码来源:console.c

示例13: get_x

void ttext_box::handle_mouse_selection(tpoint mouse, const bool start_selection)
{
	mouse.x -= get_x();
	mouse.y -= get_y();
	// FIXME we don't test for overflow in width
	if(mouse.x < static_cast<int>(text_x_offset_)
	   || mouse.y < static_cast<int>(text_y_offset_)
	   || mouse.y >= static_cast<int>(text_y_offset_ + text_height_)) {
		return;
	}

	int offset = get_column_line(tpoint(mouse.x - text_x_offset_, mouse.y - text_y_offset_)).x;

	if(offset < 0) {
		return;
	}


	set_cursor(offset, !start_selection);
	update_canvas();
	set_is_dirty(true);
	dragging_ |= start_selection;
}
开发者ID:CliffsDover,项目名称:wesnoth,代码行数:23,代码来源:text_box.cpp

示例14: GDISP_LLD

	/**
	 * @brief   Get the color of a particular pixel.
	 * @note    Optional.
	 * @note    If x,y is off the screen, the result is undefined.
	 *
	 * @param[in] x, y     The start of the text
	 *
	 * @notapi
	 */
	color_t GDISP_LLD(getpixelcolor)(coord_t x, coord_t y) {
		/* This routine is marked "DO NOT USE" in the original
		 *  GLCD driver. We just keep our GDISP_HARDWARE_READPIXEL
		 *  turned off for now.
		 */
		color_t color;

		#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
			if (x < 0 || x >= GDISP.Width || y < 0 || y >= GDISP.Height) return 0;
		#endif

		aquire_bus();
		set_cursor(x, y);
		stream_start();

		color = lld_lcdReadData();
		color = lld_lcdReadData();

		stream_stop();
		release_bus();

		return color;
	}
开发者ID:lord67,项目名称:ChibiOS-GFX,代码行数:32,代码来源:gdisp_lld.c

示例15: cancel_place_lib_obj

void
cancel_place_lib_obj(int x, int y, int shift)
{
    /* if shift right-button, actually do a place in original position */
    if (shift) {
	place_lib_object_orig(x, y, shift);
	return;
    }
    reset_action_on();
    canvas_leftbut_proc = null_proc;
    canvas_middlebut_proc = null_proc;
    canvas_rightbut_proc = null_proc;
    canvas_locmove_proc = null_proc;
    canvas_ref_proc = null_proc;
    canvas_kbd_proc = null_proc;
    clear_mousefun();
    set_mousefun("","","", "", "", "");
    turn_off_current();
    set_cursor(arrow_cursor);
    put_draw(ERASE);
    /* remove it from the depths */
    remove_compound_depth(new_c);
}
开发者ID:coliveira,项目名称:xfignew,代码行数:23,代码来源:e_placelib.c


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