DanS2D / Solar2DTux

The Solar2D games/apps engine for Linux. Discord: https://discord.gg/WMtCemc
MIT License
47 stars 6 forks source link

Using Solar2DTux with Corona Editor (Sublime Text) #6

Open carlHR opened 3 years ago

carlHR commented 3 years ago

So, in the newer version you are going to release, is there a way to tell the Solar2DSimulator script which file it should open, instead of just showing the main interface? Things could be easier if you could add a parameter to the script "Solar2DSimulator".

I would like to be able to do this:

~$ cd /opt/Solar2D/
/opt/Solar2D$ Solar2DSimulator /home/<user>/Documents/main.lua

Right now this is not supported, so if I execute it, the Simulator window does not shows up, just the console, and nothing happens.

This is what the terminal shows if I try it:

/opt/Solar2D$Solar2DSimulator main.lua /home/<user>/Documents/main.lua
Unexpected parameter 'main.lua'
Usage: Solar2DSimulator [-h] [--verbose]
  -h, --help    show this help message
  --verbose     generate verbose log messages

Why or how is it related to Corona Editor?

Well, it's simple. When you install the Corona Editor package on Sublime Text, you can add this line on the Package Settings file:

"corona_sdk_simulator_path": "/opt/Solar2D/Solar2DSimulator",

This line indicates that when you press Win + F10 on Sublime Text, it will call this script and the associated file, to automatically open the simulator and run the code with just the press of 2 buttons.

This is what the Sublime Text built-in terminal shows when I press Win + F10, and the main reason why I think that adding this feature will make it compatible with Corona Editor:

Unexpected parameter '/home/carlos/Documents/Solar2D Projects/Test/main.lua'
Usage: Solar2DSimulator [-h] [--verbose]
  -h, --help    show this help message
  --verbose     generate verbose log messages
[Finished in 10.7s with exit code 255]
[cmd: ['/opt/Solar2D/Solar2DSimulator', '/home/carlos/Documents/Solar2D Projects/Test/main.lua']]
[dir: /home/carlos/Documents/Solar2D Projects/Test]
[path: /home/carlos/bin:/home/carlos/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin]
DanS2D commented 3 years ago

Thanks for the suggestion @carlHR. I'm adding this to the todo list.