Skip to content

Commit

Permalink
Redo slight syntax changes & bug-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Muukid authored Oct 27, 2024
1 parent 017166b commit 00814e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ void (*keyboard)(muWindow win, muKeyboardKey key, muBool status);
* `void (*keystate)` - the keystate callback, called every time that the status of a keystate on the [keystate keymap](#keystate-keymap) changes, defined below:

```c
void (*keystate)(muWindow win, muKeystate state, muBool status);
void (*keystate)(muWindow win, muKeyboardState state, muBool status);
```


Expand Down Expand Up @@ -631,7 +631,7 @@ It will return "Unknown" in the case that `key` is an invalid keyboard key value
### Keystate keymap

The keystate keymap represents the state of certain modifiers on the keyboard readable by muCOSA, using type `muKeystate` (typedef for `uint8_m`) as index. The length of the keymap is `MU_KEYSTATE_LENGTH`. It has the following indexes:
The keystate keymap represents the state of certain modifiers on the keyboard readable by muCOSA, using type `muKeyboardState` (typedef for `uint8_m`) as index. The length of the keymap is `MU_KEYSTATE_LENGTH`. It has the following indexes:

* `MU_KEYSTATE_UNKNOWN` - unknown keystate.

Expand All @@ -648,7 +648,7 @@ Once the pointer to the keystate keymap array has been retrieved via `muCOSA_win
The name function `mu_keystate_get_name` returns a `const char*` representation of the given keystate (for example, `MU_KEYSTATE_CAPS_LOCK` returns "MU_KEYSTATE_CAPS_LOCK"), defined below:

```c
MUDEF const char* mu_keystate_get_name(muKeystate state);
MUDEF const char* mu_keystate_get_name(muKeyboardState state);
```
Expand All @@ -657,7 +657,7 @@ It will return "MU_UNKNOWN" in the case that `state` is an invalid keystate valu
The name function `mu_keystate_get_nice_name` does the same thing, but with a nicer and more readable `const char*` representation (for example, `MU_KEYSTATE_CAPS_LOCK` returns "Caps Lock"), defined below:
```c
MUDEF const char* mu_keystate_get_nice_name(muKeystate state);
MUDEF const char* mu_keystate_get_nice_name(muKeyboardState state);
```


Expand Down
32 changes: 16 additions & 16 deletions muCOSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ Uncommon pixel formats (such as no-alpha pixel formats) are not tested thoroughl
// Types elaborated later on
typedef uint16_m muCOSAResult; // (65,536 error results including success)
typedef uint16_m muKeyboardKey;
typedef uint8_m muKeystate;
typedef uint8_m muKeyboardState;
typedef uint16_m muMouseKey;

// @DOCLINE # Version
Expand Down Expand Up @@ -1236,7 +1236,7 @@ Uncommon pixel formats (such as no-alpha pixel formats) are not tested thoroughl
// @DOCLINE * `void (*keyboard)` - the keyboard callback, called every time that the status of a keyboard key on the [keyboard keymap](#keyboard-keymap) changes, defined below: @NLNT
void (*keyboard)(muWindow win, muKeyboardKey key, muBool status);
// @DOCLINE * `void (*keystate)` - the keystate callback, called every time that the status of a keystate on the [keystate keymap](#keystate-keymap) changes, defined below: @NLNT
void (*keystate)(muWindow win, muKeystate state, muBool status);
void (*keystate)(muWindow win, muKeyboardState state, muBool status);
// @DOCLINE * `void (*mouse_key)` - the mouse key callback, called every time that the status of a mouse key on the [mouse keymap](#mouse-keymap) changes, defined below: @NLNT
void (*mouse_key)(muWindow win, muMouseKey key, muBool status);
// @DOCLINE * `void (*cursor)` - the cursor position callback, called every time that the cursor position changes, defined below: @NLNT
Expand Down Expand Up @@ -1443,7 +1443,7 @@ Uncommon pixel formats (such as no-alpha pixel formats) are not tested thoroughl

// @DOCLINE ### Keystate keymap

// @DOCLINE The keystate keymap represents the state of certain modifiers on the keyboard readable by muCOSA, using type `muKeystate` (typedef for `uint8_m`) as index. The length of the keymap is `MU_KEYSTATE_LENGTH`. It has the following indexes:
// @DOCLINE The keystate keymap represents the state of certain modifiers on the keyboard readable by muCOSA, using type `muKeyboardState` (typedef for `uint8_m`) as index. The length of the keymap is `MU_KEYSTATE_LENGTH`. It has the following indexes:

// @DOCLINE * `MU_KEYSTATE_UNKNOWN` - unknown keystate.
#define MU_KEYSTATE_UNKNOWN 0
Expand All @@ -1462,11 +1462,11 @@ Uncommon pixel formats (such as no-alpha pixel formats) are not tested thoroughl
// @DOCLINE #### Keystate names

// @DOCLINE The name function `mu_keystate_get_name` returns a `const char*` representation of the given keystate (for example, `MU_KEYSTATE_CAPS_LOCK` returns "MU_KEYSTATE_CAPS_LOCK"), defined below: @NLNT
MUDEF const char* mu_keystate_get_name(muKeystate state);
MUDEF const char* mu_keystate_get_name(muKeyboardState state);
// @DOCLINE It will return "MU_UNKNOWN" in the case that `state` is an invalid keystate value.

// @DOCLINE The name function `mu_keystate_get_nice_name` does the same thing, but with a nicer and more readable `const char*` representation (for example, `MU_KEYSTATE_CAPS_LOCK` returns "Caps Lock"), defined below: @NLNT
MUDEF const char* mu_keystate_get_nice_name(muKeystate state);
MUDEF const char* mu_keystate_get_nice_name(muKeyboardState state);
// @DOCLINE It will return "Unknown" in the case that `state` is an invalid keystate value.

// @DOCLINE > These functions are "name" functions, and therefore are only defined if `MUCOSA_NAMES` is also defined by the user.
Expand Down Expand Up @@ -2270,7 +2270,7 @@ Uncommon pixel formats (such as no-alpha pixel formats) are not tested thoroughl
}

// muCOSA keystate to Win32
int muCOSAW32_keystate_to_W32(muKeystate state) {
int muCOSAW32_keystate_to_W32(muKeyboardState state) {
switch (state) {
default: return VK_NONAME; break;
case MU_KEYSTATE_CAPS_LOCK: return VK_CAPITAL; break;
Expand Down Expand Up @@ -3471,13 +3471,6 @@ Uncommon pixel formats (such as no-alpha pixel formats) are not tested thoroughl
muCOSAResult muCOSAW32_window_set_position(muCOSAW32_Window* win, int32_m* data);

muCOSAResult muCOSAW32_window_create(muWindowInfo* info, muCOSAW32_Window* win) {
/* Add window to pmap */

muCOSAResult res = muCOSAW32_window_pmap_add(win);
if (muCOSA_result_is_fatal(res)) {
return res;
}

/* Default attributes */

// Zero-ing-out
Expand Down Expand Up @@ -3680,6 +3673,13 @@ Uncommon pixel formats (such as no-alpha pixel formats) are not tested thoroughl
int32_m pos[2] = { info->x, info->y };
muCOSAW32_window_set_position(win, pos);

/* Add window to pmap */

muCOSAResult res = muCOSAW32_window_pmap_add(win);
if (muCOSA_result_is_fatal(res)) {
return res;
}

return res;
}

Expand Down Expand Up @@ -3708,7 +3708,7 @@ Uncommon pixel formats (such as no-alpha pixel formats) are not tested thoroughl
// Checks all keystates and updates accordingly
void muCOSAW32_update_keystate(muCOSAW32_Window* win) {
// Loop through each possible keystate
for (muKeystate s = 1; s < MU_KEYSTATE_LENGTH; ++s) {
for (muKeyboardState s = 1; s < MU_KEYSTATE_LENGTH; ++s) {
// Assume not on at first
muBool b = MU_FALSE;
// Convert keystate to Win32
Expand Down Expand Up @@ -5197,7 +5197,7 @@ Uncommon pixel formats (such as no-alpha pixel formats) are not tested thoroughl
}
}

MUDEF const char* mu_keystate_get_name(muKeystate state) {
MUDEF const char* mu_keystate_get_name(muKeyboardState state) {
switch (state) {
default: return "MU_UNKNOWN"; break;
case MU_KEYSTATE_UNKNOWN: return "MU_KEYSTATE_UNKNOWN"; break;
Expand All @@ -5207,7 +5207,7 @@ Uncommon pixel formats (such as no-alpha pixel formats) are not tested thoroughl
}
}

MUDEF const char* mu_keystate_get_nice_name(muKeystate state) {
MUDEF const char* mu_keystate_get_nice_name(muKeyboardState state) {
switch (state) {
default: return "Unknown"; break;
case MU_KEYSTATE_UNKNOWN: return "Unknown"; break;
Expand Down

0 comments on commit 00814e9

Please sign in to comment.