本文整理汇总了C++中draw_cursor函数的典型用法代码示例。如果您正苦于以下问题:C++ draw_cursor函数的具体用法?C++ draw_cursor怎么用?C++ draw_cursor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了draw_cursor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: draw_buffer
luna draw_buffer(int id) {
int SCR_W, SCR_H, line_number_offset;
getmaxyx(stdscr, SCR_H, SCR_W);
Buffer *target = get_buffer(id);
if (target == NULL) {
return INVALID_ID;
} else {
line_number_offset = floor(log10(abs(target->n_rows + 1))) + 2;
char line_number[line_number_offset + 1];
int i = 0;
int rawrow;
for(rawrow = 0; rawrow < SCR_H; rawrow++) {
if (i >= target->n_rows) {
mvaddch(rawrow, 0, '~');
} else {
sprintf(line_number, "%d", i + 1);
mvaddch(rawrow, line_number_offset - 1, '|');
mvprintw(rawrow, 0, line_number);
if (target->rows[i].length > 0) {
mvprintw(rawrow, line_number_offset, target->rows[i].content);
}
if (target->rows[i].length > SCR_W) {
rawrow++;
}
}
i++;
}
draw_cursor(id, line_number_offset);
draw_status_line();
}
return SUCCESS;
}
开发者ID:Mattykins,项目名称:Luna,代码行数:34,代码来源:display_utils.c
示例17: w_draw_form
void w_draw_form(t_env *e)
{
t_coord pos;
t_coord dim;
dim.x = 30;
dim.y = 30;
pos.x = 5;
pos.y = 5;
create_img(e, dim, "xpm/close.xpm", pos);
dim.x = 36;
dim.y = 12;
pos.x = 200;
pos.y = e->height / 6;
if (e->set->color == 1)
create_img(e, dim, "xpm/on.xpm", pos);
else
create_img(e, dim, "xpm/off.xpm", pos);
pos.y = 5 * e->height / 6;
mlx_string_put(e->mlx, e->win, 200, pos.y - 5, 0xff1212, "Beta !");
if (e->set->straff == 1)
create_img(e, dim, "xpm/on.xpm", pos);
else
create_img(e, dim, "xpm/off.xpm", pos);
dim.x = 200;
pos.y = 3 * e->height / 6;
draw_cursor(e, dim, pos, 0x8904B1);
}
开发者ID:thiefaine,项目名称:C_WOLF3D,代码行数:28,代码来源:w_settings.c
示例18: draw
void Sliderule :: draw (wxBufferedPaintDC & dc) {
if (root == NULL) return;
dc . SetBackground (wxBrush (wxColour (background_colour . red, background_colour . green, background_colour . blue)));
dc . Clear ();
root -> draw (dc);
draw_cursor (dc);
draw_readouts (dc);
}
开发者ID:gjmcclure,项目名称:Sliderule-Simulator-or-Emulator,代码行数:8,代码来源:sliderule.cpp
示例19: refresh_game_screen
/**
* Does complete refresh of game screen
*/
void refresh_game_screen() {
ClearVram();
DrawMap2(0, 0, tiles_screen);
draw_field();
draw_molecule(SCREEN_MOLECULE_X, SCREEN_MOLECULE_Y);
draw_statistics();
draw_name();
draw_cursor();
}
开发者ID:Aliandrana,项目名称:uzebox,代码行数:12,代码来源:Atomix.c
示例20: chess_doing
int chess_doing(int x, int y)
{
int m_x = x;
int m_y = y;
int dx = (x-ST_X)%SPACE;
int dy = (y-ST_Y)%SPACE;
if(x < ST_X || x > ST_X+SPACE*(BOARD_X-1)){
if((x > 25)&&(x < 75)&&(y > 75)&&(y < 125)&&(current_player == 1)){
current_color = WHITE;
current_player = 2;
}
if((x > 25)&&(x < 75)&&(y > 175)&&(y < 225)&&(current_player == 2)){
current_color = BLACK;
current_player = 1;
}
return 0;
}
if(y < ST_Y || y > ST_Y+SPACE*(BOARD_Y-1)){
return 0;
}
/*adjust*/
if(dx < SPACE/2){
x -= dx;
}else{
x +=(SPACE-dx);
}
if(dy < SPACE/2){
y -= dy;
}else{
y +=(SPACE-dy);
}
if((diff != current_player)&&(chess_board[(x-ST_X)/SPACE+BOARD_X*(y-ST_Y)/SPACE]) == 0){
restore(m_x, m_y);
// restore(80, 230);
print_circle(x, y, 13, current_color);
diff = current_player;
draw_cursor(m_x, m_y);
chess_sort(x, y);
// draw_cursor(80, 130);
}
// print_logical();
if(chess_vic() != 0){
// print_smile();
return current_player;
}
return 0;
}
开发者ID:Daniel-Xu,项目名称:simple_chess,代码行数:57,代码来源:chess_op.c
注:本文中的draw_cursor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论