clockworkpi

Hello World for GameShell in C++ / SDL2 and distributed as a Warehouse package

I did a project that helped me work out a development path to build C++ SDL2 applications for the clockwork gameshell, and then distribute them using the warehouse.

You can try out this extremely exciting hello world application by following these install instructions:

  1. Your gameshell must be online
  2. Enter the Warehouse application
  3. Choose the + Add new warehouse… option
  4. In the text editor, write github.com/crolando/cw and then press the Y button
  5. with the new URL selected, press the A button to enter my warehouse.
  6. Choose the entry called SDL Example and press the A button
  7. Select the entry called hello_world and press the Y button to look at my application preview.
  8. Press the A button to download it (this is extremely subtle, you get very little feedback other than the text goes from gray to black)
  9. Press the A button to run it.
  10. A splash screen will be displayed, this is the hello world program.
  11. When you’re done, press the MENU button and it will return to the gameshell launcher

How did I make this?
My development pattern for this was pretty weird, but it is very simple to set up. I use WinSCP, the ftp program, to connect to the gameshell. I also have a PuTTY session connected to the gameShell. Using WinSCP, I can create a file using my windows computer directly on the gameshell, and edit it using NotePad++. This is kind awesomely friendly to do, because when you click “save” in notepad++, WinSCP will silently auto-upload it to the disk. It’s as if you’re just editing files on your windows hard drive. This is how I do my programming.

When I want to build the file, I switch to PuTTY, and I invoke the clang compiler to build the binary. Using WinSCP, I create a bash script that is set up to run the binary, and redirect the standard output and standard error streams to a file. This lets me print debug messages during a handheld run session to see where things are breaking.

To test the program, I pick up the gameshell, and use Utils > DinguxCommander. I navigate to my build area, and execute my script with the redirects. After the program executes, I can read the printed messages that were written into the log files using WinSCP. I also found it was occasionally useful to check the general error log to look for issues:
cat /tmp/x.log

If you want to see my source file and the development script, they are included in the warehouse package, and will be put here after you run the program:

/home/cpi/aria2download/crolando/cw/master/sdl_example/hello_world/file/hello_world/hello_world.sh
/home/cpi/aria2download/crolando/cw/master/sdl_example/hello_world/file/hello_world/main.cpp

The main.cpp file has the clang commandline to build the hello world example as a comment. I don’t reccomend you do this in this folder, since it will desynchronize the binary from the github warehouse. If you want to play around with the program, copy it somewhere else first using winSCP, build it using PuTTY, and then run it using DinguxCommander.

After I did all of that development and cleaned up the comments and stuff, I used WinSCP to copy the script, binary and resources (like the BMP) to my windows computer. Here, I tar and gzipped the stuff, wrote the json files and then uploaded it to github. It took a few tries to get right, but it all works!

4 Likes