• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
UBports Robot Logo UBports Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

C++ and SDL with Clickable. A little help please.

Scheduled Pinned Locked Moved App Development
linkc++appsdl2sdl
32 Posts 10 Posters 8.8k Views 6 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z Offline
      zubozrout
      last edited by 10 May 2019, 14:53

      Some of you may find these demos usable:
      https://gitlab.com/zub2/SDLDemo
      https://gitlab.com/zub2/MirGLESDemo

      However with the Mir upgrade things should become a bit easier as regular Wayland-compiled SDL stuff should start working there. That is if I understand it correctly.

      L M 2 Replies Last reply 24 May 2019, 21:17 Reply Quote 4
      • B Offline
        bhdouglass
        last edited by 10 May 2019, 15:08

        @Craig I just came across this thread and tried out what you mentioned. You'll need to bundle sdl2 with your app to be able to use it (Ubuntu Touch doesn't have it preinstalled). But it looks like @zubozrout 's demo might be a good place to start for that.

        open-store.io && bhdouglass.com

        1 Reply Last reply Reply Quote 3
        • L Online
          lduboeuf @zubozrout
          last edited by 24 May 2019, 21:17

          @zubozrout thanks for sharing, it works nicely. I've compiled sdl2 also in a project that only requires audio, i will post the source link here whenever i will publish it

          L 1 Reply Last reply 29 May 2019, 14:44 Reply Quote 1
          • L Online
            lduboeuf
            last edited by 24 May 2019, 21:20

            for reference, it helps understand about clickable and dependencies : https://docs.ubports.com/en/latest/appdev/guides/dependencies.html

            C 1 Reply Last reply 26 May 2019, 06:58 Reply Quote 0
            • C Offline
              Craig @lduboeuf
              last edited by 26 May 2019, 06:58

              @lduboeuf
              Thank you for your response. I ran "clickable create" and entered this option:
              [7] main-cpp - C++/QML App (built using CMake with a main.cpp)
              My project name is "mytest". I ran "clickable" and my USB connected tablet running Ubuntu Touch shows the app with "Hello World!". Good!

              Next, I changed the main.cpp file so that is has the SDL test C++ code that you see in this posting. Also, I tried to make changes to the clickable.json file so the dependencies can be met, like so:

              {
              "template": "cmake",
              "dir": "build/app",
              "libraries": {
              "SDL2": {
              "template": "cmake"
              }
              },
              "dependencies_target": [
              "libsdl2-dev"
              ]
              }

              I saw clickable downloading the SDL2 files for armhf architecture. Looked good. But I get these error messages:

              [ 90%] Linking CXX executable mytest
              CMakeFiles/mytest.dir/main.cpp.o: In function main': main.cpp:(.text+0xc): undefined reference to SDL_Init'
              main.cpp:(.text+0x2e): undefined reference to `SDL_CreateWindow'
              etc...

              What should I adjust to get this test SDL test program working? Thanks!

              L 1 Reply Last reply 27 May 2019, 07:11 Reply Quote 0
              • L Online
                lduboeuf @Craig
                last edited by 27 May 2019, 07:11

                @Craig have you looked at @zubozrout example for SDL2 ?

                1 Reply Last reply Reply Quote 0
                • M Offline
                  mymike @zubozrout
                  last edited by 27 May 2019, 14:45

                  https://gitlab.com/zub2/SDLDemo

                  I managed to build this fine (getting some warnings btw) but the app won't start. I get

                  Command 'echo "sleep 1s && ubuntu-app-launch zub.sdldemo_SDLDemo_0.2" | ssh phablet@ubuntu-phablet' returned non-zero exit status 255.
                  

                  And I can neither grab any log (neither with clickable logs nor with Logviewer) as the log file doesn't exist.

                  L 1 Reply Last reply 27 May 2019, 21:13 Reply Quote 0
                  • L Online
                    lduboeuf @mymike
                    last edited by 27 May 2019, 21:13

                    @mymike not sure but i had that also, try replacing in apparmor file 1.3 with 16.04

                    M 1 Reply Last reply 28 May 2019, 13:54 Reply Quote 2
                    • M Offline
                      mymike @lduboeuf
                      last edited by 28 May 2019, 13:54

                      @lduboeuf thanks https://gitlab.com/mymike00/SDLDemo this works for me!

                      B 1 Reply Last reply 28 May 2019, 17:44 Reply Quote 1
                      • B Offline
                        bhdouglass @mymike
                        last edited by 28 May 2019, 17:44

                        @mymike what do you think about turning your demo into a template for clickable? It could be really great way to get more people creating/porting SDL apps.

                        open-store.io && bhdouglass.com

                        M 1 Reply Last reply 28 May 2019, 18:30 Reply Quote 4
                        • M Offline
                          mymike @bhdouglass
                          last edited by 28 May 2019, 18:30

                          @bhdouglass of course! but I don't know how that app work, neither how to make a clickable template. I'll may have a look at it when I'll find some time, but if someone else wants to do it before me, no problem, just do it!

                          L J 2 Replies Last reply 28 May 2019, 21:17 Reply Quote 1
                          • L Online
                            lduboeuf @mymike
                            last edited by lduboeuf 28 May 2019, 21:17

                            @mymike yes maybe @zubozrout ? who did the hard work with SDL2 template

                            1 Reply Last reply Reply Quote 1
                            • L Online
                              lduboeuf @lduboeuf
                              last edited by lduboeuf 29 May 2019, 14:44

                              @lduboeuf just for sharing, published a sample app that using only SDL2 audio https://github.com/lduboeuf/sfxr-qt. I've used template from @zubozrout SDL2 and it works fine.
                              On my device, sounds are not good quality ( some noises ) , not sure if it is hardware pb or something in-between ( on Desktop it plays fine ).

                              1 Reply Last reply Reply Quote 0
                              • Z Offline
                                zubozrout
                                last edited by 29 May 2019, 21:16

                                Just FYI, the credit is not mine but goes to my brother - his nick is zub, mine is not :). Unfortunately I lack the deeper knowledge necessary for such things. All I did was that I upgraded it to work with clickable (already on the original repo) and to run on 16.04 (apparently the apparmor framework update is still not there, but whatever).

                                Regarding the SDL2 clickable template it doesn't sound as a bad idea though. However I really can't spend the time on it now :(. And the second thing is that SDL is no longer supporting Mir and new stuff may require newer SDL. So the question is whether this is useful. With Unity 8 and Mir upgrades (now on Edge) Wayland-enabled stuff should start working. So it would probably be better to start from scratch and take a look at how to compile SDL apps with Wayland. And I suspect that will be much more documented and a more streamlined experience.

                                Sadly Mir didn't turned out the way I was hoping it would ... it is a nicely written code on par with the latest standards as that's how Canonical rolls but that's probably not what the general Linux community wants :(.

                                1 Reply Last reply Reply Quote 2
                                • J Offline
                                  jonius @mymike
                                  last edited by 29 Jul 2019, 20:37

                                  @mymike and others: Creating a clickable template is as simple as providing a git repository with an app that showcases the use case. If someone would like to provide some (it looks like you guys already have something running), simply reply on the feature request: https://gitlab.com/clickable/clickable/issues/122

                                  1 Reply Last reply Reply Quote 0
                                  • C Offline
                                    Craig
                                    last edited by 23 Jan 2020, 11:49

                                    I got my C++/SDL2 program working via clickable on Ubuntu Touch. I got frustrated and put the project aside for several months, but I got back at it a few days ago. I used this demo to start with:
                                    https://gitlab.com/zub2/SDLDemo
                                    I'm not using the SDL2pp wrapper, just the regular SDL2 libraries. I have images, fonts, touchscreen and audio mixer working good.

                                    The only problem I need to fix before I can publish it is my app wont seem to run completely full screen. How do I get rid of the Top Bar? The one with the clock and battery icon, etc. It's covering the top of my app window.

                                    CiberSheepC 1 Reply Last reply 23 Jan 2020, 13:34 Reply Quote 1
                                    • CiberSheepC Offline
                                      CiberSheep @Craig
                                      last edited by 23 Jan 2020, 13:34

                                      @Craig we suggest not to run apps in full mode as a general rule.

                                      You can accomplish that adding --fullscreen if you are using qmlscene or for cpp look into this code might be helpful

                                      Another planet, another time, another universe!

                                      1 Reply Last reply Reply Quote 0
                                      • C Offline
                                        Craig
                                        last edited by 30 Jan 2020, 13:36

                                        Thank you everyone for your help. I finally figured it out and published my app.
                                        https://open-store.io/app/cubechron.craig

                                        M L 2 Replies Last reply 30 Jan 2020, 14:34 Reply Quote 0
                                        • M Offline
                                          mymike @Craig
                                          last edited by 30 Jan 2020, 14:34

                                          @Craig Super, do you mind adding the link to sources in the OpenStore?

                                          C 1 Reply Last reply 31 Jan 2020, 20:41 Reply Quote 0
                                          • L Online
                                            lduboeuf @Craig
                                            last edited by 30 Jan 2020, 22:25

                                            @Craig Congratulation :). But the app crash on my N5 at startup ( devel ).

                                            Got some shm_open failed. Permission denied

                                            C 1 Reply Last reply 31 Jan 2020, 03:27 Reply Quote 0
                                            • First post
                                              Last post