Changeset 540
- Timestamp:
- Mar 7, 2006, 10:17:35 AM (15 years ago)
- Location:
- libcaca/trunk
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/caca.c
r539 r540 22 22 #include "config.h" 23 23 24 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)25 # include <inttypes.h>26 #else27 typedef unsigned int uint32_t;28 typedef unsigned char uint8_t;29 #endif30 31 24 #include <stdlib.h> 32 25 #include <string.h> … … 38 31 39 32 static int caca_init_driver(caca_t *kk); 40 static void caca_init_terminal(caca_t *kk); 41 33 static void caca_check_terminal(caca_t *kk); 34 35 /** \brief Attach a caca graphical context to a cucul backend context. 36 * 37 * Create a graphical context using device-dependent features (ncurses for 38 * terminals, an X11 window, a DOS command window...) that attaches to a 39 * libcucul canvas. Everything that gets drawn in the libcucul canvas can 40 * then be displayed by the libcaca driver. 41 * 42 * \param qq The cucul backend context. 43 * \return The caca graphical context or NULL if an error occurred. 44 */ 42 45 caca_t * caca_attach(cucul_t * qq) 43 46 { 44 int ret;45 47 caca_t *kk = malloc(sizeof(caca_t)); 46 48 47 ret = caca_init_driver(kk);48 49 if( ret)49 kk->qq = qq; 50 51 if(caca_init_driver(kk)) 50 52 { 51 53 free(kk); … … 53 55 } 54 56 55 qq->refcount++; 56 kk->qq = qq; 57 58 /* Only for slang and ncurses */ 59 caca_init_terminal(kk); 60 61 if(_caca_init_graphics(kk)) 62 { 63 qq->refcount--; 57 /* Only needed for slang and ncurses */ 58 caca_check_terminal(kk); 59 60 if(kk->driver.init_graphics(kk)) 61 { 64 62 free(kk); 65 63 return NULL; 66 64 } 67 65 68 /* Initialise events stuff */ 66 /* Attached! */ 67 kk->qq->refcount++; 68 69 /* Graphics stuff */ 70 kk->delay = 0; 71 kk->rendertime = 0; 72 73 /* Events stuff */ 74 #if defined(USE_SLANG) || defined(USE_NCURSES) 69 75 kk->events.key_timer.last_sec = 0; 70 76 kk->events.key_timer.last_usec = 0; … … 72 78 kk->events.autorepeat_ticks = 0; 73 79 kk->events.last_key = 0; 80 #endif 74 81 75 82 kk->timer.last_sec = 0; … … 83 90 } 84 91 92 /** \brief Detach a caca graphical context from a cucul backend context. 93 * 94 * Detach a graphical context from its cucul backend and destroy it. The 95 * libcucul canvas continues to exist and other graphical contexts can be 96 * attached to it afterwards. 97 * 98 * \param qq The caca graphical context. 99 */ 85 100 void caca_detach(caca_t *kk) 86 101 { … … 176 191 } 177 192 178 static void caca_ init_terminal(caca_t *kk)193 static void caca_check_terminal(caca_t *kk) 179 194 { 180 195 #if defined(HAVE_GETENV) && defined(HAVE_PUTENV) && \ -
libcaca/trunk/caca/caca_internals.h
r539 r540 21 21 #define __CACA_INTERNALS_H__ 22 22 23 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME) 24 # include <inttypes.h> 25 #else 26 typedef unsigned char uint8_t; 27 typedef unsigned short uint16_t; 28 typedef unsigned int uint32_t; 29 #endif 30 23 31 #if defined(USE_GL) 24 32 # include <GL/glut.h> … … 103 111 unsigned int (* get_window_height) (caca_t *); 104 112 void (* display) (caca_t *); 105 void (* handle_resize) (caca_t * );113 void (* handle_resize) (caca_t *, unsigned int *, unsigned int *); 106 114 } driver; 107 115 … … 125 133 } events; 126 134 135 /* FIXME: maybe this should go away */ 127 136 #if defined(USE_X11) && !defined(_DOXYGEN_SKIP_ME) 128 137 struct x11 … … 164 173 HANDLE front, back; 165 174 CHAR_INFO *buffer; 175 CONSOLE_CURSOR_INFO cci; 166 176 } win32; 167 177 #endif … … 189 199 }; 190 200 191 /* Initialisation functions */192 extern int _caca_init_graphics(caca_t *kk);193 extern int _caca_end_graphics(caca_t *kk);194 195 201 /* Timer functions */ 196 202 extern void _caca_sleep(unsigned int); 197 203 extern unsigned int _caca_getticks(struct caca_timer *); 198 204 199 /* Cached screen size */200 extern unsigned int _caca_width;201 extern unsigned int _caca_height;202 extern int _caca_resize;203 extern int _caca_resize_event;204 205 205 #endif /* __CACA_INTERNALS_H__ */ -
libcaca/trunk/caca/driver_conio.c
r539 r540 10 10 */ 11 11 12 /** \file graphics.c12 /** \file driver_conio.c 13 13 * \version \$Id$ 14 14 * \author Sam Hocevar <sam@zoy.org> 15 * \brief Character drawing15 * \brief DOS/conio.h driver 16 16 * 17 * This file contains character and string drawing functions.17 * This file contains the libcaca DOS/conio.h input and output driver 18 18 */ 19 19 20 20 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned int uint32_t;26 typedef unsigned char uint8_t;27 #endif28 21 29 22 #if defined(USE_CONIO) … … 51 44 #include "cucul_internals.h" 52 45 53 #if !defined(_DOXYGEN_SKIP_ME) 54 int conio_init_graphics(caca_t *kk) 46 static int conio_init_graphics(caca_t *kk) 55 47 { 56 48 _wscroll = 0; … … 73 65 } 74 66 75 int conio_end_graphics(caca_t *kk)67 static int conio_end_graphics(caca_t *kk) 76 68 { 77 69 _wscroll = 1; … … 86 78 return 0; 87 79 } 88 #endif /* _DOXYGEN_SKIP_ME */89 80 90 int conio_set_window_title(caca_t *kk, char const *title)81 static int conio_set_window_title(caca_t *kk, char const *title) 91 82 { 92 83 return 0; 93 84 } 94 85 95 unsigned int conio_get_window_width(caca_t *kk)86 static unsigned int conio_get_window_width(caca_t *kk) 96 87 { 97 88 /* Fallback to a 6x10 font */ … … 99 90 } 100 91 101 unsigned int conio_get_window_height(caca_t *kk)92 static unsigned int conio_get_window_height(caca_t *kk) 102 93 { 103 94 /* Fallback to a 6x10 font */ … … 105 96 } 106 97 107 void conio_display(caca_t *kk)98 static void conio_display(caca_t *kk) 108 99 { 109 100 int n; … … 123 114 } 124 115 125 void conio_handle_resize(caca_t *kk) 116 static void conio_handle_resize(caca_t *kk, unsigned int *new_width, 117 unsigned int *new_height) 126 118 { 127 return; 119 *new_width = kk->qq->width; 120 *new_height = kk->qq->height; 128 121 } 129 122 -
libcaca/trunk/caca/driver_gl.c
r539 r540 10 10 */ 11 11 12 /** \file graphics.c12 /** \file driver_gl.c 13 13 * \version \$Id$ 14 * \author Sam Hocevar <sam@zoy.org>15 * \brief Character drawing14 * \author Jean-Yves Lamoureux <jylam@lnxscene.org> 15 * \brief OpenGL driver 16 16 * 17 * This file contains character and string drawing functions.17 * This file contains the libcaca OpenGL input and output driver 18 18 */ 19 19 20 20 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned int uint32_t;26 typedef unsigned char uint8_t;27 #endif28 21 29 22 #if defined(USE_GL) … … 83 76 static void gl_handle_mouse_motion(int, int); 84 77 85 int gl_init_graphics(caca_t *kk)78 static int gl_init_graphics(caca_t *kk) 86 79 { 87 80 char *empty_texture; … … 187 180 } 188 181 189 int gl_end_graphics(caca_t *kk)182 static int gl_end_graphics(caca_t *kk) 190 183 { 191 184 glutDestroyWindow(kk->gl.window); … … 193 186 } 194 187 195 int gl_set_window_title(caca_t *kk, char const *title)188 static int gl_set_window_title(caca_t *kk, char const *title) 196 189 { 197 190 glutSetWindowTitle(title); … … 199 192 } 200 193 201 unsigned int gl_get_window_width(caca_t *kk)194 static unsigned int gl_get_window_width(caca_t *kk) 202 195 { 203 196 return kk->gl.width; 204 197 } 205 198 206 unsigned int gl_get_window_height(caca_t *kk)199 static unsigned int gl_get_window_height(caca_t *kk) 207 200 { 208 201 return kk->gl.height; 209 202 } 210 203 211 void gl_display(caca_t *kk)204 static void gl_display(caca_t *kk) 212 205 { 213 206 unsigned int x, y, line; … … 282 275 } 283 276 284 void gl_handle_resize(caca_t *kk) 285 { 286 unsigned int new_width, new_height; 287 288 new_width = kk->qq->width; 289 new_height = kk->qq->height; 290 277 static void gl_handle_resize(caca_t *kk, unsigned int *new_width, 278 unsigned int *new_height) 279 { 291 280 kk->gl.width = kk->gl.new_width; 292 281 kk->gl.height = kk->gl.new_height; 293 282 294 new_width = kk->gl.width / kk->gl.font_width;295 new_height = (kk->gl.height / kk->gl.font_height) + 1;283 *new_width = kk->gl.width / kk->gl.font_width; 284 *new_height = (kk->gl.height / kk->gl.font_height) + 1; 296 285 297 286 glMatrixMode(GL_PROJECTION); -
libcaca/trunk/caca/driver_ncurses.c
r539 r540 10 10 */ 11 11 12 /** \file graphics.c12 /** \file driver_ncurses.c 13 13 * \version \$Id$ 14 14 * \author Sam Hocevar <sam@zoy.org> 15 * \brief Character drawing15 * \brief Ncurses driver 16 16 * 17 * This file contains character and string drawing functions.17 * This file contains the libcaca Ncurses input and output driver 18 18 */ 19 19 20 20 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned int uint32_t;26 typedef unsigned char uint8_t;27 #endif28 21 29 22 #if defined(USE_NCURSES) … … 55 48 #include "cucul_internals.h" 56 49 57 int ncurses_init_graphics(caca_t *);58 int ncurses_end_graphics(caca_t *);59 int ncurses_set_window_title(caca_t *, char const *);60 unsigned int ncurses_get_window_width(caca_t *);61 unsigned int ncurses_get_window_height(caca_t *);62 void ncurses_display(caca_t *);63 void ncurses_handle_resize(caca_t *);64 65 50 /* 66 51 * Local functions 67 52 */ 53 68 54 #if defined(HAVE_SIGNAL) 69 55 static RETSIGTYPE sigwinch_handler(int); … … 71 57 #endif 72 58 73 int ncurses_init_graphics(caca_t *kk)59 static int ncurses_init_graphics(caca_t *kk) 74 60 { 75 61 static int curses_colors[] = … … 158 144 } 159 145 160 int ncurses_end_graphics(caca_t *kk)146 static int ncurses_end_graphics(caca_t *kk) 161 147 { 162 148 mousemask(kk->ncurses.oldmask, NULL); … … 168 154 } 169 155 170 int ncurses_set_window_title(caca_t *kk, char const *title)156 static int ncurses_set_window_title(caca_t *kk, char const *title) 171 157 { 172 158 return 0; 173 159 } 174 160 175 unsigned int ncurses_get_window_width(caca_t *kk)161 static unsigned int ncurses_get_window_width(caca_t *kk) 176 162 { 177 163 /* Fallback to a 6x10 font */ … … 179 165 } 180 166 181 unsigned int ncurses_get_window_height(caca_t *kk)167 static unsigned int ncurses_get_window_height(caca_t *kk) 182 168 { 183 169 /* Fallback to a 6x10 font */ … … 185 171 } 186 172 187 void ncurses_display(caca_t *kk)173 static void ncurses_display(caca_t *kk) 188 174 { 189 175 int x, y; … … 202 188 } 203 189 204 void ncurses_handle_resize(caca_t *kk) 205 { 206 unsigned int new_width, new_height; 190 static void ncurses_handle_resize(caca_t *kk, unsigned int *new_width, 191 unsigned int *new_height) 192 { 207 193 struct winsize size; 208 194 209 new_width = kk->qq->width;210 new_height = kk->qq->height;195 *new_width = kk->qq->width; 196 *new_height = kk->qq->height; 211 197 212 198 if(ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) 213 199 { 214 new_width = size.ws_col;215 new_height = size.ws_row;200 *new_width = size.ws_col; 201 *new_height = size.ws_row; 216 202 #if defined(HAVE_RESIZE_TERM) 217 resize_term( new_height,new_width);203 resize_term(*new_height, *new_width); 218 204 #else 219 resizeterm( new_height,new_width);205 resizeterm(*new_height, *new_width); 220 206 #endif 221 207 wrefresh(curscr); -
libcaca/trunk/caca/driver_slang.c
r539 r540 10 10 */ 11 11 12 /** \file graphics.c12 /** \file driver_slang.c 13 13 * \version \$Id$ 14 14 * \author Sam Hocevar <sam@zoy.org> 15 * \brief Character drawing15 * \brief SLang driver 16 16 * 17 * This file contains character and string drawing functions.17 * This file contains the libcaca SLang input and output driver 18 18 */ 19 19 20 20 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned int uint32_t;26 typedef unsigned char uint8_t;27 #endif28 21 29 22 #if defined(USE_SLANG) … … 113 106 }; 114 107 115 int slang_init_graphics(caca_t *);116 int slang_end_graphics(caca_t *);117 int slang_set_window_title(caca_t *, char const *);118 unsigned int slang_get_window_width(caca_t *);119 unsigned int slang_get_window_height(caca_t *);120 void slang_display(caca_t *);121 void slang_handle_resize(caca_t *);122 123 108 /* 124 109 * Local functions … … 131 116 #endif 132 117 133 #if !defined(_DOXYGEN_SKIP_ME) 134 int slang_init_graphics(caca_t *kk) 118 static int slang_init_graphics(caca_t *kk) 135 119 { 136 120 #if defined(HAVE_SIGNAL) … … 146 130 { 147 131 SLsig_unblock_signals(); 148 return NULL;132 return -1; 149 133 } 150 134 … … 154 138 { 155 139 SLsig_unblock_signals(); 156 return NULL;140 return -1; 157 141 } 158 142 … … 180 164 } 181 165 182 int slang_end_graphics(caca_t *kk)166 static int slang_end_graphics(caca_t *kk) 183 167 { 184 168 SLtt_set_mouse_mode(0, 0); … … 189 173 return 0; 190 174 } 191 #endif /* _DOXYGEN_SKIP_ME */ 192 193 int slang_set_window_title(caca_t *kk, char const *title) 194 { 175 176 static int slang_set_window_title(caca_t *kk, char const *title) 177 { 178 /* FIXME */ 195 179 return 0; 196 180 } 197 181 198 unsigned int slang_get_window_width(caca_t *kk)182 static unsigned int slang_get_window_width(caca_t *kk) 199 183 { 200 184 /* Fallback to a 6x10 font */ … … 202 186 } 203 187 204 unsigned int slang_get_window_height(caca_t *kk)188 static unsigned int slang_get_window_height(caca_t *kk) 205 189 { 206 190 /* Fallback to a 6x10 font */ … … 208 192 } 209 193 210 void slang_display(caca_t *kk)194 static void slang_display(caca_t *kk) 211 195 { 212 196 int x, y; … … 251 235 } 252 236 237 static void slang_handle_resize(caca_t *kk, unsigned int *new_width, 238 unsigned int *new_height) 239 { 240 SLtt_get_screen_size(); 241 *new_width = SLtt_Screen_Cols; 242 *new_height = SLtt_Screen_Rows; 243 244 if(*new_width != kk->qq->width || *new_height != kk->qq->height) 245 SLsmg_reinit_smg(); 246 } 247 253 248 /* 254 249 * XXX: following functions are local 255 250 */ 256 257 void slang_handle_resize(caca_t *kk)258 {259 unsigned int new_width, new_height;260 261 new_width = kk->qq->width;262 new_height = kk->qq->height;263 264 SLtt_get_screen_size();265 new_width = SLtt_Screen_Cols;266 new_height = SLtt_Screen_Rows;267 268 if(new_width != kk->qq->width || new_height != kk->qq->height)269 SLsmg_reinit_smg();270 }271 251 272 252 static void slang_init_palette(void) -
libcaca/trunk/caca/driver_win32.c
r539 r540 10 10 */ 11 11 12 /** \file graphics.c12 /** \file driver_win32.c 13 13 * \version \$Id$ 14 14 * \author Sam Hocevar <sam@zoy.org> 15 * \brief Character drawing15 * \brief Win32 driver 16 16 * 17 * This file contains character and string drawing functions.17 * This file contains the libcaca Win32 input and output driver 18 18 */ 19 19 20 20 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned int uint32_t;26 typedef unsigned char uint8_t;27 #endif28 21 29 22 #if defined(USE_WIN32) … … 88 81 }; 89 82 90 int win32_init_graphics(caca_t *); 91 int win32_end_graphics(caca_t *); 92 int win32_set_window_title(caca_t *, char const *); 93 unsigned int win32_get_window_width(caca_t *); 94 unsigned int win32_get_window_height(caca_t *); 95 void win32_display(caca_t *); 96 void win32_handle_resize(caca_t *); 97 98 int win32_init_graphics(caca_t *kk) 99 { 100 CONSOLE_CURSOR_INFO cci; 83 static int win32_init_graphics(caca_t *kk) 84 { 101 85 CONSOLE_SCREEN_BUFFER_INFO csbi; 102 86 COORD size; … … 112 96 return -1; 113 97 114 GetConsoleCursorInfo(kk->win32.hout, & cci);115 cci.bVisible = FALSE;116 SetConsoleCursorInfo(kk->win32.hout, & cci);98 GetConsoleCursorInfo(kk->win32.hout, &kk->win32.cci); 99 kk->win32.cci.bVisible = FALSE; 100 SetConsoleCursorInfo(kk->win32.hout, &kk->win32.cci); 117 101 118 102 SetConsoleMode(kk->win32.hout, ENABLE_MOUSE_INPUT); … … 145 129 SetConsoleMode(kk->win32.back, 0); 146 130 147 GetConsoleCursorInfo(kk->win32.front, & cci);148 cci.dwSize = 0;149 cci.bVisible = FALSE;150 SetConsoleCursorInfo(kk->win32.front, & cci);151 SetConsoleCursorInfo(kk->win32.back, & cci);131 GetConsoleCursorInfo(kk->win32.front, &kk->win32.cci); 132 kk->win32.cci.dwSize = 0; 133 kk->win32.cci.bVisible = FALSE; 134 SetConsoleCursorInfo(kk->win32.front, &kk->win32.cci); 135 SetConsoleCursorInfo(kk->win32.back, &kk->win32.cci); 152 136 153 137 SetConsoleActiveScreenBuffer(kk->win32.front); … … 161 145 } 162 146 163 int win32_end_graphics(caca_t *kk)147 static int win32_end_graphics(caca_t *kk) 164 148 { 165 149 SetConsoleActiveScreenBuffer(kk->win32.hout); … … 171 155 | FOREGROUND_GREEN 172 156 | FOREGROUND_BLUE); 173 cci.bVisible = TRUE;174 SetConsoleCursorInfo(kk->win32.hout, & cci);157 kk->win32.cci.bVisible = TRUE; 158 SetConsoleCursorInfo(kk->win32.hout, &kk->win32.cci); 175 159 CloseHandle(kk->win32.hout); 176 160 … … 178 162 } 179 163 180 int win32_set_window_title(caca_t *kk, char const *title)164 static int win32_set_window_title(caca_t *kk, char const *title) 181 165 { 182 166 SetConsoleTitle(title); … … 184 168 } 185 169 186 unsigned int win32_get_window_width(caca_t *kk)170 static unsigned int win32_get_window_width(caca_t *kk) 187 171 { 188 172 /* FIXME */ … … 192 176 } 193 177 194 unsigned int win32_get_window_height(caca_t *kk)178 static unsigned int win32_get_window_height(caca_t *kk) 195 179 { 196 180 /* FIXME */ … … 200 184 } 201 185 202 void win32_display(caca_t *kk)186 static void win32_display(caca_t *kk) 203 187 { 204 188 COORD size, pos; … … 225 209 } 226 210 227 void win32_handle_resize(caca_t *kk) 228 { 229 unsigned int new_width, new_height; 230 231 new_width = kk->qq->width; 232 new_height = kk->qq->height; 233 211 static void win32_handle_resize(caca_t *kk, unsigned int *new_width, 212 unsigned int *new_height) 213 { 234 214 /* Nothing to do here. */ 215 *new_width = kk->qq->width; 216 *new_height = kk->qq->height; 235 217 } 236 218 -
libcaca/trunk/caca/driver_x11.c
r539 r540 10 10 */ 11 11 12 /** \file graphics.c12 /** \file driver_x11.c 13 13 * \version \$Id$ 14 14 * \author Sam Hocevar <sam@zoy.org> 15 * \brief Character drawing15 * \brief X11 driver 16 16 * 17 * This file contains character and string drawing functions.17 * This file contains the libcaca X11 input and output driver 18 18 */ 19 19 20 20 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned int uint32_t;26 typedef unsigned char uint8_t;27 #endif28 21 29 22 #if defined(USE_X11) … … 47 40 #include "cucul_internals.h" 48 41 49 int x11_init_graphics(caca_t *);50 int x11_end_graphics(caca_t *);51 int x11_set_window_title(caca_t *, char const *);52 unsigned int x11_get_window_width(caca_t *);53 unsigned int x11_get_window_height(caca_t *);54 void x11_display(caca_t *);55 void x11_handle_resize(caca_t *);56 57 42 /* 58 43 * Local functions … … 60 45 static int x11_error_handler(Display *, XErrorEvent *); 61 46 62 #if !defined(_DOXYGEN_SKIP_ME) 63 int x11_init_graphics(caca_t *kk) 47 static int x11_init_graphics(caca_t *kk) 64 48 { 65 49 static int const x11_palette[] = … … 211 195 } 212 196 213 int x11_end_graphics(caca_t *kk)197 static int x11_end_graphics(caca_t *kk) 214 198 { 215 199 XSync(kk->x11.dpy, False); … … 227 211 return 0; 228 212 } 229 #endif /* _DOXYGEN_SKIP_ME */ 230 231 int x11_set_window_title(caca_t *kk, char const *title) 213 214 static int x11_set_window_title(caca_t *kk, char const *title) 232 215 { 233 216 XStoreName(kk->x11.dpy, kk->x11.window, title); … … 235 218 } 236 219 237 unsigned int x11_get_window_width(caca_t *kk)220 static unsigned int x11_get_window_width(caca_t *kk) 238 221 { 239 222 return kk->qq->width * kk->x11.font_width; 240 223 } 241 224 242 unsigned int x11_get_window_height(caca_t *kk)225 static unsigned int x11_get_window_height(caca_t *kk) 243 226 { 244 227 return kk->qq->height * kk->x11.font_height; 245 228 } 246 229 247 void x11_display(caca_t *kk)230 static void x11_display(caca_t *kk) 248 231 { 249 232 unsigned int x, y, len; … … 309 292 } 310 293 311 void x11_handle_resize(caca_t *kk) 312 { 313 unsigned int new_width, new_height; 314 294 static void x11_handle_resize(caca_t *kk, unsigned int *new_width, 295 unsigned int *new_height) 296 { 315 297 Pixmap new_pixmap; 316 298 317 new_width = kk->qq->width; 318 new_height = kk->qq->height; 319 320 new_width = kk->x11.new_width; 321 new_height = kk->x11.new_height; 299 *new_width = kk->x11.new_width; 300 *new_height = kk->x11.new_height; 322 301 323 302 new_pixmap = XCreatePixmap(kk->x11.dpy, kk->x11.window, -
libcaca/trunk/caca/event.c
r539 r540 19 19 20 20 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned char uint8_t;26 #endif27 21 28 22 #if defined(USE_SLANG) … … 659 653 for( ; ; ) 660 654 { 661 GetNumberOfConsoleInputEvents( win32_hin, &num);655 GetNumberOfConsoleInputEvents(kk->win32.hin, &num); 662 656 if(num == 0) 663 657 break; 664 658 665 ReadConsoleInput( win32_hin, &rec, 1, &num);659 ReadConsoleInput(kk->win32.hin, &rec, 1, &num); 666 660 if(rec.EventType == KEY_EVENT) 667 661 { -
libcaca/trunk/caca/graphics.c
r539 r540 20 20 #include "config.h" 21 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned int uint32_t;26 typedef unsigned char uint8_t;27 #endif28 29 22 #include <stdio.h> /* BUFSIZ */ 30 23 #include <string.h> … … 44 37 */ 45 38 static void caca_handle_resize(caca_t *kk); 46 47 #if !defined(_DOXYGEN_SKIP_ME)48 int _caca_init_graphics(caca_t *kk)49 {50 int ret = kk->driver.init_graphics(kk);51 52 if(!ret)53 return ret;54 55 kk->delay = 0;56 kk->rendertime = 0;57 58 return 0;59 }60 61 int _caca_end_graphics(caca_t *kk)62 {63 return kk->driver.end_graphics(kk);64 }65 #endif /* _DOXYGEN_SKIP_ME */66 39 67 40 /** \brief Set the window title. … … 192 165 unsigned int new_width, new_height; 193 166 194 new_width = kk->qq->width; 195 new_height = kk->qq->height; 196 197 kk->driver.handle_resize(kk); 167 kk->driver.handle_resize(kk, &new_width, &new_height); 198 168 199 169 /* Tell libcucul we changed size */ -
libcaca/trunk/cucul/bitmap.c
r536 r540 19 19 20 20 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned char uint8_t;26 typedef unsigned short uint16_t;27 typedef unsigned int uint32_t;28 #endif29 21 30 22 #if defined(HAVE_ENDIAN_H) -
libcaca/trunk/cucul/box.c
r536 r540 19 19 20 20 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned char uint8_t;26 #endif27 21 28 22 #include <stdlib.h> -
libcaca/trunk/cucul/char.c
r536 r540 19 19 20 20 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned int uint32_t;26 typedef unsigned char uint8_t;27 #endif28 21 29 22 #include <stdio.h> /* BUFSIZ */ … … 103 96 return; 104 97 105 qq->chars[x + y * qq->width] = c & 0x 7f; /* FIXME: ASCII-only */98 qq->chars[x + y * qq->width] = c & 0x0000007f; /* FIXME: ASCII-only */ 106 99 qq->attr[x + y * qq->width] = (qq->bgcolor << 4) | qq->fgcolor; 107 100 } … … 152 145 while(*t) 153 146 { 154 *chars++ = *t++ & 0x 7f; /* FIXME: ASCII-only */147 *chars++ = *t++ & 0x0000007f; /* FIXME: ASCII-only */ 155 148 *attr++ = (qq->bgcolor << 4) | qq->fgcolor; 156 149 } -
libcaca/trunk/cucul/conic.c
r536 r540 20 20 21 21 #include "config.h" 22 23 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)24 # include <inttypes.h>25 #else26 typedef unsigned char uint8_t;27 #endif28 22 29 23 #include <stdlib.h> -
libcaca/trunk/cucul/cucul.c
r536 r540 20 20 21 21 #include "config.h" 22 23 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)24 # include <inttypes.h>25 #else26 typedef unsigned int uint32_t;27 typedef unsigned char uint8_t;28 #endif29 22 30 23 #include <stdlib.h> -
libcaca/trunk/cucul/cucul_internals.h
r536 r540 21 21 #define __CUCUL_INTERNALS_H__ 22 22 23 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME) 24 # include <inttypes.h> 25 #else 26 typedef unsigned char uint8_t; 27 typedef unsigned char uint16_t; 28 typedef unsigned int uint32_t; 29 #endif 30 23 31 struct cucul_context 24 32 { … … 28 36 uint32_t *chars; 29 37 uint8_t *attr; 30 uint8_t*empty_line, *scratch_line;38 char *empty_line, *scratch_line; 31 39 32 40 enum cucul_color fgcolor; -
libcaca/trunk/cucul/export.c
r536 r540 10 10 */ 11 11 12 /** \file char.c12 /** \file export.c 13 13 * \version \$Id$ 14 14 * \author Sam Hocevar <sam@zoy.org> 15 * \brief Character drawing 16 * 17 * This file contains character and string drawing functions. 15 * \author Jean-Yves Lamoureux <jylam@lnxscene.org> 16 * \brief Export function 17 * 18 * This file contains export functions for various file formats such 19 * as HTML or IRC. 18 20 */ 19 21 20 22 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned int uint32_t;26 typedef unsigned char uint8_t;27 #endif28 23 29 24 #include <stdlib.h> -
libcaca/trunk/cucul/line.c
r536 r540 20 20 21 21 #include "config.h" 22 23 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)24 # include <inttypes.h>25 #else26 typedef unsigned char uint8_t;27 #endif28 22 29 23 #include <stdlib.h> -
libcaca/trunk/cucul/math.c
r536 r540 19 19 20 20 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned char uint8_t;26 #endif27 21 28 22 #include <stdlib.h> -
libcaca/trunk/cucul/sprite.c
r536 r540 19 19 20 20 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned char uint8_t;26 #endif27 21 28 22 #include <stdio.h> -
libcaca/trunk/cucul/triangle.c
r536 r540 19 19 20 20 #include "config.h" 21 22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)23 # include <inttypes.h>24 #else25 typedef unsigned char uint8_t;26 #endif27 21 28 22 #include <stdlib.h> -
libcaca/trunk/src/cacaview.c
r527 r540 681 681 682 682 /* Create the libcaca bitmap */ 683 bitmap = c aca_create_bitmap(bpp, w, h, depth * w,684 rmask, gmask, bmask, amask);683 bitmap = cucul_create_bitmap(qq, bpp, w, h, depth * w, 684 rmask, gmask, bmask, amask); 685 685 if(!bitmap) 686 686 { … … 691 691 692 692 if(bpp == 8) 693 c aca_set_bitmap_palette(bitmap, red, green, blue, alpha);693 cucul_set_bitmap_palette(qq, bitmap, red, green, blue, alpha); 694 694 #endif 695 695 }
Note: See TracChangeset
for help on using the changeset viewer.