mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Android version should always be fullscreen
Also improve documentation for String_Format (Thanks Tree)
This commit is contained in:
parent
0dcef09251
commit
9f88700074
4 changed files with 19 additions and 28 deletions
23
doc/style.md
23
doc/style.md
|
@ -39,26 +39,3 @@ For example, consider the function ```String Substring_UNSAFE(STRING_REF const S
|
|||
The *input string* is not modified at all. However, the characters of the *returned string* points to the characters of the *input string*, so modifying the characters in the *input string* also modifies the *returned string*.
|
||||
|
||||
In general, use of ```const String*``` is preferred when possible, and ```STRING_REF``` as little as possible.
|
||||
|
||||
#### String formatting
|
||||
An API is provided for formatting strings similiar to printf in C or String.Format in C#.
|
||||
The functions for formatting strings are in String.h:
|
||||
```
|
||||
void String_Format1(str, format, a1);
|
||||
void String_Format2(str, format, a1, a2);
|
||||
void String_Format3(str, format, a1, a2, a3);
|
||||
void String_Format4(str, format, a1, a2, a3, a4);
|
||||
```
|
||||
#### Formatting specifiers
|
||||
| Specifier | Type | Example |
|
||||
| ------------- |-------------| -----|
|
||||
| ```%b``` | uint8_t | ```%b``` of ```46``` = ```46``` |
|
||||
| ```%i``` | int | ```%i``` of ```-5``` = ```-5``` |
|
||||
| ```%f[0-9]``` | float | ```%f2``` of ```321.3519``` = ```321.35``` |
|
||||
| ```%p[0-9]``` | int | ```%p3``` of ```5``` = ```005``` |
|
||||
| ```%t``` | Boolean | ```%t``` of ```1``` = ```true``` |
|
||||
| ```%c``` | char* | ```%c``` of ```"ABCD"``` = ```ABCD``` |
|
||||
| ```%s``` | String | ```%s``` of ```{"ABCD", 2, 4}``` = ```AB``` |
|
||||
| ```%r``` | char | ```%r``` of ```47``` = ```\``` |
|
||||
| ```%x``` | uintptr_t | ```%x``` of ```31``` = ```2F``` |
|
||||
| ```%h``` | uint32_t | ```%h``` of ```11``` = ```B``` |
|
||||
|
|
|
@ -277,6 +277,9 @@ static void Launcher_Free(void) {
|
|||
void Launcher_Run(void) {
|
||||
static const cc_string title = String_FromConst(GAME_APP_TITLE);
|
||||
Window_Create(640, 400);
|
||||
#ifdef CC_BUILD_ANDROID
|
||||
Window_EnterFullscreen();
|
||||
#endif
|
||||
Window_SetTitle(&title);
|
||||
Window_Show();
|
||||
LWidget_CalcOffsets();
|
||||
|
|
|
@ -245,13 +245,9 @@ static int HUDScreen_KeyUp(void* screen, int key) {
|
|||
|
||||
static int HUDscreen_PointerDown(void* screen, int id, int x, int y) {
|
||||
struct HUDScreen* s = (struct HUDScreen*)screen;
|
||||
#ifdef CC_BUILD_TOUCH
|
||||
if (Input_TouchMode || Gui_GetInputGrab()) {
|
||||
return Elem_HandlesPointerDown(&s->hotbar, id, x, y);
|
||||
}
|
||||
#else
|
||||
if (Gui_GetInputGrab()) return Elem_HandlesPointerDown(&s->hotbar, id, x, y);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
17
src/String.h
17
src/String.h
|
@ -27,7 +27,7 @@ int String_Length(const char* raw);
|
|||
/* Constructs a string from a (maybe null terminated) buffer. */
|
||||
CC_NOINLINE cc_string String_FromRaw(STRING_REF char* buffer, int capacity);
|
||||
/* Constructs a string from a null-terminated constant readonly buffer. */
|
||||
CC_NOINLINE cc_string String_FromReadonly(STRING_REF const char* buffer);
|
||||
CC_API cc_string String_FromReadonly(STRING_REF const char* buffer);
|
||||
|
||||
/* Constructs a string from a compile time string constant */
|
||||
#define String_FromConst(text) { text, (sizeof(text) - 1), (sizeof(text) - 1)}
|
||||
|
@ -143,6 +143,21 @@ CC_API int String_CaselessEnds(const cc_string* str, const cc_string* sub);
|
|||
/* else returns 0. NOTE: The return value is not just in -1,0,1! */
|
||||
CC_API int String_Compare(const cc_string* a, const cc_string* b);
|
||||
|
||||
/* String_Format is provided for formatting strings (similiar to printf)
|
||||
Supported specifiers for string formatting:
|
||||
TYPE | ARGUMENT | EXAMPLE
|
||||
%b | cc_uint8 | format(%b, 46) = "46"
|
||||
%i | int | format(%i, -5) = "-5"
|
||||
%f[0-9] | float | format(%f2, 321.3519) = "321.35"
|
||||
%p[0-9] | int | format(%p3, 5) = "005"
|
||||
%t | cc_bool | format(%t, 1) = "true"
|
||||
%c | char* | format(%c, "ABCD") = "ABCD"
|
||||
%s | cc_string | format(%s, {"ABCD", 2, 4}) = "AB"
|
||||
%r | char | format(%r, 47) = "\"
|
||||
%x | cc_uintptr| format(%x, 31) = "000000000000002F"
|
||||
%h | cc_uint32 | format(%h, 11) = "0000000B"
|
||||
*/
|
||||
|
||||
/* See String_Format4 */
|
||||
CC_API void String_Format1(cc_string* str, const char* format, const void* a1);
|
||||
/* See String_Format4 */
|
||||
|
|
Loading…
Reference in a new issue