Author Topic: Example code on sprite  (Read 2310 times)

0 Members and 3 Guests are viewing this topic.

chrisc

  • Guest
Example code on sprite
« on: March 27, 2018, 12:50:56 PM »
Hello

is there an example code on sprite?

Mike Lobanovsky

  • Guest
Re: Example code on sprite
« Reply #1 on: March 28, 2018, 02:00:27 AM »
Chris,

That depends on what you mean by "sprite". You may wish to have a look at \projectsB\GDI in the O2 distro. That's essentially Peter Wirbelauer's GDI engine that also comprises bits and pieces of sprite engine functionality. (Peter is our fellow forumer though he seems inactive now)

Examine his Window.inc file and the accompanying example scripts (e.g. WaterFall etc.) paying attention to such functions as LoadBmp()/LoadTile() and Sprite()/SetTile() procedures. They would allow you to load BMPs with multiple images (frames) of sprite animation phases and draw them in the window GDI canvas transparently. He uses the same functionality in his simple "particle system" too.

The engine is a little aggressive on your CPU but it may be used as a basis for further improvement, extension, and optimization.

There used to be a lot more examples of specific use cases of sprites on this forum but regretfully message attachments are only available for 90 days upon upload.

chrisc

  • Guest
Re: Example code on sprite
« Reply #2 on: March 28, 2018, 09:53:59 AM »
Thanxx Mike

the sprite that i need is something like a splash screen graphics -- to present to the
user what's the purpose of the program for a short duration
i will look up at Peter's work

meanwhile i have a copy of the  version of the sprite atteched written in pb

Mike Lobanovsky

  • Guest
Re: Example code on sprite
« Reply #3 on: March 28, 2018, 01:06:10 PM »
Chris,

Such kind of programs can be written using Peter's GDI engine I pointed you to. Take your time and study the example scripts in full. Probably Peter will also show up on the forum in the meantime and will add more examples that you can use to develop your own apps. I have many scripts originally written by Peter but they have all been re-written in FBSL BASIC and thus would be of no or very little help to you as far as OxygenBasic is concerned.


[UPD] Here are a few things Peter's GUI engine helped me do in FBSL BASIC too (with a few optimizations and modifications, of course).

Be sure to unblock the exes. I guarantee there's no malware inside. Possible AV positives would all be false as with every other indie BASIC around. ;)
« Last Edit: March 28, 2018, 03:27:57 PM by Mike Lobanovsky »