Changeset 2821 for libcaca/trunk/caca/caca.c
- Timestamp:
- Sep 27, 2008, 3:12:46 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/caca.c
r2519 r2821 32 32 #endif 33 33 34 #include "cucul.h"35 34 #include "caca.h" 36 35 #include "caca_internals.h" … … 49 48 #endif 50 49 51 /** \brief Attach a caca graphical context to a c uculcanvas.50 /** \brief Attach a caca graphical context to a caca canvas. 52 51 * 53 52 * Create a graphical context using device-dependent features (ncurses for 54 53 * terminals, an X11 window, a DOS command window...) that attaches to a 55 * libc ucul canvas. Everything that gets drawn in the libcuculcanvas can54 * libcaca canvas. Everything that gets drawn in the libcaca canvas can 56 55 * then be displayed by the libcaca driver. 57 56 * 58 * If no c uculcanvas is provided, a new one is created. Its handle can be57 * If no caca canvas is provided, a new one is created. Its handle can be 59 58 * retrieved using caca_get_canvas() and it is automatically destroyed when 60 59 * caca_free_display() is called. … … 66 65 * - \c ENODEV Graphical device could not be initialised. 67 66 * 68 * \param cv The c uculcanvas or NULL to create a canvas automatically.67 * \param cv The caca canvas or NULL to create a canvas automatically. 69 68 * \return The caca graphical context or NULL if an error occurred. 70 69 */ 71 caca_display_t * caca_create_display(c ucul_canvas_t *cv)70 caca_display_t * caca_create_display(caca_canvas_t *cv) 72 71 { 73 72 return caca_create_display_with_driver(cv, NULL); 74 73 } 75 74 76 /** \brief Attach a specific caca graphical context to a c uculcanvas.75 /** \brief Attach a specific caca graphical context to a caca canvas. 77 76 * 78 77 * Create a graphical context using device-dependent features (ncurses for 79 78 * terminals, an X11 window, a DOS command window...) that attaches to a 80 * libc ucul canvas. Everything that gets drawn in the libcuculcanvas can79 * libcaca canvas. Everything that gets drawn in the libcaca canvas can 81 80 * then be displayed by the libcaca driver. 82 81 * 83 * If no c uculcanvas is provided, a new one is created. Its handle can be82 * If no caca canvas is provided, a new one is created. Its handle can be 84 83 * retrieved using caca_get_canvas() and it is automatically destroyed when 85 84 * caca_free_display() is called. … … 94 93 * - \c ENODEV Graphical device could not be initialised. 95 94 * 96 * \param cv The c uculcanvas or NULL to create a canvas automatically.95 * \param cv The caca canvas or NULL to create a canvas automatically. 97 96 * \param driver A string describing the desired output driver or NULL to 98 97 * choose the best driver automatically. 99 98 * \return The caca graphical context or NULL if an error occurred. 100 99 */ 101 caca_display_t * caca_create_display_with_driver(c ucul_canvas_t *cv,100 caca_display_t * caca_create_display_with_driver(caca_canvas_t *cv, 102 101 char const *driver) 103 102 { … … 112 111 if((dp->autorelease = (cv == NULL))) 113 112 { 114 cv = c ucul_create_canvas(0, 0);113 cv = caca_create_canvas(0, 0); 115 114 } 116 115 117 116 dp->cv = cv; 118 117 119 if(c ucul_manage_canvas(cv, (int (*)(void *))caca_can_resize, (void *)dp))118 if(caca_manage_canvas(cv, (int (*)(void *))caca_can_resize, (void *)dp)) 120 119 { 121 120 if(dp->autorelease) 122 c ucul_free_canvas(dp->cv);121 caca_free_canvas(dp->cv); 123 122 free(dp); 124 123 seterrno(EBUSY); … … 128 127 if(caca_install_driver(dp, driver)) 129 128 { 130 c ucul_unmanage_canvas(cv, (int (*)(void *))caca_can_resize, (void *)dp);129 caca_unmanage_canvas(cv, (int (*)(void *))caca_can_resize, (void *)dp); 131 130 if(dp->autorelease) 132 c ucul_free_canvas(dp->cv);131 caca_free_canvas(dp->cv); 133 132 free(dp); 134 133 seterrno(ENODEV); … … 224 223 } 225 224 226 /** \brief Detach a caca graphical context from a c uculbackend context.227 * 228 * Detach a graphical context from its c uculbackend and destroy it. The229 * libc uculcanvas continues to exist and other graphical contexts can be225 /** \brief Detach a caca graphical context from a caca backend context. 226 * 227 * Detach a graphical context from its caca backend and destroy it. The 228 * libcaca canvas continues to exist and other graphical contexts can be 230 229 * attached to it afterwards. 231 230 * 232 * If the c uculcanvas was automatically created by caca_create_display(),231 * If the caca canvas was automatically created by caca_create_display(), 233 232 * it is automatically destroyed and any handle to it becomes invalid. 234 233 * … … 241 240 { 242 241 caca_uninstall_driver(dp); 243 c ucul_unmanage_canvas(dp->cv, (int (*)(void *))caca_can_resize, (void *)dp);242 caca_unmanage_canvas(dp->cv, (int (*)(void *))caca_can_resize, (void *)dp); 244 243 if(dp->autorelease) 245 c ucul_free_canvas(dp->cv);244 caca_free_canvas(dp->cv); 246 245 free(dp); 247 246 … … 251 250 /** \brief Get the canvas attached to a caca graphical context. 252 251 * 253 * Return a handle on the \e c ucul_canvas_t object that was either attached252 * Return a handle on the \e caca_canvas_t object that was either attached 254 253 * or created by caca_create_display(). 255 254 * … … 257 256 * 258 257 * \param dp The libcaca graphical context. 259 * \return The libc uculcanvas.260 */ 261 c ucul_canvas_t * caca_get_canvas(caca_display_t *dp)258 * \return The libcaca canvas. 259 */ 260 caca_canvas_t * caca_get_canvas(caca_display_t *dp) 262 261 { 263 262 return dp->cv; … … 331 330 332 331 /* Mouse position */ 333 dp->mouse.x = c ucul_get_canvas_width(dp->cv) / 2;334 dp->mouse.y = c ucul_get_canvas_height(dp->cv) / 2;332 dp->mouse.x = caca_get_canvas_width(dp->cv) / 2; 333 dp->mouse.y = caca_get_canvas_height(dp->cv) / 2; 335 334 336 335 /* Resize events */
Note: See TracChangeset
for help on using the changeset viewer.