diff --git a/docs/api_reference.md b/docs/api_reference.md index 2a394b59f..2352c8e2b 100644 --- a/docs/api_reference.md +++ b/docs/api_reference.md @@ -867,9 +867,9 @@ This is a list of all functions in Cute Framework organized by categories. This - [cf_bottom](/math/cf_bottom.md) - [cf_bottom_left](/math/cf_bottom_left.md) - [cf_bottom_right](/math/cf_bottom_right.md) +- [cf_ceil](/math/cf_ceil.md) - [cf_center](/math/cf_center.md) - [cf_centroid](/math/cf_centroid.md) -- [cf_ciel](/math/cf_ciel.md) - [cf_circle_in](/math/cf_circle_in.md) - [cf_circle_in_out](/math/cf_circle_in_out.md) - [cf_circle_out](/math/cf_circle_out.md) diff --git a/docs/math/cf_ciel.md b/docs/math/cf_ceil.md similarity index 95% rename from docs/math/cf_ciel.md rename to docs/math/cf_ceil.md index c1d7dd38c..14d973fab 100644 --- a/docs/math/cf_ciel.md +++ b/docs/math/cf_ceil.md @@ -1,6 +1,6 @@ [](../header.md ':include') -# cf_ciel +# cf_ceil Category: [math](/api_reference?id=math) GitHub: [cute_math.h](https://github.com/RandyGaul/cute_framework/blob/master/include/cute_math.h) @@ -9,7 +9,7 @@ GitHub: [cute_math.h](https://github.com/RandyGaul/cute_framework/blob/master/in Returns the component-wise ceil of a vector. ```cpp -CF_V2 cf_ciel(CF_V2 a) +CF_V2 cf_ceil(CF_V2 a) ``` ## Remarks diff --git a/docs/math/cf_floor.md b/docs/math/cf_floor.md index a16ab0b0c..c0e197923 100644 --- a/docs/math/cf_floor.md +++ b/docs/math/cf_floor.md @@ -25,4 +25,4 @@ Floor means the decimal-point part is zero'd out. [cf_lesser_equal_v2](/math/cf_lesser_equal_v2.md) [cf_greater_equal_v2](/math/cf_greater_equal_v2.md) [cf_parallel](/math/cf_parallel.md) -[cf_ciel](/math/cf_ciel.md) +[cf_ceil](/math/cf_ceil.md) diff --git a/docs/text/cf_texteffect.md b/docs/text/cf_texteffect.md index be09c1d64..80e36a426 100644 --- a/docs/text/cf_texteffect.md +++ b/docs/text/cf_texteffect.md @@ -16,7 +16,7 @@ Struct Members | Description `int index_into_effect` | Starts at 0 and increments for each character affected. `int glyph_count` | The number of glyphs spanning the entire effect. `float elapsed` | How long this effect has persisted for. -`CF_V2 center` | Center of this glyp's space -- not the same as the center of the glyph quad. +`CF_V2 center` | Center of this glyph's space -- not the same as the center of the glyph quad. `CF_V2 q0, q1` | User-modifiable. This glyph's renderable quad. q0 is the min vertex, while q1 is the max vertex. `int w, h` | Width and height of the glyph. `CF_Color color` | User-modifiable. The color to render this glyph with. diff --git a/docs/web/cf_https_response_headers.md b/docs/web/cf_https_response_headers.md index e15dae11c..f169e7e26 100644 --- a/docs/web/cf_https_response_headers.md +++ b/docs/web/cf_https_response_headers.md @@ -14,7 +14,9 @@ htbl const CF_HttpsHeader* cf_https_response_headers(CF_HttpsResponse response); ## Remarks -Intended to be used with [cf_https_response_headers_count](/web/cf_https_response_headers_count.md). +Intended to be used with [cf_https_response_headers_count](/web/cf_https_response_headers_count.md). Do not free this array, it will +get cleaned up when the originating [CF_HttpsRequest](/web/cf_httpsrequest.md) is destroyed via [cf_https_destroy](/web/cf_https_destroy.md). +If you're familiar with [htbl](/hash/htbl.md) you may treat this pointer as a hashtable key'd by strings. ## Related Pages diff --git a/include/cute_draw.h b/include/cute_draw.h index cfe8ac315..00e6f4ebc 100644 --- a/include/cute_draw.h +++ b/include/cute_draw.h @@ -783,31 +783,6 @@ CF_API bool CF_CALL cf_pop_text_vertical_layout(); */ CF_API bool CF_CALL cf_peek_text_vertical_layout(); -/** - * @function cf_push_text_effect_active - * @category text - * @brief Turns on/off text effects. - * @remarks Text effects are on by default. - * @related cf_push_text_effect_active cf_pop_text_effect_active cf_peek_text_effect_active - */ -CF_API void CF_CALL cf_push_text_effect_active(bool effects_on); - -/** - * @function cf_pop_text_effect_active - * @category text - * @brief Pops the previously pushed activated state for text effects. See `cf_push_text_effect_active`. - * @related cf_push_text_effect_active cf_pop_text_effect_active cf_peek_text_effect_active - */ -CF_API bool CF_CALL cf_pop_text_effect_active(); - -/** - * @function cf_peek_text_effect_active - * @category text - * @brief Returns the last text active state. - * @related cf_push_text_effect_active cf_pop_text_effect_active cf_peek_text_effect_active - */ -CF_API bool CF_CALL cf_peek_text_effect_active(); - /** * @function cf_text_width * @category text @@ -885,7 +860,7 @@ typedef struct CF_TextEffect /* @member How long this effect has persisted for. */ float elapsed; - /* @member Center of this glyp's space -- not the same as the center of the glyph quad. */ + /* @member Center of this glyph's space -- not the same as the center of the glyph quad. */ CF_V2 center; /* @member User-modifiable. This glyph's renderable quad. q0 is the min vertex, while q1 is the max vertex. */ @@ -1056,6 +1031,31 @@ CF_API CF_Color CF_CALL cf_text_effect_get_color(CF_TextEffect* fx, const char* */ CF_API const char* CF_CALL cf_text_effect_get_string(CF_TextEffect* fx, const char* key, const char* default_val); +/** + * @function cf_push_text_effect_active + * @category text + * @brief Turns on/off text effects. + * @remarks Text effects are on by default. + * @related cf_push_text_effect_active cf_pop_text_effect_active cf_peek_text_effect_active + */ +CF_API void CF_CALL cf_push_text_effect_active(bool effects_on); + +/** + * @function cf_pop_text_effect_active + * @category text + * @brief Pops the previously pushed activated state for text effects. See `cf_push_text_effect_active`. + * @related cf_push_text_effect_active cf_pop_text_effect_active cf_peek_text_effect_active + */ +CF_API bool CF_CALL cf_pop_text_effect_active(); + +/** + * @function cf_peek_text_effect_active + * @category text + * @brief Returns the last text active state. + * @related cf_push_text_effect_active cf_pop_text_effect_active cf_peek_text_effect_active + */ +CF_API bool CF_CALL cf_peek_text_effect_active(); + /** * @function cf_render_settings_filter * @category draw diff --git a/include/cute_https.h b/include/cute_https.h index 7140695be..8ab5efb08 100644 --- a/include/cute_https.h +++ b/include/cute_https.h @@ -263,7 +263,9 @@ CF_API int CF_CALL cf_https_response_headers_count(CF_HttpsResponse response); * @function cf_https_response_headers * @category web * @brief Returns an array of response headers. - * @remarks Intended to be used with `cf_https_response_headers_count`. + * @remarks Intended to be used with `cf_https_response_headers_count`. Do not free this array, it will + * get cleaned up when the originating `CF_HttpsRequest` is destroyed via `cf_https_destroy`. + * If you're familiar with `htbl` you may treat this pointer as a hashtable key'd by strings. * @related CF_HttpsHeader CF_HttpsResponse cf_https_response_find_header cf_https_response_headers */ CF_API htbl const CF_HttpsHeader* CF_CALL cf_https_response_headers(CF_HttpsResponse response); @@ -280,6 +282,39 @@ CF_API htbl const CF_HttpsHeader* CF_CALL cf_https_response_headers(CF_HttpsResp namespace Cute { +using HttpsRequest = CF_HttpsRequest; +using HttpsResponse = CF_HttpsResponse; +using HttpsHeader = CF_HttpsHeader; + +CF_INLINE HttpsRequest https_get(const char* host, int port, const char* uri, bool verify_cert = true) { return cf_https_get(host, port, uri, verify_cert); } +CF_INLINE HttpsRequest https_post(const char* host, int port, const char* uri, const void* content, int content_length, bool verify_cert = true) { return cf_https_post(host, port, uri, content, content_length, verify_cert); } +CF_INLINE void https_add_header(HttpsRequest request, const char* name, const char* value) { cf_https_add_header(request, name, value); } +CF_INLINE void https_destroy(HttpsRequest request) { cf_https_destroy(request); } + +using HttpsResult = CF_HttpsResult; +#define CF_ENUM(K, V) CF_INLINE constexpr HttpsResult K = CF_##K; +CF_HTTPS_RESULT_DEFS +#undef CF_ENUM + +CF_INLINE const char* to_string(HttpsResult result) +{ + switch (result) { + #define CF_ENUM(K, V) case CF_##K: return #K; + CF_HTTPS_RESULT_DEFS + #undef CF_ENUM + default: return NULL; + } +} + +CF_INLINE HttpsResult https_process(HttpsRequest request) { return cf_https_process(request); } +CF_INLINE HttpsResponse https_response(HttpsRequest request) { return cf_https_response(request); } +CF_INLINE int https_response_code(HttpsResponse response) { return cf_https_response_code(response); } +CF_INLINE int https_response_content_length(HttpsResponse response) { return cf_https_response_content_length(response); } +CF_INLINE char* https_response_content(HttpsResponse response) { return cf_https_response_content(response); } +CF_INLINE HttpsHeader https_response_find_header(HttpsResponse response, const char* header_name) { return cf_https_response_find_header(response, header_name); } +CF_INLINE int https_response_headers_count(HttpsResponse response) { return cf_https_response_headers_count(response); } +CF_INLINE htbl const HttpsHeader* https_response_headers(HttpsResponse response) { return cf_https_response_headers(response); } + } #endif // CF_CPP diff --git a/src/cute_https.cpp b/src/cute_https.cpp index c113bbddc..b8b18a95e 100644 --- a/src/cute_https.cpp +++ b/src/cute_https.cpp @@ -26,6 +26,8 @@ extern "C" { } #endif +// Credit to Mattias Gustavsson for the original API design of cute_https.h + using namespace Cute; #ifndef CF_EMSCRIPTEN diff --git a/todo.txt b/todo.txt index a8d35e6c7..bd849be4c 100644 --- a/todo.txt +++ b/todo.txt @@ -1,17 +1,17 @@ -investigate https://discord.com/channels/432009046833233930/432009046833233932/1256474663085805618 DPI handling doc page on transforms -text fx init -text fx word iterator +note text effect onstart/finish helpers in the topic page +text effect word/line iterator, aabb calcs docs pass on all pages -https C++ API knock out github issues resync all cute_headers set cute_version.h update cute_user_config with all the math overrides recent PR ECS docs +draw docs document circular buffer Document cute_image.h +contributor list punted - transparent windows - Can't find an easy way to do this through SDL, might be a cross-platform nightmare