瀏覽代碼

* Added caca_show/hide_cursor, and corresponding GL binding

tags/v0.99.beta14
Jean-Yves Lamoureux jylam 18 年之前
父節點
當前提交
6239887913
共有 10 個文件被更改,包括 54 次插入2 次删除
  1. +2
    -0
      caca/caca.h
  2. +2
    -0
      caca/caca_internals.h
  3. +2
    -0
      caca/driver_conio.c
  4. +15
    -1
      caca/driver_gl.c
  5. +2
    -1
      caca/driver_ncurses.c
  6. +2
    -0
      caca/driver_network.c
  7. +2
    -0
      caca/driver_slang.c
  8. +2
    -0
      caca/driver_vga.c
  9. +2
    -0
      caca/driver_win32.c
  10. +23
    -0
      caca/graphics.c

+ 2
- 0
caca/caca.h 查看文件

@@ -244,6 +244,8 @@ int caca_get_event(caca_t *kk, unsigned int, struct caca_event *);
int caca_wait_event(caca_t *kk, unsigned int, struct caca_event *);
unsigned int caca_get_mouse_x(caca_t *kk);
unsigned int caca_get_mouse_y(caca_t *kk);
void caca_hide_cursor(caca_t *kk);
void caca_show_cursor(caca_t *kk);
/* @} */

#ifdef __cplusplus


+ 2
- 0
caca/caca_internals.h 查看文件

@@ -117,6 +117,8 @@ struct caca_context
void (* display) (caca_t *);
void (* handle_resize) (caca_t *);
int (* get_event) (caca_t *, struct caca_event *);
void (* show_cursor) (caca_t *);
void (* hide_cursor) (caca_t *);
} drv;

/* Mouse position */


+ 2
- 0
caca/driver_conio.c 查看文件

@@ -163,6 +163,8 @@ int conio_install(caca_t *kk)
kk->drv.display = conio_display;
kk->drv.handle_resize = conio_handle_resize;
kk->drv.get_event = conio_get_event;
kk->drv.show_cursor = NULL;
kk->drv.hide_cursor = NULL;

return 0;
}


+ 15
- 1
caca/driver_gl.c 查看文件

@@ -386,6 +386,19 @@ static int gl_get_event(caca_t *kk, struct caca_event *ev)
return 0;
}


static void gl_show_cursor(caca_t *kk)
{
glutSetCursor(GLUT_CURSOR_RIGHT_ARROW);
}

static void gl_hide_cursor(caca_t *kk)
{
glutSetCursor(GLUT_CURSOR_NONE);
}



/*
* XXX: following functions are local
*/
@@ -464,7 +477,8 @@ int gl_install(caca_t *kk)
kk->drv.display = gl_display;
kk->drv.handle_resize = gl_handle_resize;
kk->drv.get_event = gl_get_event;

kk->drv.show_cursor = gl_show_cursor;
kk->drv.hide_cursor = gl_hide_cursor;
return 0;
}



+ 2
- 1
caca/driver_ncurses.c 查看文件

@@ -542,7 +542,8 @@ int ncurses_install(caca_t *kk)
kk->drv.display = ncurses_display;
kk->drv.handle_resize = ncurses_handle_resize;
kk->drv.get_event = ncurses_get_event;

kk->drv.show_cursor = NULL;
kk->drv.hide_cursor = NULL;
return 0;
}



+ 2
- 0
caca/driver_network.c 查看文件

@@ -562,6 +562,8 @@ int network_install(caca_t *kk)
kk->drv.display = network_display;
kk->drv.handle_resize = network_handle_resize;
kk->drv.get_event = network_get_event;
kk->drv.show_cursor = NULL;
kk->drv.hide_cursor = NULL;

return 0;
}


+ 2
- 0
caca/driver_slang.c 查看文件

@@ -480,6 +480,8 @@ int slang_install(caca_t *kk)
kk->drv.display = slang_display;
kk->drv.handle_resize = slang_handle_resize;
kk->drv.get_event = slang_get_event;
kk->drv.show_cursor = NULL;
kk->drv.hide_cursor = NULL;

return 0;
}


+ 2
- 0
caca/driver_vga.c 查看文件

@@ -157,6 +157,8 @@ int vga_install(caca_t *kk)
kk->drv.display = vga_display;
kk->drv.handle_resize = vga_handle_resize;
kk->drv.get_event = vga_get_event;
kk->drv.show_cursor = NULL;
kk->drv.hide_cursor = NULL;

return 0;
}


+ 2
- 0
caca/driver_win32.c 查看文件

@@ -345,6 +345,8 @@ int win32_install(caca_t *kk)
kk->drv.display = win32_display;
kk->drv.handle_resize = win32_handle_resize;
kk->drv.get_event = win32_get_event;
kk->drv.show_cursor = NULL;
kk->drv.hide_cursor = NULL;

return 0;
}


+ 23
- 0
caca/graphics.c 查看文件

@@ -143,6 +143,29 @@ void caca_display(caca_t *kk)
kk->lastticks = 0;
}

/** \brief Show cursor on capable drivers
*
* This function shows the cursor on drivers permitting it.
*
*/
void caca_show_cursor(caca_t *kk)
{
if(kk->drv.show_cursor)
kk->drv.show_cursor(kk);
}

/** \brief Hide cursor on capable drivers
*
* This function hides the cursor on drivers permitting it.
*
*/
void caca_hide_cursor(caca_t *kk)
{
if(kk->drv.show_cursor)
kk->drv.show_cursor(kk);
}


/*
* XXX: following functions are local
*/


Loading…
取消
儲存