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


C++ draw_cursor函数代码示例

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


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

示例1: switch

void console::put_char(char ch)
{


  switch (ch)
  {
    case JK_BACKSPACE :
    {
      if (cx)
      {
    if (con_win)
      DrawChar(ivec2(cx, cy), screen[cy*w+cx]);
    cx--;
    if (con_win)
      draw_cursor();
      }
    } break;
    case '\n' :
    case JK_ENTER :
    {
      do_cr();
    } break;
    default :
    {
      screen[cy*w+cx]=ch;
      if (con_win)
        DrawChar(ivec2(cx, cy), ch);
      cx++;
      if (cx>=w) do_cr(); else
      if (con_win) draw_cursor();
    }
  }
}
开发者ID:Xenoveritas,项目名称:abuse,代码行数:33,代码来源:console.cpp

示例2: move_cursor

void move_cursor(U8 col, U8 row, U8 w)
{
    if (cursor_x == col && cursor_y == row && cursor_w == w)
        return;
    draw_cursor(0);
    cursor_x = col;
    cursor_y = row;
    cursor_w = w;
    draw_cursor(1);
}
开发者ID:MonteCarlos,项目名称:kweeca,代码行数:10,代码来源:cursor.c

示例3: dec_cursor

/* Returns 1 if cursor position could be decremented */
static int
dec_cursor(){
	if (cursor_pos <= 0) 
		return 0;
	
	/* Clear old cursor */
	draw_cursor(pcursor_win, cursor_pos, 0);
	
	/* Draw new cursor at new position */
	cursor_on = 1;
	cursor_pos--;
	draw_cursor(pcursor_win, cursor_pos, cursor_on);
	return 1;	
};
开发者ID:HerrSchrader,项目名称:McBetty,代码行数:15,代码来源:window.c

示例4: advance_cursor

/* Returns 1 if cursor could be advanced */
static int
advance_cursor(){
	/* We must not move beyond end of string */
	if ('\0' == pcursor_win->txt[cursor_pos])
		return 0;
	
	/* Clear old cursor */
	draw_cursor(pcursor_win, cursor_pos, 0);
	
	/* Draw new cursor at new position */
	cursor_on = 1;
	cursor_pos++;
	draw_cursor(pcursor_win, cursor_pos, cursor_on);
	return 1;
};
开发者ID:HerrSchrader,项目名称:McBetty,代码行数:16,代码来源:window.c

示例5: othello_draw_background

static void othello_draw_background(void)
{
    UINT8 i, j;

    drawSquare(BK_X_OFFSET, BK_Y_OFFSET, 320, 320, WSTL_GAME_BG_02);

    for (i = 0; i <= BOARD_COLS; i++)
    {
        OSD_DrawVerLine(BK_X_OFFSET + i * GRID_WIDTH, \
              BK_Y_OFFSET, BOARD_ROWS * GRID_WIDTH, \
              WSTL_GAME_LINE_IDX, NULL);
    }
    for (i = 0; i <= BOARD_ROWS; i++)
    {
        OSD_DrawHorLine(BK_X_OFFSET, BK_Y_OFFSET + i * GRID_WIDTH, \
              BOARD_COLS * GRID_WIDTH, WSTL_GAME_LINE_IDX, NULL);
        OSD_DrawHorLine(BK_X_OFFSET, \
              BK_Y_OFFSET + i * GRID_WIDTH + 1, \
              BOARD_COLS * GRID_WIDTH, WSTL_GAME_LINE_IDX, NULL);
	}

	for (i = 0; i < BOARD_ROWS; i++)
	{
		for (j = 0; j < BOARD_COLS; j++)
		{
			if (chess_board.board[i + 1][j + 1] == CHESS_BLACK)
				draw_chess(i, j, CHESS_BLACK);
			if (chess_board.board[i + 1][j + 1] == CHESS_WHITE)
				draw_chess(i, j, CHESS_WHITE);
		}
	}

	draw_cursor(cur_row, cur_col, WSTL_GAME_CURSOR_IDX);
}
开发者ID:jinfeng-geeya,项目名称:3202C,代码行数:34,代码来源:win_game_othello.c

示例6: move_cursor_up

static void
move_cursor_up(InputItem *sym)
{
    int bp = sym->curr_line->buff_pntr;
    /*int size = sym->size;*/
    LineStruct *trace;

    /* get to the end of the current line */
    for (trace = sym->curr_line;
         trace->prev && trace->prev->len > sym->size;
         trace = trace->prev)
            ;

    if (!trace->prev)
        BeepAtTheUser();
    else {
        clear_cursor(sym);
        sym->curr_line = trace->prev;
        if (bp > sym->curr_line->len)
            sym->curr_line->buff_pntr = sym->curr_line->len;
        else
            sym->curr_line->buff_pntr = bp;
        draw_cursor(sym);
    }
}
开发者ID:EmmanuelCharpentier,项目名称:fricas,代码行数:25,代码来源:dialog.c

示例7: inner_location

void textbox::draw_contents()
{
	SDL_Rect const &loc = inner_location();

	surface surf = video().getSurface();
	draw_solid_tinted_rectangle(loc.x,loc.y,loc.w,loc.h,0,0,0,
				    focus(NULL) ? alpha_focus_ : alpha_, surf);

	SDL_Rect src;

	if(text_image_ == NULL) {
		update_text_cache(true);
	}

	if(text_image_ != NULL) {
		src.y = yscroll_;
		src.w = std::min<size_t>(loc.w,text_image_->w);
		src.h = std::min<size_t>(loc.h,text_image_->h);
		src.x = text_pos_;
		SDL_Rect dest = screen_area();
		dest.x = loc.x;
		dest.y = loc.y;

		// Fills the selected area
		if(is_selection()) {
			const int start = std::min<int>(selstart_,selend_);
			const int end = std::max<int>(selstart_,selend_);
			int startx = char_x_[start];
			int starty = char_y_[start];
			const int endx = char_x_[end];
			const int endy = char_y_[end];

			while(starty <= endy) {
				const size_t right = starty == endy ? endx : text_image_->w;
				if(right <= size_t(startx)) {
					break;
				}

				SDL_Rect rect = create_rect(loc.x + startx
						, loc.y + starty - src.y
						, right - startx
						, line_height_);

				const clip_rect_setter clipper(surf, &loc);

				Uint32 color = SDL_MapRGB(surf->format, 0, 0, 160);
				fill_rect_alpha(rect, color, 140, surf);

				starty += int(line_height_);
				startx = 0;
			}
		}

		sdl_blit(text_image_, &src, surf, &dest);
	}

	draw_cursor((cursor_pos_ == 0 ? 0 : cursor_pos_ - 1), video());

	update_rect(loc);
}
开发者ID:SkyPrayerStudio,项目名称:War-Of-Kingdom,代码行数:60,代码来源:textbox.cpp

示例8: draw_mandel

// draw the current mandelbro set
static void draw_mandel() {
		GrCopyArea(mandel_wid, mandel_gc, 0, 0,
			   screen_width, screen_height,
			   level[current_depth].mandel_buffer, 0, 0, MWROP_SRCCOPY);
			   
		if (show_cursor) draw_cursor();
}
开发者ID:Keripo,项目名称:ProjectZeroSlackr-SVN,代码行数:8,代码来源:mandelpod.c

示例9: cursor_init

static void
cursor_init(JoyScreen *self)
{
	JoyCursor *cursor = NULL;
	cairo_t *cr = NULL;
	cairo_surface_t *image = joy_screen_cairo_surface_create(self, 20, 20);
	if (!image) {
		goto exit;
	}
	cr = cairo_create(image);
	cairo_save(cr);
	cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
	cairo_paint(cr);
	cairo_restore(cr);
	draw_cursor(cr);
#if !CAIRO_HAS_GFX3D_SURFACE
	GFX3D_Display_Cache_Flush(GET_PRIVATE(self)->display);
#endif // !CAIRO_HAS_GFX3D_SURFACE
	cursor = joy_cursor_new(image, 0, 0);
	if (!cursor) {
		goto exit;
	}
	joy_gfx3d_screen_set_cursor(self, cursor);
	joy_gfx3d_screen_show_cursor(self);
exit:
	if (cursor) {
		g_object_unref(cursor);
	}
	if (cr) {
		cairo_destroy(cr);
	}
	if (image) {
		cairo_surface_destroy(image);
	}
}
开发者ID:msteinert,项目名称:joybubbles,代码行数:35,代码来源:screen.c

示例10: mouse_timeslice

int mouse_timeslice() 
{	
	if (mouse.x != cursorx || mouse.y != cursory) 	// if the mouse moved...
	{
		restore_pixels(CursorBuffer);
		cursorx = mouse.x;		// save for comparison on next timeslice.
		cursory = mouse.y;
		save_pixels(CursorBuffer, cursorx, cursory, mouse.max_x, mouse.max_y, CUR_SIZ);

		// draw cursor:
		draw_cursor(cursorx, cursory, mouse.max_x, mouse.max_y, CUR_SIZ);
	}
	if (mouse.left & UNHANDLED_EVENT)
	{
		mouse.left &= (~UNHANDLED_EVENT);	// clear the flag.
		int retval = mouse.left;
		return (retval<<4);			// 1=> button down.  0=> button up
	}
	if (mouse.right & UNHANDLED_EVENT)
	{
		mouse.right &= (~UNHANDLED_EVENT);	// clear the flag.
		return ((mouse.right)<<4);			// 1=> button down.  0=> button up
	}
	return 0;
}
开发者ID:stenniswood,项目名称:bk_code,代码行数:25,代码来源:mouse.c

示例11: move_cursor_backward

static void
move_cursor_backward(InputItem *sym)
{
    if (sym->curr_line->buff_pntr == 0) {
        if (sym->curr_line->prev == NULL) {
            /* now where to move */
            BeepAtTheUser();
            return;
        }
        else {
            clear_cursor(sym);
            /* move up to the previous line */
            sym->curr_line = sym->curr_line->prev;
            if (sym->curr_line->len > sym->size)
                sym->curr_line->buff_pntr = sym->size - 1;
            else
                sym->curr_line->buff_pntr = sym->curr_line->len;
        }
    }
    else {                      /* just slide back a char. on the current
                                 * line */
        clear_cursor(sym);
        sym->curr_line->buff_pntr--;
    }
    draw_cursor(sym);
}
开发者ID:EmmanuelCharpentier,项目名称:fricas,代码行数:26,代码来源:dialog.c

示例12: zoom_out

// as its name suggests
static void zoom_out() {

	double dx,dy;

	current_depth--;
	if (current_depth<0) {
		current_depth=0;
		mandel_quit();
		return;
	}
	if (!(current_depth%2)) iterations=iterations/2;

	cursor_x = level[current_depth].cursor_pos%selection_size;
	cursor_y = level[current_depth].cursor_pos/selection_size;

	if (xMax>xMin) dx = xMax-xMin;
	else dx = xMin -xMax;
	xMin-=cursor_x*dx;
	xMax+=(selection_size-1-cursor_x)*dx;

	if (yMax>yMin) dy = yMax -yMin;
	else dy = yMin -yMax;
	yMin-=cursor_y*dy;
	yMax+=(selection_size-1-cursor_y)*dy;

	GrCopyArea(mandel_wid, mandel_gc, 0, 0,
			   screen_width, screen_height,
			   level[current_depth].mandel_buffer, 0, 0, MWROP_SRCCOPY);

	draw_cursor();
}
开发者ID:Keripo,项目名称:ProjectZeroSlackr-SVN,代码行数:32,代码来源:mandelpod.c

示例13: dc_capture_capture

void dc_capture_capture(struct dc_capture *capture, HWND window)
{
	HDC hdc_target;
	HDC hdc;

	if (capture->capture_cursor) {
		memset(&capture->ci, 0, sizeof(CURSORINFO));
		capture->ci.cbSize = sizeof(CURSORINFO);
		capture->cursor_captured = GetCursorInfo(&capture->ci);
	}

	if (++capture->cur_tex == capture->num_textures)
		capture->cur_tex = 0;

	hdc = dc_capture_get_dc(capture);
	if (!hdc) {
		blog(LOG_WARNING, "[capture_screen] Failed to get "
		                  "texture DC");
		return;
	}

	hdc_target = GetDC(window);

	BitBlt(hdc, 0, 0, capture->width, capture->height,
			hdc_target, capture->x, capture->y, SRCCOPY);

	ReleaseDC(NULL, hdc_target);

	if (capture->cursor_captured)
		draw_cursor(capture, hdc);

	dc_capture_release_dc(capture);

	capture->textures_written[capture->cur_tex] = true;
}
开发者ID:GamingAtheist,项目名称:obs-studio,代码行数:35,代码来源:dc-capture.c

示例14: render_exit_menu

void render_exit_menu(exit_menu_t *state, float cursor_x, float cursor_y)
{
    // Update center of cursor
    set_cursor_position(state->cursor_state, cursor_x, cursor_y);

    // Check if anything selected
    check_cursor_in_image(state->cursor_state, state->mandelbrot_state);
    check_cursor_in_image(state->cursor_state, state->sph_state);
    check_cursor_in_image(state->cursor_state, state->terminal_state);

    // Draw background rectangle
    float center[2] = {0.0f, 0.0f};
    float gl_dims[2] = {2.0f, 0.7f};
    float background_color[4] = {1.0f, 1.0f, 1.0f, 0.8f};
    render_rectangle(state->rectangle_state, center, gl_dims, background_color);

    // Draw mandelbrot image
    draw_image(state->mandelbrot_state);

    // Draw terminal image
    draw_image(state->terminal_state);

    // Draw SPH image
    draw_image(state->sph_state);

    // Draw cursor
    draw_cursor(state->cursor_state);
}
开发者ID:AnthonyDiGirolamo,项目名称:SPH,代码行数:28,代码来源:exit_menu_gl.c

示例15: move_cursor_forward

static void
move_cursor_forward(InputItem *sym)
{
    if (sym->curr_line->buff_pntr == sym->curr_line->len &&
        !sym->curr_line->next) {
        BeepAtTheUser();
        return;
    }


    if (sym->curr_line->buff_pntr == sym->curr_line->len ||
        sym->curr_line->buff_pntr == sym->size - 1)
    {

        /* I have to move down to a new line */

        if (sym->curr_line->next == NULL) {
            /* now where to move */
            BeepAtTheUser();
            return;
        }

        /* move down line */

        clear_cursor(sym);
        sym->curr_line = sym->curr_line->next;
        sym->curr_line->buff_pntr = 0;
    }
    else {
        clear_cursor(sym);
        sym->curr_line->buff_pntr++;
    }

    draw_cursor(sym);
}
开发者ID:EmmanuelCharpentier,项目名称:fricas,代码行数:35,代码来源:dialog.c


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