1. mstrVLT

    OP mstrVLT Member
    Newcomer

    Joined:
    Nov 8, 2016
    Messages:
    12
    Country:
    Russia
    A small example for easy development
    https://github.com/MstrVLT/switch_imgui

    ImGui::ShowDemoWindow() function will create a demo window showcasing variety of features and examples.
    The code is always available for reference in imgui_demo.cpp

    Special thx: Pablo Curiel, Cpasjuste, SciresM, yellows8, fincs and all SwitchBrew members

    photo_2020-05-18 14.31.05.jpeg
     
    Last edited by mstrVLT, May 18, 2020
  2. darkxex

    darkxex Advanced Member
    Newcomer

    Joined:
    Jun 13, 2016
    Messages:
    94
    Country:
    Chile
    Thanks friend, this is very useful for my apps.
     
  3. romain337

    romain337 GBAtemp Regular
    Member

    Joined:
    Jan 7, 2016
    Messages:
    141
    Country:
    France
    In your project, you disable next/prev focus keys and unfortunately this is vital to change from window to window using a gamepad. You can look at my repo here https://github.com/notnotme/osp if you want to add mouse emulation using the gamepad (wich is much better than gamepad control in my opinion). The code is in sdl2_impl.cpp.

    Good luck
     
  4. mstrVLT

    OP mstrVLT Member
    Newcomer

    Joined:
    Nov 8, 2016
    Messages:
    12
    Country:
    Russia
    switch_imgui/source/imgui/imgui_impl_sdl.cpp button mapping is wrong for switch i recomend edit it
    Code:
    MAP_BUTTON(ImGuiNavInput_Cancel, SDL_CONTROLLER_BUTTON_A); // Circle / B
    MAP_BUTTON(ImGuiNavInput_Menu, SDL_CONTROLLER_BUTTON_X); // Square / X
    MAP_BUTTON(ImGuiNavInput_Input, SDL_CONTROLLER_BUTTON_Y); // Triangle / Y
    MAP_BUTTON(ImGuiNavInput_DpadLeft, SDL_CONTROLLER_BUTTON_DPAD_LEFT); // D-Pad Left
    MAP_BUTTON(ImGuiNavInput_DpadRight, SDL_CONTROLLER_BUTTON_DPAD_RIGHT); // D-Pad Right
    MAP_BUTTON(ImGuiNavInput_DpadUp, SDL_CONTROLLER_BUTTON_DPAD_UP); // D-Pad Up
    MAP_BUTTON(ImGuiNavInput_DpadDown, SDL_CONTROLLER_BUTTON_DPAD_DOWN); // D-Pad Down
    MAP_BUTTON(ImGuiNavInput_FocusPrev, SDL_CONTROLLER_BUTTON_LEFTSHOULDER); // L1 / LB
    MAP_BUTTON(ImGuiNavInput_FocusNext, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); // R1 / RB
    MAP_BUTTON(ImGuiNavInput_TweakSlow, SDL_CONTROLLER_BUTTON_LEFTSHOULDER); // L1 / LB
    MAP_BUTTON(ImGuiNavInput_TweakFast, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); // R1 / RB
    MAP_BUTTON(ImGuiNavInput_Activate, SDL_CONTROLLER_BUTTON_B); // Cross / A
    

    Use touch screen for change focus (or hold "Y" and click L trigger)
    My touch implementation is bad, but better than nothing
     
    Last edited by mstrVLT, May 24, 2020 at 1:30 AM
  5. mstrVLT

    OP mstrVLT Member
    Newcomer

    Joined:
    Nov 8, 2016
    Messages:
    12
    Country:
    Russia
    for keyboard input you can use this piece of code but I did not manage to achieve good results)
    Code:
                if (io.WantTextInput != prevWantInputText) {
                    prevWantInputText = io.WantTextInput;
                    if (io.WantTextInput)
                    {
                        SwkbdConfig kbd;
                        Result rc;
    
                        // char input_kbd[255] = input;
     
                        rc = swkbdCreate(&kbd, 0);
                        if (R_SUCCEEDED(rc)) {
                            swkbdConfigMakePresetDefault(&kbd);
                            swkbdConfigSetInitialText(&kbd, input);
                            rc = swkbdShow(&kbd, input, sizeof(input));
                          
                           io.AddInputCharactersUTF8(input);
    
                            swkbdClose(&kbd);
                        }
                    }
                }
    
     
    Last edited by mstrVLT, May 24, 2020 at 1:30 AM
    romain337 likes this.
  6. romain337

    romain337 GBAtemp Regular
    Member

    Joined:
    Jan 7, 2016
    Messages:
    141
    Country:
    France
    Thanks you, if I need keyboard input in one of my apps I'll come back here to use this as a starting point to implement soft keys. I really appreciate.
    About the gamepad mapping, I saw it was wrong for switch and edited it too.

    Mine is not better, act only as simple click, you can't scroll.
     
  7. mstrVLT

    OP mstrVLT Member
    Newcomer

    Joined:
    Nov 8, 2016
    Messages:
    12
    Country:
    Russia
    Last edited by mstrVLT, May 25, 2020 at 10:32 AM
    romain337 likes this.
  8. HookedBehemoth

    HookedBehemoth Advanced Member
    Newcomer

    Joined:
    Dec 26, 2018
    Messages:
    81
    Country:
    Germany
    hippy dave likes this.
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - application, (libnx), Simple