docs/driver.rst
author Radek Brich <radek.brich@devl.cz>
Fri, 28 Mar 2014 14:58:12 +0100
changeset 95 05392e369ede
parent 55 1ab0edd5d784
permissions -rw-r--r--
Refactoring: Swap drawing operations parameters. Coords are now last and have default values.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     1
Driver
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     2
======
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     4
Tuikit driver is the lowest part of the kit - it actually draws characters on screen,
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     5
receives user events and forwards them to widgets.
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     6
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     7
Any dirty details of actual graphical toolkit should be hidden by this driver.
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     8
Though it's not hardware driver, nowhere near that. Tuikit driver is expected to use
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     9
pretty high-level libraries, it's low-level only in Tuikit perpective.
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    10
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    11
Currently there are three drivers: Dummy, Curses, SDL
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    12
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    13
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    14
Dummy driver
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    15
------------
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    16
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    17
This driver shows and documents complete interface required from any driver.
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    18
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    19
It does not draw anything and immediately emits keypress event for 'q' char and 'escape' key,
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    20
which should exit application.
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    21
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    22
All methods of dummy driver just report they where being called - into log file.
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    23
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    24
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    25
Curses driver
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    26
-------------
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    27
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    28
Default driver for Text User Interface in any terminal supporting required features.
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    29
Uses curses module from Python.
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    30
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    31
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    32
SDL driver
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    33
----------
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    34
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    35
Creates graphical window and draws characters here. This has less limits than curses,
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    36
we can use any colors, fonts and possibly even draw images.
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    37
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    38
Though by default, it just emulates terminal with curses.
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    39
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    40
SDL application is more portable than curses one, which means that Tuikit application
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    41
using SDL driver may work in non-unix OS like Windows (does not currently,
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    42
due to unconditional use of fontconfig).
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    43
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    44
SDL driver requires sdlterm module for Python, which must be compiled from C++.
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    45
See sdlterm directory in Tuikit distribution.
1ab0edd5d784 DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    46