Started re-adding the uiInit functions, with a new method of returning errors.

This commit is contained in:
Pietro Gagliardi 2019-04-12 21:44:39 -04:00
parent db9be102e6
commit 4c46a25154
4 changed files with 38 additions and 2 deletions

View File

@ -1,3 +1,4 @@
<!-- 8 april 2019 -->
* [Using libui](using-libui.md)
* [Initialization and the Main Loop](init-main.md)

27
doc/init-main.md Normal file
View File

@ -0,0 +1,27 @@
<!-- 12 april 2019 -->
# Initialization and the Main Loop
## Reference
### `uiInit()`
```c
int uiInit(void *options, uiInitError *err);
```
### `uiUninit()`
```c
void uiUninit(void);
```
### `uiInitError`
```c
typedef struct uiInitError uiInitError;
struct uiInitError {
size_t Size;
char Message[256];
};
```

10
ui.h
View File

@ -30,6 +30,16 @@ extern "C" {
// This has the advantage of being ABI-able should we ever need an ABI...
#define uiprivEnum(s) typedef unsigned int s; enum
typedef struct uiInitError uiInitError;
struct uiInitError {
size_t Size;
char Message[256];
};
uiprivExtern int uiInit(void *options, uiInitError *err);
uiprivExtern void uiUninit(void);
#ifdef __cplusplus
}
#endif

View File

@ -23,8 +23,6 @@ struct uiInitOptions {
size_t Size;
};
uiprivExtern const char *uiInit(uiInitOptions *options);
uiprivExtern void uiUninit(void);
uiprivExtern void uiFreeInitError(const char *err);
uiprivExtern void uiMain(void);