Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Pixelsuft committed Jun 4, 2024
1 parent 561f91b commit 6ac6e4b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ANDROID.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# How to use on android
TODO
1 change: 0 additions & 1 deletion include/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ void* h_calloc(size_t elem_count, size_t elem_size);
void* h_realloc(void* ptr, size_t new_size);
void h_free(void* ptr);

// TODO
void* h_fopen(const char* fp, const char* mode);
int h_fclose(void* file);
size_t h_fread(void* buf, size_t elem_size, size_t elem_count, void* file);
Expand Down
2 changes: 2 additions & 0 deletions src/display-sdl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,8 @@ void display_handle_events(void)
case SDL_KEYDOWN: {
display_set_title();
if (mouse_enabled) {
if (event.key.keysym.sym == SDLK_AC_BACK)
mouse_enabled = 0;
display_kbd_send_key(sdl_keysym_to_scancode(event.key.keysym.sym));
}
else {
Expand Down
10 changes: 10 additions & 0 deletions src/ui-mobile.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ typedef struct {
size_t elem_count;
mobui_button go_btn;
mobui_button cfg_btn;
mobui_button help_btn;
mobui_input path_inp;
int allow_to_start;
int allow_is_dir;
Expand Down Expand Up @@ -255,6 +256,8 @@ void mobui_place_elems(void) {
page.path_inp.base.set_rect(&page.path_inp, &tr2);
SDL_FRect tr3 = { 5.0f * sx, 50.0f * sm, 630.0f * sx, 40.0f * sy };
page.cfg_btn.base.set_rect(&page.cfg_btn, &tr3);
SDL_FRect tr4 = { 5.0f * sx, 50.0f * sm, 630.0f * sx, 40.0f * sy };
page.help_btn.base.set_rect(&page.help_btn, &tr4);
}

void mobui_copy_config(void) {
Expand Down Expand Up @@ -374,6 +377,10 @@ void mobui_run_main(void) {
page.cfg_btn.was_pressed = 0;
mobui_copy_config();
}
if (page.help_btn.was_pressed) {
page.help_btn.was_pressed = 0;
SDL_OpenURL("https://github.com/Pixelsuft/halfix/blob/main/ANDROID.md");
}
SDL_RenderPresent(ren);
}
for (size_t i = 0; i < page.elem_count; i++) {
Expand All @@ -399,6 +406,8 @@ void mobui_init(void) {
mobui_button_set_text(&page.go_btn, "GO!");
mobui_init_button(&page.cfg_btn);
mobui_button_set_text(&page.cfg_btn, "Create default config here!");
mobui_init_button(&page.help_btn);
mobui_button_set_text(&page.help_btn, "Create default config here!");
mobui_init_input(&page.path_inp);
#ifdef MOBILE_WIP
strcpy(page.path_inp.text, ".");
Expand All @@ -411,6 +420,7 @@ void mobui_init(void) {
page.elems[0] = (mobui_elem*)&page.go_btn;
page.elems[1] = (mobui_elem*)&page.path_inp;
page.elems[2] = (mobui_elem*)&page.cfg_btn;
page.elems[3] = (mobui_elem*)&page.help_btn;
page.elem_count = 10;
#ifndef MOBILE_WIP
// IDK which is right...
Expand Down

0 comments on commit 6ac6e4b

Please sign in to comment.