Browse Source

* src/graphics.c:

+ Renamed caca_set_title() to caca_set_window_title().
    + Implemented caca_get_window_width() and caca_get_window_height().
  * examples/cacaview.c:
    + Set the window title to cacaview.
tags/v0.99.beta14
Sam Hocevar sam 21 years ago
parent
commit
e4a5408689
4 changed files with 73 additions and 7 deletions
  1. +2
    -4
      TODO
  2. +1
    -1
      examples/cacaview.c
  3. +3
    -1
      src/caca.h
  4. +67
    -1
      src/graphics.c

+ 2
- 4
TODO View File

@@ -8,8 +8,7 @@ Low level stuff
o Better keyboard driver in an X terminal, see
http://groups.yahoo.com/group/zepp/message/381

o Write a window resize handler.

o DONE 13 Jan 2004: Write a window resize handler.
o DONE 12 Nov 2003: Port to conio.h


@@ -21,11 +20,10 @@ High level stuff

o Alpha layer for sprites

o Clip all graphics primitives

o Fix the thin ellipse rendering

o DONE 26 Nov 2003: Support more colour depths, more bitmask orderings
o DONE 15 Nov 2003: Clip all graphics primitives


Misc


+ 1
- 1
examples/cacaview.c View File

@@ -84,7 +84,7 @@ int main(int argc, char **argv)
}

/* Set the window title */
caca_set_title("cacaview");
caca_set_window_title("cacaview");

/* Load items into playlist */
for(i = 1; i < argc; i++)


+ 3
- 1
src/caca.h View File

@@ -246,7 +246,9 @@ char const *caca_get_feature_name(enum caca_feature);
unsigned int caca_get_rendertime(void);
unsigned int caca_get_width(void);
unsigned int caca_get_height(void);
int caca_set_title(char const *);
int caca_set_window_title(char const *);
unsigned int caca_get_window_width(void);
unsigned int caca_get_window_height(void);
void caca_refresh(void);
void caca_end(void);
/* @} */


+ 67
- 1
src/graphics.c View File

@@ -979,7 +979,7 @@ int _caca_end_graphics(void)
* \param title The desired window title.
* \return 0 upon success, a non-zero value if an error occurs.
*/
int caca_set_title(char const *title)
int caca_set_window_title(char const *title)
{
#if defined(USE_X11)
if(_caca_driver == CACA_DRIVER_X11)
@@ -1003,6 +1003,72 @@ int caca_set_title(char const *title)
return 0;
}

/** \brief Get the window width.
*
* If libcaca runs in a window, get the usable window width. This value can
* be used for aspect ratio calculation. If libcaca does not run in a window
* or if there is no way to know the font size, assume a 6x10 font is being
* used. Note that the units are not necessarily pixels.
*
* \return The window width.
*/
unsigned int caca_get_window_width(void)
{
#if defined(USE_X11)
if(_caca_driver == CACA_DRIVER_X11)
{
return _caca_width * x11_font_width;
}
else
#endif
#if defined(USE_WIN32)
if(_caca_driver == CACA_DRIVER_WIN32)
{
/* FIXME */
}
else
#endif
{
/* Dummy */
}

/* Fallback to a 6x10 font */
return _caca_width * 6;
}

/** \brief Get the window height.
*
* If libcaca runs in a window, get the usable window height. This value can
* be used for aspect ratio calculation. If libcaca does not run in a window
* or if there is no way to know the font size, assume a 6x10 font is being
* used. Note that the units are not necessarily pixels.
*
* \return The window height.
*/
unsigned int caca_get_window_height(void)
{
#if defined(USE_X11)
if(_caca_driver == CACA_DRIVER_X11)
{
return _caca_height * x11_font_height;
}
else
#endif
#if defined(USE_WIN32)
if(_caca_driver == CACA_DRIVER_WIN32)
{
/* FIXME */
}
else
#endif
{
/* Dummy */
}

/* Fallback to a 6x10 font */
return _caca_height * 10;
}

/** \brief Set the refresh delay.
*
* This function sets the refresh delay in microseconds. The refresh delay


Loading…
Cancel
Save