New Sprite/2D Scene Graph/Interaction framework


I’ve been working on a 2D cross-platform animation framework that I’d like to release someday. Right now, it’s back by the Graphics objits(not GPU accelerated) but it’s performance has been quite good for simple games and UI animation. The framework could support GPU accelerated drawing in the future.

Geoff gave a demo of one of the apps I’ve developed it for at the XOJO retreat:

(embedded video will start at the demo)

In the past, I’ve developed and released SuperSpriteSurface (SSS), which used OpenGL:

The new framework is similar, just as friendly to use as SSS but more modern in other ways. There are attachable “behaviors” to animate sprites; easy pointer interaction with sprites, shape/collision bounds, camera panning/zooming, and screen updates only occur when there are changes or animations occurring.

Until there’s a good option for cross-platform GPU accelerated drawing in XOJO, I won’t add some of the game-specific functionality that SSS had, such as tiled surfaces, particles, etc. But what is already there is great for richly animated UIs or simple games.

I will keep this thread updated with progress and welcome any questions/feedback.



Hi John. Glad to see you’re still around. I loved SSS back in the day.

This has come at a very good moment for me as I’m working on a game making app/framework for Xojo using my port of Box2D and a custom scripting language.

I would love to see/hear more of what you’re doing in this space.


Hi Garry,

I saw your Box2D video; very impressive. Box2D would be a good match for this—I used the C library years ago. A physics engine, IIRC, is run at a constant time step while the frame rate remains variable. I did some early tests with running a simulation in a thread at a constant time step, independent of the frame timer (running on the main thread), and things did get bogged down at a certain point because the graphics pipeline (not being optimized) uses a lot of resources.

Do you have a demo or any code you can share?

Sure, I can share a repo privately; allow me a little while to prepare. I’ll send you a DM when it’s ready.

1 Like

Thanks John. That would be awesome.

1 Like

Looking forward to your new 2D framework John.
I too enjoyed SSS back in the day.

1 Like

Thanks, Pedro!

I have some updates on this framework: After a lot of design and refacoring based on actually application work, it’s reached the point where I want to release it. But there are some limitations, which can be addressed if there’s community interest/effort. This also defines the roadmap. Let’s discuss:

  • No documentation
  • I have a few apps built with the framework, but I can’t give them away since they’re commercial. Some small demo projects would be helpful.
  • Mobile only class: The base control, TRAnimationCanvas, is a subclass of MobileCanvas. In theory, a lot of this could be moved to an crossplatform class, with minimal hooks in place for MobileCanvas and DesktopCanvas

  • macOS & iOS class: My transform class uses CGAffineTransform functions under the hood. They’d need to be rewritten in native XOJO.

  • I’m not a sound/music person, so I haven’t tried to add or test anything in this area.

  • Finally, the framework is tied to my larger XOJO framework which has it’s own git repo, and some things will need to be separated and kept private. (And also unfortuately, I can’t distribute this framework as a plugin, which would make things a bit easier.)

Here’s a video of one of my games:


Good news: After 10 hours of refactoring, everything works on both iOS and macOS:

See movie: Dropbox - TRAnimation macOS and - Simplify your life

The split between the mobile and desktop controls is handled neatly with patterns:


(Though there seems to be a bug in iOS project that prevents the desktop control from being ignored the mobile project, while the mobile canvas control can be ignored in the desktop project)

Handling Timer.Run vs Timer.Action:


And finalyl, Font differences between Desktop and Mobile are handled.

So basically, everything is handled transparently behind the scenes, allowing you to write your sprite framework code for either platform.

This is one step closer to being released but I’m not yet sure what type of license to use.


This looks fantastic - what great work well done!

I’m currently refactoring the compiler and VM for my game scripting language. Once that’s done I’d love to play around with this and maybe integrate my Box2D port with it.

Is it using OpenGL or Metal under the hood or is it native Xojo Canvas?

@GarryPettet Thanks. Right now, it’s just the native canvas. Performance is OK so long as you’re not doing a lot of fill-heavy or translucent stuff. The scene graph and transform stack is computed internally and maintained, so it would be a simple task to take the transforms matrices and use them to display in another graphics backing.

1 Like

Support for generic replacement of OpenGL (like Metal) is super high on top of my wish list as someone use such features as LOT.


As far as macOS is concerned (and theoretically iOS): I have a pretty complete SpriteKit framework purely made of Xojo declares. But I am uncertain if and how it could be integrated into this project.


Oh wow. :heart_eyes:

I’m happy to do a screenshare overview of the framework next week and you can QA any integration questions. I’ll have the source available beforehand. @GarryPettet, too.

1 Like

TBH, I do not see much of a chance to add another voluntary project to my schedule without losing the right to ever discuss any aspect of work-life-balance again. But I’ll try to fix whatever currently stops the very rudimentary Space Invaders setup I made and look forward to see what could be possible.
I feel that RB/Xojo has lost functionality, and if that project could help to get back some of that, I’ll gladly share the code with you. In the worst case, as all declares are external methods, one could use only that part and save some typing time for a different basic integration than I chose.

1 Like

I’ve released the source code here under MIT License:

There’s no documentation, but there are two test projects for iOS and macOS that use the same source files. No Windows support right now; see the note below.

I’ll also be doing some refactoring of method names in the near future to make interface and publicly-overridable method names clearer.

The primary thing holding back Windows support is that I’m using CGAffineTransform/Core Graphics metrics declares. This should be replaced with a pure Xojo solution—there’s nothing preventing it if anyone would like to help.


I’d just like to say thanks to John for releasing this very impressive framework. He was kind enough to spend some time walking me through it’s capabilities and I can’t wait to use it in my current app.


We did not manage to talk about SpriteKit, and TBH I did not find time yet to set it into working mode again.
BUT: I created a pure Xojo only TransformationMatrix module that can also be used to get the existing transformation from three known points and their real position. I will gladly share it with you if you like.


Yes, that would be a very welcome contribution! I would like to refactor my existing class with the native code to keep the usage/API the same. I would add attribution to the class with credit for your contribution.