Ah, I see, Preben. had to re-think my code - works now. Thanks!
// includes
#include "MoveShips.h"
// namespace
using namespace AGK;
app App;
void app::Begin(void)
{
agk::SetWindowTitle( "Move Ship" );
agk::SetWindowSize( 1024, 768, 1 );
agk::SetDisplayAspect( 1024 / 768 );
agk::SetVirtualResolution( 1024, 768 );
agk::SetClearColor( 150, 170, 204 ); // light blue
agk::SetVSync(1);
agk::SetScissor( 0, 0, 0, 0 );
agk::UseNewDefaultFonts(1); // nicer font
agk::SetRawMouseVisible(0); // hide mouse pointer
// create sprites
agk::LoadImage( 1, "ship.png" );
agk::CreateSprite( 1, 1 );
agk::CreateSprite( 2, 1 );
agk::CreateSprite( 3, 1 );
agk::SetSpriteOffset( 1, 0.0f, 0.0f );
agk::SetSpriteOffset( 2, 0.0f, 0.0f );
agk::SetSpriteOffset( 3, 0.0f, 0.0f );
// get bounds for full screen
float LeftEdge = agk::GetScreenBoundsLeft();
// position sprites
float xPos = LeftEdge - 64.0f;
agk::SetSpritePosition( 1, xPos, 152.0 );
agk::SetSpritePosition( 2, xPos, 352.0 );
agk::SetSpritePosition( 3, xPos, 552.0 );
}
int app::Loop(void)
{
// get bounds for full screen
float LeftEdge = agk::GetScreenBoundsLeft();
float RightEdge = agk::GetScreenBoundsRight();
float xPos = agk::GetSpriteX(1);
int KeyEsc = agk::GetRawKeyState(27);
agk::Print(agk::ScreenFPS());
agk::Sync();
// re-position sprites
xPos += 2.0;
agk::SetSpritePosition(1, xPos, 152.0);
agk::SetSpritePosition(2, xPos, 352.0);
agk::SetSpritePosition(3, xPos, 552.0);
// break from program
if ( xPos > RightEdge ) PostQuitMessage(0);
if ( KeyEsc) PostQuitMessage(0);
return 0;
}
void app::End(void)
{
// free resources
if (agk::GetImageExists(1) == 1) agk::DeleteImage(1);
if (agk::GetSpriteExists(1) == 1) agk::DeleteSprite(1);
if (agk::GetSpriteExists(2) == 1) agk::DeleteSprite(2);
if (agk::GetSpriteExists(3) == 1) agk::DeleteSprite(3);
}