Just testing the animation class...it's a fairly simple one really.
You can't see it in the screenshot but the fairies are both looping around the witch, flapping their wings, and the witch is mixing her brew. Also it looks like the fairy has some weird split in her hair, which is caused by my integrated graphics card and Windowed-OpenGL not liking each other very much.
#include <A2DRia/A2DRia.hpp>
int main( int argc, char **argv )
{
A2D::Ria::CMainWindow win;
win.Create(500, 450, 32, 0, "Hello!");
win.GetGraphicsDriver()->EmulateResolution(A2D::Base::CVector(250.0f, 225.0f));
A2D::Ria::SpriteSheet sprSheet;
sprSheet = win.GetGraphicsDriver()->CreateSpriteSheet();
if ( !sprSheet->CreateFromFile("boo.bmp", A2D::Ria::Colours::MagicPink() ) ) return 1;
CAnimation anim( win.GetGraphicsDriver() );
anim.CreateSheet("boo.bmp", A2D::Ria::Colours::MagicPink()); // Just to show that you can load a sprite sheet with the animation OR set it to a sprite sheet outside the animation
anim.SetSpeed(1.0f/6.0f);
anim.SetFrameDetails(25, 35);
anim.StartAnim( win.GetTimer(), 2, 3, true);
CAnimation anim2( win.GetGraphicsDriver() );
anim2.SetSpriteSheet(sprSheet);
anim2.SetSpeed(1.0f/6.0f);
anim2.SetFrameDetails(25, 35);
anim2.StartAnim( win.GetTimer(), 1, 3, true);
CAnimation anim3( win.GetGraphicsDriver() );
anim3.SetSpriteSheet(sprSheet);
anim3.SetSpeed(1.0f/3.0f);
anim3.SetFrameDetails(25, 35);
anim3.StartAnim( win.GetTimer(), 0, 3, true);
double dLastFrame = win.GetTimer();
A2D::Base::CVector _Pos1(50.0f, 100.0f);
A2D::Base::CVector _Pos2(200.0f, 100.0f);
A2D::Base::CVector _Pos3( 250.0f/2.0f, 225.0f/2.0f );
while( !win.GetWasCloseRequestMade() )
{
win.GetGraphicsDriver()->BeginScene();
win.GetGraphicsDriver()->CLS( A2D::Ria::Colours::LightGray() );
anim.Play( _Pos1, win.GetTimer() );
anim2.Play( _Pos2, win.GetTimer() );
anim3.Play( _Pos3, win.GetTimer() );
win.GetGraphicsDriver()->EndScene();
if ( dLastFrame + (1.0f/60.0f) <= win.GetTimer() )
{
_Pos1 = _Pos1.RotateAroundZ( _Pos3, 1.0f );
_Pos2 = _Pos2.RotateAroundZ( _Pos3, 1.0f );
dLastFrame = win.GetTimer();
}
do
{
win.FlushRendering();
win.PollSystem();
}while( win.GetInputDriver()->GetIsPressed('S') ); // Means if they hold S the screen 'freezes' until they release it
}
anim.DestroyLocalSheet();
win.GetGraphicsDriver()->DestroySpriteSheet(&sprSheet);
win.Destroy();
return 0;
}
At the moment I still haven't got the windows screen creation ported yet, though everything else OS-Dependant has been (It has a rather nice Object-Oriented Wrapper for Threads (POSIX for Linux and the Windows API for Windows) which is somewhat based on the Java one...as well as mutex support etc...though all that is not too hard to program once you get your head around the same function being run by many threads and ways to take advantage of that).
Really need to learn OpenAL sometime so I can write the drivers for that...it's been on my To-Do list for far too long.
Also considering changing the RIA (Rendering, Input and Audio) to RIAN (Rendering, Input, Audio and Networking) but that just makes things more complicated for me...also I'm clueless as-to how to do networking on Linux
The design of the whole thing is based slightly on the ZFGSDK but I didn't take any code from it (did steal some ideas though
), and added a lot of my own ideas (I've split the whole thing into three seconds, each one independent of the ones below it but dependant on the ones above it)
A2D::Engine - I've...designed it...in my head...somewhat. Not actually gotten any code down.
A2D::Ria - Rendering is like...80% finished, Input 95% (may add Joystick support and so-on later so I'm hesitant to label it completely done), need to get working on Audio which is like...0%
A2D::Base - Pretty much 100% Finished for both Linux and Windows