Sure! The source is right below, but you'll need my wrapper to compile it:
http://forum.thegamecreators.com/?m=forum_view&t=124748&b=22
^^ You can get the wrapper there.
Source (it's kind of messy
)
#include "DarkGDK.h"
#include "DarkOOP.h"
#define MENU 1
#define GAME 2
#define DIFFICULTY 10
#define NoEscapeKey dbDisableEscapeKey( )
#define Randomize dbRandomize( dbTimer( ) )
bool HowToPlayVisible;
bool Dragging;
Vector2 HowToPlayOldPos;
Vector2 MouseOldPos;
int DifficultyTimer;
int LastSound;
Vector2 BallPos;
Vector2 BallMove;
int GameStage = MENU;
void DarkGDK( void )
{
NoEscapeKey;
Randomize;
/*Devices--------------------------------------------------------------*/
IVideoDevice* Video = NewVideoDevice( 800, 600, 32, 60, false, Grey );
ISceneDevice* Scene = NewSceneDevice( );
IGUIDevice* GUI = NewGUIDevice ( );
IMouseInput* Mouse = NewMouseInput ( );
IFileLoader* File = NewFileLoader ( );
/* Set the directory. */
File->SetDir( "../../../Media" );
/* Textures----------------------------------------------------------------------- */
ITexture* HowToPlayTexture = Scene->NewTexture( "HowToPlay.png" );
ITexture* ButtonStartReg = Scene->NewTexture( "ButtonStartReg.png" );
ITexture* ButtonStartOver = Scene->NewTexture( "ButtonStartOver.png" );
ITexture* ButtonHowToPlayReg = Scene->NewTexture( "ButtonHowToPlayReg.png" );
ITexture* ButtonHowToPlayOver = Scene->NewTexture( "ButtonHowToPlayOver.png" );
ITexture* ButtonExitReg = Scene->NewTexture( "ButtonExitReg.png" );
ITexture* ButtonExitOver = Scene->NewTexture( "ButtonExitOver.png" );
ITexture* BackgroundTexture = Scene->NewTexture( "Background.png" );
ITexture* TitleFrames[ 4 ];
TitleFrames[ 0 ] = Scene->NewTexture( "TitleFrame1.png" );
TitleFrames[ 1 ] = Scene->NewTexture( "TitleFrame2.png" );
TitleFrames[ 2 ] = Scene->NewTexture( "TitleFrame3.png" );
TitleFrames[ 3 ] = Scene->NewTexture( "TitleFrame4.png" );
TitleFrames[ 4 ] = Scene->NewTexture( "TitleFrame5.png" );
ITexture* PaddleFrames[ 7 ];
PaddleFrames[ 0 ] = Scene->NewTexture( "PaddleFrame1.png" );
PaddleFrames[ 1 ] = Scene->NewTexture( "PaddleFrame2.png" );
PaddleFrames[ 2 ] = Scene->NewTexture( "PaddleFrame3.png" );
PaddleFrames[ 3 ] = Scene->NewTexture( "PaddleFrame4.png" );
PaddleFrames[ 4 ] = Scene->NewTexture( "PaddleFrame5.png" );
PaddleFrames[ 5 ] = Scene->NewTexture( "PaddleFrame6.png" );
PaddleFrames[ 6 ] = Scene->NewTexture( "PaddleFrame7.png" );
PaddleFrames[ 7 ] = Scene->NewTexture( "PaddleFrame8.png" );
ITexture* BallFrames[ 3 ];
BallFrames[ 0 ] = Scene->NewTexture( "BallFrame1.png" );
BallFrames[ 1 ] = Scene->NewTexture( "BallFrame2.png" );
BallFrames[ 2 ] = Scene->NewTexture( "BallFrame3.png" );
BallFrames[ 3 ] = Scene->NewTexture( "BallFrame4.png" );
/* Sounds----------------------------------------------------------*/
ISound* StartSound = Scene->NewSound( "StartSound.mp3" );
ISound* LoseSound = Scene->NewSound( "LoseSound.mp3" );
ISound* MenuSound = Scene->NewSound( "MenuSound.mp3" );
ISound* HitSounds[ 4 ];
HitSounds[ 0 ] = Scene->NewSound( "HitSound1.mp3" );
HitSounds[ 1 ] = Scene->NewSound( "HitSound2.mp3" );
HitSounds[ 2 ] = Scene->NewSound( "HitSound3.mp3" );
HitSounds[ 3 ] = Scene->NewSound( "HitSound4.mp3" );
HitSounds[ 4 ] = Scene->NewSound( "HitSound5.mp3" );
/* Animated Sprites------------------------------------------------------ */
IAnimatedSprite* TitleText = Scene->NewAnimatedSprite( TitleFrames, 5 );
IAnimatedSprite* Paddle = Scene->NewAnimatedSprite( PaddleFrames, 8 );
IAnimatedSprite* Ball = Scene->NewAnimatedSprite( BallFrames, 4 );
/* Sprites--------------------------------------------------*/
ISprite* Background = Scene->NewSprite( BackgroundTexture );
ISprite* HowToPlay = Scene->NewSprite( HowToPlayTexture );
/* GUI------------------------------------------------------------------------------------*/
IGUIButton* ButtonStart = GUI->NewButton( ButtonStartReg, ButtonStartOver );
IGUIButton* ButtonHowToPlay = GUI->NewButton( ButtonHowToPlayReg, ButtonHowToPlayOver );
IGUIButton* ButtonExit = GUI->NewButton( ButtonExitReg, ButtonExitOver );
/*Set video stuff.*/
Video->SetWindowPosition( GetVector2d( 0.0f, 0.0f ) );
Video->SetText( "Sydnie", 12 );
/* Setup sprites. */
TitleText->SetPosition( GetVector2d( 260, 120 ) );
TitleText->SetDelay( 150.0f );
TitleText->Draw( );
TitleText->SetPriority( 2 );
Paddle->SetDelay( 60.0f );
Paddle->Draw( );
Paddle->SetPriority( 2 );
Paddle->Hide( );
Paddle->SetPosition( GetVector2d( 355.0f, 500.0f ) );
Ball->SetDelay( 60.0f );
Ball->Draw( );
Ball->Hide( );
Ball->SetPriority( 2 );
HowToPlay->SetPosition( GetVector2d( 275, 50 ) );
/* Buttons. */
ButtonStart->SetPosition( GetVector2d( 325, 350 ) );
ButtonStart->SetVisible( false );
ButtonHowToPlay->SetPosition( GetVector2d( 325, 430 ) );
ButtonHowToPlay->SetVisible( false );
ButtonExit->SetPosition( GetVector2d( 325, 510 ) );
ButtonExit->SetVisible( false );
while ( Video->Run( ) )
{
if ( GameStage == MENU )
{
if ( !LoseSound->IsPlaying( ) )
MenuSound->Loop( );
else
MenuSound->Stop( );
if ( TitleText->GetFrame( ) == 5 )
{
TitleText->Pause( );
ButtonStart->SetVisible( true );
ButtonHowToPlay->SetVisible( true );
ButtonExit->SetVisible( true );
}
if ( ButtonStart->MouseClicked( ) )
{
GameStage = GAME;
ButtonStart->SetVisible( false );
ButtonHowToPlay->SetVisible( false );
TitleText->Hide( );
HowToPlay->Hide( );
ButtonExit->SetVisible( false );
Paddle->Show( );
Paddle->SetPosition( GetVector2d( 355.0f, 500.0f ) );
Mouse->GetMovement( );
Ball->Show( );
HowToPlayVisible = false;
Mouse->Hide( );
BallMove.x = dbRnd( 5 ) + 5;
BallMove.y = dbRnd( 5 ) + 5;
BallPos = GetVector2d( 356, 256 );
DifficultyTimer = 0;
ButtonStart->Update( );
ButtonHowToPlay->Update( );
ButtonExit->Update( );
TitleText->Draw( );
HowToPlay->Draw( );
Paddle->Draw( );
Ball->Draw( );
StartSound->Stop( );
StartSound->Play( );
MenuSound->Pause( );
}
if ( ButtonHowToPlay->MouseClicked( ) )
{
if ( HowToPlayVisible == true )
{
HowToPlayVisible = false;
int Sound = dbRnd( 4 );
if ( Sound == LastSound )
Sound++;
if ( Sound == 5 )
Sound = 0;
LastSound = Sound;
HitSounds[ Sound ]->Stop( );
HitSounds[ Sound ]->Play( );
}
else
{
HowToPlayVisible = true;
int Sound = dbRnd( 4 );
if ( Sound == LastSound )
Sound++;
if ( Sound == 5 )
Sound = 0;
LastSound = Sound;
HitSounds[ Sound ]->Stop( );
HitSounds[ Sound ]->Play( );
}
}
if ( ButtonExit->MouseClicked( ) )
return;
if ( HowToPlayVisible )
{
HowToPlay->Show( );
HowToPlay->SetPriority( 2 );
if ( Mouse->GetClicked( MouseLeft ) &&
Mouse->GetPosition( ).x > HowToPlay->GetPosition( ).x &&
Mouse->GetPosition( ).y > HowToPlay->GetPosition( ).y &&
Mouse->GetPosition( ).x < HowToPlay->GetPosition( ).x + HowToPlay->GetSize( ).x &&
Mouse->GetPosition( ).y < HowToPlay->GetPosition( ).y + HowToPlay->GetSize( ).y )
{
MouseOldPos = Mouse->GetPosition( );
HowToPlayOldPos = HowToPlay->GetPosition( );
Dragging = true;
}
if ( Mouse->GetHeld( MouseLeft ) == true )
{
if ( Dragging == true )
{
HowToPlay->SetPosition( GetVector2d
( HowToPlayOldPos.x + ( Mouse->GetPosition( ).x - MouseOldPos.x ),
HowToPlayOldPos.y + ( Mouse->GetPosition( ).y - MouseOldPos.y ) ) );
}
}
else
{
Dragging = false;
}
}
else
HowToPlay->Hide( );
TitleText->Draw( );
ButtonStart->Update( );
ButtonHowToPlay->Update( );
HowToPlay->Draw( );
ButtonExit->Update( );
}
if ( GameStage == GAME )
{
MenuSound->Stop( );
if ( KeyEscape )
{
GameStage = MENU;
ButtonStart->SetVisible( true );
ButtonHowToPlay->SetVisible( true );
ButtonExit->SetVisible( true );
TitleText->Show( );
HowToPlay->Hide( );
Paddle->Hide( );
Ball->Hide( );
BallPos = GetVector2d( 356, 256 );
Mouse->Show( );
ButtonStart->Update( );
ButtonHowToPlay->Update( );
TitleText->Draw( );
HowToPlay->Draw( );
Paddle->Draw( );
Ball->Draw( );
MenuSound->Resume( );
}
float PosX = Paddle->GetPosition( ).x;
float MoveX = Mouse->GetMovement( ).x;
PosX += MoveX;
if ( KeyH && KeyG )
PosX = BallPos.x - 20;
Paddle->SetPosition( GetVector2d( PosX, 500.0f ) );
Paddle->Draw( );
DifficultyTimer++;
if ( DifficultyTimer > DIFFICULTY )
{
DifficultyTimer = 0;
BallMove.y *= 1.0035;
BallMove.x *= 1.0070;
}
BallPos = BallMove + BallPos;
if ( BallPos.x < 0 )
{
BallMove.x = -BallMove.x;
BallPos.x = 1;
int Sound = dbRnd( 4 );
if ( Sound == LastSound )
Sound++;
if ( Sound == 5 )
Sound = 0;
LastSound = Sound;
HitSounds[ Sound ]->Stop( );
HitSounds[ Sound ]->Play( );
}
if ( BallPos.x + 32 > 800 )
{
BallMove.x = -BallMove.x;
BallPos.x = 760;
int Sound = dbRnd( 4 );
if ( Sound == LastSound )
Sound++;
if ( Sound == 5 )
Sound = 0;
LastSound = Sound;
HitSounds[ Sound ]->Stop( );
HitSounds[ Sound ]->Play( );
}
if ( BallPos.y < 0 )
{
BallMove.y = -BallMove.y;
BallPos.y = 1;
int Sound = dbRnd( 4 );
if ( Sound == LastSound )
Sound++;
if ( Sound == 5 )
Sound = 0;
LastSound = Sound;
HitSounds[ Sound ]->Stop( );
HitSounds[ Sound ]->Play( );
}
if ( BallPos.y + 32 > 600 )
{
GameStage = MENU;
ButtonStart->SetVisible( true );
ButtonHowToPlay->SetVisible( true );
ButtonExit->SetVisible( true );
TitleText->Show( );
HowToPlay->Hide( );
Paddle->Hide( );
Ball->Hide( );
BallPos = GetVector2d( 356, 256 );
Mouse->Show( );
ButtonStart->Update( );
ButtonHowToPlay->Update( );
TitleText->Draw( );
HowToPlay->Draw( );
Paddle->Draw( );
Ball->Draw( );
LoseSound->Stop( );
LoseSound->Play( );
MenuSound->Resume( );
}
if ( BallPos.x + 32 > Paddle->GetPosition( ).x &&
BallPos.x < Paddle->GetPosition( ).x + Paddle->GetSize( ).x &&
BallPos.y + 32 > Paddle->GetPosition( ).y &&
BallPos.y < Paddle->GetPosition( ).y + 32 )
{
BallMove.y = -BallMove.y;
BallPos.y = Paddle->GetPosition( ).y - 32;
int Sound = dbRnd( 4 );
if ( Sound == LastSound )
Sound++;
if ( Sound == 5 )
Sound = 0;
LastSound = Sound;
HitSounds[ Sound ]->Stop( );
HitSounds[ Sound ]->Play( );
}
Ball->SetPosition( BallPos );
Ball->Draw( );
}
Background->Draw( );
Video->Sync( );
}
return;
}