mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-08-18 03:57:51 +08:00
tune format
@@ -196,7 +196,7 @@ a multi-byte string to a Unicode string under the specified white space
|
||||
rule. For example, you can convert a general C string in `UTF-8` or
|
||||
`GB18030` charset to a `Uchar32` string by calling this function.
|
||||
|
||||
```C
|
||||
```cpp
|
||||
LOGFONT* lf;
|
||||
int left_len_text;
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ the extra input messages. The steps are as follow:
|
||||
1. Change MiniGUI run-time configuration to specify the key `system.ial_engine`
|
||||
to be `custom`.
|
||||
|
||||
```C
|
||||
```cpp
|
||||
BOOL InitCustomInput (INPUT* input, const char* mdev, const char* mtype);
|
||||
void TermCustomInput (void);
|
||||
```
|
||||
@@ -216,7 +216,7 @@ void TermCustomInput (void);
|
||||
In `InitCustomInput` function, you should fill the operators (the callbacks)
|
||||
of `input` argument, the pointer to a INPUT structure:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
typedef struct tagINPUT {
|
||||
char* id;
|
||||
|
||||
@@ -258,7 +258,7 @@ you should:
|
||||
|
||||
1. Fill the fields of `extra` structure, e.g.:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
extra->event = IAL_EVENT_AXIS;
|
||||
extra->wparam = MAKELONG(AXIS_SCROLL_VERTICAL, AXIS_SOURCE_WHEEL);
|
||||
extra->wparam = MAKELONG(AXIS_SCROLL_HORIZONTAL, AXIS_SOURCE_WHEEL);
|
||||
@@ -267,7 +267,7 @@ you should:
|
||||
|
||||
1. Make sure the return value of this operator have the bit of `IAL_EVENT_EXTRA` set:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
retval |= IAL_EVENT_EXTRA;
|
||||
```
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ have no such device, the engine will fails to initialize.
|
||||
CommLCD engine implementation. In the `comm-engines` sample, it does nothing
|
||||
and just returns zero:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
int __commlcd_drv_init (void)
|
||||
{
|
||||
return 0;
|
||||
@@ -96,7 +96,7 @@ mode according to your settings in the MiniGUI runtime configuration, e.g.,
|
||||
In our sample, it creates an anonymous memory map by calling `mmap` system
|
||||
call and returns the video information via `struct commlcd_info* li`:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
int __commlcd_drv_getinfo (struct commlcd_info *li, int width, int height, int depth)
|
||||
{
|
||||
sg_fb = (BYTE*) mmap (0, FB_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
|
||||
@@ -147,7 +147,7 @@ If the color depth of the video mode is 8 (`COMMLCD_PSEUDO_RGB332`),
|
||||
|
||||
In our sample, this method does nothing and returns zero:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
int __commlcd_drv_setclut (int firstcolor, int ncolors, GAL_Color *colors)
|
||||
{
|
||||
return 0;
|
||||
@@ -166,7 +166,7 @@ The arguments of this function have the following meanings:
|
||||
|
||||
`GAL_Color` is a structure defined in MiniGUI header:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
typedef struct _GAL_Color
|
||||
{
|
||||
/**
|
||||
@@ -197,7 +197,7 @@ be called frequently or periodically.
|
||||
In our sample, this method saves the whole frame buffer content to Windows
|
||||
bitmap files by calling MiniGUI function:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
int __commlcd_drv_update (const RECT* rc_dirty)
|
||||
{
|
||||
char filename [PATH_MAX + 1];
|
||||
@@ -254,7 +254,7 @@ If you can access the LCD frame buffer directly, and your LCD screen
|
||||
do not need a refresh/update operation, you do not need to implement
|
||||
the update method, and the function can just return zero:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
int __commlcd_drv_update (const RECT* rc_dirty)
|
||||
{
|
||||
return 0;
|
||||
@@ -271,7 +271,7 @@ the resource allocated or created by the engine.
|
||||
|
||||
In our sample, it destroys the anonymous memory map and returns zero:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
int __commlcd_drv_release (void)
|
||||
{
|
||||
munmap (sg_fb, FB_SIZE);
|
||||
@@ -288,7 +288,7 @@ MiniGUI will call `__comminput_init` function to initialize the engine.
|
||||
|
||||
You can open your input devices in the function:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
#define POWER_EVENT_DEV "/dev/input/event0"
|
||||
#define KB_EVENT_DEV "/dev/input/event1"
|
||||
#define TP_EVENT_DEV "/dev/input/event5"
|
||||
@@ -361,7 +361,7 @@ and/or a keyboard event. The sample implementation of `__comminput_wait_for_inpu
|
||||
uses the system call `select` to check the file descriptors opened by
|
||||
`__comminput_init`, and return a suitable value to MiniGUI:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
int __comminput_wait_for_input (struct timeval *timeout)
|
||||
{
|
||||
fd_set rfds;
|
||||
@@ -404,7 +404,7 @@ If there is a keyboard event (the return value of `__comminput_wait_for_input`
|
||||
has the bit `COMM_KBINPUT` set), MiniGUI will call `__comminput_kb_getdata`
|
||||
immediately to get the real keyboard event data:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
int __comminput_kb_getdata (short *key, short *status)
|
||||
{
|
||||
...
|
||||
@@ -425,7 +425,7 @@ If there is a mouse event (the return value of `__comminput_wait_for_input`
|
||||
has the bit `COMM_MOUSEINPUT` set), MiniGUI will call `__comminput_ts_getdata`
|
||||
immediately to get the real keyboard event data:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
int __comminput_ts_getdata (short *x, short *y, short *button)
|
||||
{
|
||||
...
|
||||
@@ -447,7 +447,7 @@ the resource allocated or created by the Comm IAL engine.
|
||||
|
||||
In our sample, it just closes the file descriptors:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
void __comminput_deinit (void)
|
||||
{
|
||||
close (sg_tp_event_fd);
|
||||
|
||||
@@ -191,7 +191,7 @@ ttf-Courier-rrncns-*-16-UTF-8
|
||||
For a new app, you should use the new function `CreateLogFontEx` to
|
||||
create a logfont, and specify the weight and rendering method of the glyph:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
m_btnFont = CreateLogFontEx ("ttf", "helvetica", "UTF-8",
|
||||
FONT_WEIGHT_REGULAR,
|
||||
FONT_SLANT_ROMAN,
|
||||
|
||||
@@ -92,7 +92,7 @@ for your GPU externally.
|
||||
|
||||
First, you need to implement the following external stub:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
DriDriverOps* __dri_ex_driver_get (const char* driver_name);
|
||||
```
|
||||
|
||||
@@ -110,7 +110,7 @@ instead.
|
||||
The `DriDriverOps` is a struct type consisted by a set of operators
|
||||
(callbacks):
|
||||
|
||||
```C
|
||||
```cpp
|
||||
/**
|
||||
* The struct type defines the operators for a DRI driver.
|
||||
*/
|
||||
@@ -255,7 +255,7 @@ need this pointer as the context of your DRI driver.
|
||||
Note that MiniGUI does not defined the detailed structure of
|
||||
`DriDriver`, it is up to your implementation:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
/**
|
||||
* The struct type represents the DRI sub driver.
|
||||
* The concrete struct should be defined by the driver.
|
||||
|
||||
@@ -133,13 +133,13 @@ The main changes in structure and functions:
|
||||
The strcuture `MSG` and all message-related functions changed.
|
||||
For example, the prototype of `SendMessage` changed from
|
||||
|
||||
```C
|
||||
```cpp
|
||||
int SendMessage (HWND hWnd, int nMsg, WPARAM wParam, LPARAM lParam)
|
||||
```
|
||||
|
||||
to
|
||||
|
||||
```C
|
||||
```cpp
|
||||
LRESULT SendMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
|
||||
```
|
||||
|
||||
@@ -149,7 +149,7 @@ For best portability, you should use `FIRSTBYTE` to `FOURTHBYTE` macros
|
||||
to get the bytes of a character when you extract the bytes from `WPARAM`
|
||||
parameter of a `MSG_CHAR` message:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
case MSG_CHAR:
|
||||
unsigned char ch_buff [4];
|
||||
unsigned char ch_buff [0] = FIRSTBYTE(wParam);
|
||||
@@ -164,25 +164,25 @@ Furthermore, the structure and functions to register window class,
|
||||
create main window, and create dialog box changed. For example, the prototype
|
||||
of `WNDPROC` changed from
|
||||
|
||||
```C
|
||||
```cpp
|
||||
typedef int (* WNDPROC)(HWND, int, WPARAM, LPARAM)
|
||||
```
|
||||
|
||||
to
|
||||
|
||||
```C
|
||||
```cpp
|
||||
typedef LRESULT (* WNDPROC)(HWND, UINT, WPARAM, LPARAM)
|
||||
```
|
||||
|
||||
Therefore, the prototype of `DefaultWindowProc` changed from
|
||||
|
||||
```C
|
||||
```cpp
|
||||
int DefaultWindowProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
|
||||
```
|
||||
|
||||
to
|
||||
|
||||
```C
|
||||
```cpp
|
||||
LRESULT DefaultWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
```
|
||||
|
||||
@@ -199,13 +199,13 @@ platform, unless you know what your are doing.
|
||||
|
||||
The type of notification callback changes from:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
typedef void (* NOTIFPROC) (HWND hwnd, int id, int nc, DWORD add_data);
|
||||
```
|
||||
|
||||
to
|
||||
|
||||
```C
|
||||
```cpp
|
||||
typedef void (* NOTIFPROC) (HWND hwnd, LINT id, int nc, DWORD add_data);
|
||||
```
|
||||
|
||||
@@ -216,7 +216,7 @@ controls, you should make sure the identifier is small enough on 64-bit
|
||||
platform. Because MiniGUI packs the identifier and the notification code
|
||||
in the `WPARAM` parameter:
|
||||
|
||||
```C
|
||||
```cpp
|
||||
MSG_COMMAND
|
||||
int id = LOWORD(wParam);
|
||||
int code = HIWORD(wParam);
|
||||
@@ -234,25 +234,25 @@ handle the notification sent from controls. To do this, please call
|
||||
|
||||
The prototype of `GetTickCount` changed from
|
||||
|
||||
```C
|
||||
```cpp
|
||||
unsigned int GetTickCount (void)
|
||||
```
|
||||
|
||||
to
|
||||
|
||||
```C
|
||||
```cpp
|
||||
DWORD GetTickCount (void);
|
||||
```
|
||||
|
||||
And the prototye of `TIMERPROC` changed from
|
||||
|
||||
```C
|
||||
```cpp
|
||||
typedef BOOL (* TIMERPROC)(HWND, int, DWORD)
|
||||
```
|
||||
|
||||
to
|
||||
|
||||
```C
|
||||
```cpp
|
||||
typedef BOOL (* TIMERPROC)(HWND, LINT, DWORD)
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user