An fast realtime interactive fractal zoomer
Ui uses following functions to communicate with driver:
- Function: init
- function that initializes driver and returns 1 if success and 0 if fail
- Function: getsize (int *width,int *height)
- returns size of screen(window) x and y
- Function: processevents (int wait, int *x,int *y, int *buttonmask, int &keys)
- gets new keyboard/mouse events. parameters:
function also calls
- if 1 function can wait for next event otherwise just lookup if
something comed. This is usefull on multitasked os where xaos
does not eats unnecesaru cpi.
- here returns current positions of mouse
- returns mask of
BUTTON3 for mouse buttons
- returns mask for cursor keys
ui_key(ASCII character) and ui_resize if required
note in case of problems freeing/allocating inside processevents you may
ui_call_resize that calls resize later outside this function
- Function: uninit
- Unitialises driver -- called before exit.
- Function: set_range(ui_palette *palette, int start, int end)
- This is an preffered way to set palette (second way is
UI_C256 (256 color with palette) one of this
two functions is required. In truecolor modes they are unused. In case direct
access to palette is possible at your platform, define this one. Function is
expected to set all color cells between start to end to colors
defined in palette.
Ui_palette is array of ui_rgb.
is color for entry number start.
Ui_rgb is an array of
Palette is red field of entry number start,
Palette is blue.
0 means black and
means full intensity. Use
NULL if your driver don't support this call.
- Function: set_color (int r,int g,int b,int init)
- This is an secondary way, that should be used at platforms w/o direct
palette access (like X11 or static color schemes). It receives RGB value
of color, and returns index of color cell with this color or -1 if no more
color cells available. An init parameter is set to 1, when first entry
of palette is allocated,
set_color is expected to free all color
entries previously allocated. Use
NULL if your driver don't support
- Function: print (int
y, char *
- prints text to screen at possition x/y
- Function: display (void)
- displays current buffer to screen
- Function: alloc_buffers (char **buffer1,char **buffer2)
- allocs two buffers that can hold screen size bitmap.
Also sets current buffer to buffer1. Since version 2.1 returns scanline
size in bytes(usually width) and 0 if fail. This is usefull on systems, that
allocated bitmap bigger than window/screen(dividable by 4 or so)
- Function: free_buffers(char *buffer1,char *buffer2)
- frees allocated buffers
- Function: flip_buffer (void)
- flips buffers -- set current buffer to other one
- Function: flush (void)
- This function should be used by drivers with buffered output to flush
output buffers. Other driver should set it to NULL.
- Function: rotate_palette (int dirrection)
function used for palette rotating. It is not required. Set to NULL if
it is unimplemented in your driver.
When rotating is on this function is periodicaly called with direction
attribute. It must rotate all colors 1-number_of_allocated direction steps
forward except first one. This should be implemented also using cmap array
in zoom_context that contains correct rgb values.
So you may use ui_getcontext to get zoom_context and then
set context->numcolors colors in array cmap.
- Function: mousetype (int type)
- This function is used to change mouse cursor. It receives following values:
You should use NULL if your driver don't support this.
- This mouse is usually displayed at screen, when UI waits for user
- This mouse is displayed when UI is busy(should be famous wait clocks)
or you may use mouse defined in ui_dos -- mandelbrot set
- This mouse is displayed during replay. Should be none at fullscreen
drivers, since blinking mouse cursor during replay looks ugly. At
windowed system disabling mouse looks ugly, so it should be some funny
- Function: clrscr (void)
- This function is
- Function: driveropt (void)
- This is an optional function (should be set to NULL) that should be used for
various driver depended actions. You should use ui_menu call (see uinew.c
for examples of usage) to make some driver depended menu.