Comments (5)
I just realized something that may help others though. If one clears the screen and properly nulls all the objects, one can call a game from another one as long as:
- Both share the same dimensions
- One comments the pyxel.run() from the second game (to avoid calling second instances of EventPump)
It's not as straightforward as the Load() command, but it's a good workaround
from pyxel.
Here's a proof of concept of how a launcher could be made with the current codebase. It basically takes the scripts, comments out all calls to pyxel.init() and pyxel.run(), injects code to the update method of the scripts and finally runs it. It can't adapt to different width and heights, it always runs with the default frame rate, and the size of the window and pixels is the default one too.
Everything is very hacky, and probably a re-implementation of pyxel.show() and pyxel.init() could make the task way easier, but at least a solution exist.
from pyxel.
Thank you for the prototype. I've also experimented with restarting code in the past when I wanted to do so.
If I were to add an app load feature to Pyxel, I think I would need a method that meets the following conditions:
Works the same in both web and native environments
Supports resolution for each application
Can restart not only the Pyxel code but also other Python modules being used
I haven't found such a method yet, but if I do, I'd like to implement this feature.
from pyxel.
Since there is no change in the situation, I will close this issue.
from pyxel.
The only way to do this would not be at the Python level, because of all the interpreter state (imported modules, globals…) as well as pyxel state (resolution, palette…), so I can only see using os.execl to execute a clean new process, replacing the current one.
The only thing missing for a pico8-style function would be a way to pass info about the caller, so that the loaded game can provide a way to go back to the original. That could be done with an environment variable for example.
from pyxel.
Related Issues (20)
- mouse_wheel never become 0 HOT 3
- Pyxel Editor crash when selecting Music Editor HOT 6
- Non pixel perfect pixels on the right side of the screen HOT 29
- Pyxel not running HOT 4
- Pyxel crash when starting edit or hello world example HOT 1
- Don't start when I ask for
- command for the terminal didn't work (pycharm) HOT 2
- Slide sound effect only works once HOT 4
- Unable to build a pyxel to exe application on a drive other than C:/ on Windows. HOT 1
- pyxel edit で音符マークを押したら music_editor.py の インデックスエラーで異常終了する。 HOT 1
- `pyxel.sqrt(0)` returns 1.7976931348623157e+308 HOT 4
- Id like to edit the game on web. HOT 3
- Drone yazılımı arıyorum HOT 1
- Please tell me your work with Pyxel (Part5) HOT 6
- New functions HOT 2
- pyxel run of .pyxapp file results in "no such file: 'filename.pyxapp.py' HOT 2
- How to run Pyxel with the latest Emscripten (3.1.46+) HOT 3
- Display Glitch with Horizontal Green Lines in ‘Hello Pyxl’ Program HOT 3
- Failed to create OpenGL context HOT 1
- How to change the window icon in Pyxel. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyxel.