Code Monkey home page Code Monkey logo

Comments (5)

salazarbarrera avatar salazarbarrera commented on May 18, 2024

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:

  1. Both share the same dimensions
  2. 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.

salazarbarrera avatar salazarbarrera commented on May 18, 2024

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.

kitao avatar kitao commented on May 18, 2024

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.

kitao avatar kitao commented on May 18, 2024

Since there is no change in the situation, I will close this issue.

from pyxel.

merwok avatar merwok commented on May 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.