Skip to content

Commit

Permalink
Merge branch 'master' into xcb-cairo
Browse files Browse the repository at this point in the history
  • Loading branch information
RobLoach committed Apr 17, 2024
2 parents 0cbc6f4 + 31b5729 commit 3a7f458
Show file tree
Hide file tree
Showing 116 changed files with 12,948 additions and 3,837 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[clib.json]
[**.{json,yml}]
indent_size = 2
40 changes: 34 additions & 6 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,44 @@ jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: apt-update
run: sudo apt-get update -qq
- name: apt get glfw
run: sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libglew-dev
- name: build opengl2
- name: apt get demo-libs
run: sudo apt-get install -y --no-install-recommends liballegro5-dev liballegro-image5-dev liballegro-ttf5-dev libglfw3 libglfw3-dev libglew-dev libsdl2-dev libwayland-dev libx11-dev libxft-dev wayland-protocols
- name: build allegro5
run: make -C demo/allegro5
- name: build glfw_opengl2
run: make -C demo/glfw_opengl2
- name: build opengl3
- name: build glfw_opengl3
run: make -C demo/glfw_opengl3
- name: build glfw_opengl4
run: make -C demo/glfw_opengl4
# - name: build glfw_vulkan
# run: make -C demo/glfw_vulkan
- name: build sdl_opengl2
run: make -C demo/sdl_opengl2
- name: build sdl_opengl3
run: make -C demo/sdl_opengl3
- name: build sdl_opengles2
run: make -C demo/sdl_opengles2
- name: build sdl_renderer
run: make -C demo/sdl_renderer
- name: build sdl_rawfb
run: make -C demo/rawfb/sdl
- name: build wayland_rawfb
run: make -C demo/rawfb/wayland
- name: build x11
run: make -C demo/x11
- name: build x11_opengl2
run: make -C demo/x11_opengl2
- name: build x11_opengl3
run: make -C demo/x11_opengl3
- name: build x11_rawfb
run: make -C demo/rawfb/x11
- name: build x11_xft
run: make -C demo/x11_xft
- name: build example
run: make -C example
7 changes: 4 additions & 3 deletions .github/workflows/create-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: butlerlogic/action-autotag@stable
with:
- uses: actions/checkout@v4
- uses: butlerlogic/action-autotag@1.1.2
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
root: clib.json
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ example/bin/*
docs/xml
docs/build
docs/src
doc/doc*
*.tmp
*.swo
*.swp
Expand Down
Empty file removed .gitmodules
Empty file.
2 changes: 1 addition & 1 deletion clib.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuklear",
"version": "4.10.1",
"version": "4.12.0",
"repo": "Immediate-Mode-UI/Nuklear",
"description": "A small ANSI C gui toolkit",
"keywords": ["gl", "ui", "toolkit"],
Expand Down
2 changes: 1 addition & 1 deletion demo/allegro5/Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Allegro v5 nuklear backend

This backend provides support for [Allegro version 5](http://liballeg.org/). It works on on all supported platforms with an OpenGL backend, including iOS and Android.
This backend provides support for [Allegro version 5](https://liballeg.github.io). It works on on all supported platforms with an OpenGL backend, including iOS and Android.

Touch support is provided by handling the first touch (ignoring any extra simultaneous touches) and emitting nuklear mouse events. nuklear will handle only the first touch like a single left-mouse click. Dragging the touch screen emits mouse-move events.

Expand Down
16 changes: 12 additions & 4 deletions demo/allegro5/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,18 @@ int main(void)
ctx = nk_allegro5_init(font, display, WINDOW_WIDTH, WINDOW_HEIGHT);

/* style.c */
/*set_style(ctx, THEME_WHITE);*/
/*set_style(ctx, THEME_RED);*/
/*set_style(ctx, THEME_BLUE);*/
/*set_style(ctx, THEME_DARK);*/
#ifdef INCLUDE_STYLE
/* ease regression testing during Nuklear release process; not needed for anything else */
#ifdef STYLE_WHITE
set_style(ctx, THEME_WHITE);
#elif defined(STYLE_RED)
set_style(ctx, THEME_RED);
#elif defined(STYLE_BLUE)
set_style(ctx, THEME_BLUE);
#elif defined(STYLE_DARK)
set_style(ctx, THEME_DARK);
#endif
#endif

while(1)
{
Expand Down
18 changes: 9 additions & 9 deletions demo/allegro5/nuklear_allegro5.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ NK_API void nk_allegro5_font_set_font(NkAllegro5Font *font);
* ===============================================================
*/
#ifdef NK_ALLEGRO5_IMPLEMENTATION
#include <stdio.h>

#ifndef NK_ALLEGRO5_TEXT_MAX
#define NK_ALLEGRO5_TEXT_MAX 256
Expand Down Expand Up @@ -101,7 +102,7 @@ static float
nk_allegro5_font_get_text_width(nk_handle handle, float height, const char *text, int len)
{
float width;
char *strcpy;
char *str;
NkAllegro5Font *font = (NkAllegro5Font*)handle.ptr;
NK_UNUSED(height);
if (!font || !text) {
Expand All @@ -111,11 +112,11 @@ nk_allegro5_font_get_text_width(nk_handle handle, float height, const char *text
as nuklear uses variable size buffers and al_get_text_width doesn't
accept a length, it infers length from null-termination
(which is unsafe API design by allegro devs!) */
strcpy = malloc(len + 1);
strncpy(strcpy, text, len);
strcpy[len] = '\0';
width = al_get_text_width(font->font, strcpy);
free(strcpy);
str = calloc((size_t)len + 1, 1);
if(!str) return 0;
strncpy(str, text, len);
width = al_get_text_width(font->font, str);
free(str);
return width;
}

Expand Down Expand Up @@ -473,10 +474,9 @@ nk_allegro5_clipboard_copy(nk_handle usr, const char *text, int len)
char *str = 0;
(void)usr;
if (!len) return;
str = (char*)malloc((size_t)len+1);
str = calloc((size_t)len + 1, 1);
if (!str) return;
memcpy(str, text, (size_t)len);
str[len] = '\0';
strncpy(str, text, len);
al_set_clipboard_text(allegro5.dsp, str);
free(str);
}
Expand Down
Loading

0 comments on commit 3a7f458

Please sign in to comment.