Hi all :)
I put a small demo showing the project progress.
It uses 2D Images ( OpenGL Textures), alpha mapping and transparency.
There are parallax and differencials scrollings.
Here is the link to Download the demo :
http://www.odyssey-creators.com/AmiDARK_Engine0.1WIP_2DDemo.rar Here is also a snapsho made with SGrab showing the demo:
http://www.odyssey-creators.com/AmiDARKEngine0.1WIP2DDemo.png It should be similar to this (excepted the trees and grass that should appear correctly and not like in the shot ... SGrab cause some bugs in OpenGL :( )
And now, for those that'll like to see the Demo source code, here it is :
/***********************************************************
**
** AmiDARK Engine Development Project
**------------------------------------
**
** Sample : Textures/Images demonstration
** Author : Frederic Cordier
** Date : 2009JUI22-043821 **
************************************************************
*/
#!include! "AmiDARKEngine.c"
int ILoop;
float XMountain[3];
float XTrees[ 4 ];
float XHerbs[ 3 ];
float XClouds[5][ 2 ];
void DarkLoop( void ){
// Set display mode to 640x480 using 32bits
DESetDisplayMode( 640, 480, 32 );
// Define default images positions for all elements that'll scroll.
// Mountains
XMountain[ 1 ] = 0.0;
XMountain[ 2 ] = 512.0;
XMountain[ 3 ] = 1024.0;
// Trees.
XTrees[ 1 ] = 0.0;
XTrees[ 2 ] = 512.0;
XTrees[ 3 ] = 1024.0;
XTrees[ 4 ] = 1536.0;
// Grass.
XHerbs[ 1 ] = 0.0;
XHerbs[ 2 ] = 512.0;
XHerbs[ 3 ] = 1024.0;
// Clouds.
XClouds[1][ 1 ] = 0.0;
XClouds[1][ 2 ] = 640.0;
XClouds[2][ 1 ] = 0.0;
XClouds[2][ 2 ] = 640.0;
XClouds[3][ 1 ] = 0.0;
XClouds[3][ 2 ] = 640.0;
XClouds[4][ 1 ] = 0.0;
XClouds[4][ 2 ] = 640.0;
XClouds[5][ 1 ] = 0.0;
XClouds[5][ 2 ] = 640.0;
// Set the amount of used textures
DESetMaximumTextures( 13 );
// Load all images.
DELoadImageEx( "Images/RTSky02_SunWake05.png", 1, 0 );
DELoadImageEx( "Images/Mountains512.png", 2, 0);
DELoadImageEx( "Images/Layer_Trees512A.png", 3, 0);
DELoadImageEx( "Images/Layer_Trees512B.png", 4, 0);
DELoadImageEx( "Images/Layer_Herbs512.png", 5, 0);
DELoadImageEx( "Images/Layer_Water640.png", 6, 0);
DELoadImageEx( "Images/Layer_Cllouds4[640x12]_Alpha.png",7, 0 );
DELoadImageEx( "Images/Layer_Cllouds3[640x18]_Alpha.png",8, 0 );
DELoadImageEx( "Images/Layer_Cllouds2[640x38]_Alpha.png",9, 0 );
DELoadImageEx( "Images/Layer_Cllouds1[640x80]_Alpha.png",10, 0 );
DELoadImageEx( "Images/Layer_Cllouds0[640x42]_Alpha.png",11, 0 );
DELoadImageEx( "Images/Layer_Ground[640x60].png", 12,0 );
DELoadImageEx( "Images/Logo.png", 13, 0 );
DECls();
while( !DELoop() ){
// Blue sky, Moon & Sun
DEPasteImage( 1, 0, 0 );
// Mountains scroll
for ( ILoop = 1; ILoop < 4; ILoop++ ){
XMountain[ ILoop ] = XMountain[ ILoop ] - 0.25;
if ( XMountain[ ILoop ;] < -640.0 ){
XMountain[ ILoop ]& nbsp;= XMountain[ ILoop ] + 640.0;
}
DEPasteImageEx( 2, (int)XMounta in[ ILoop ], 224, 1 );
// Display mountains
DEPasteImage( 6, (int)XMountain [ ILoop ], 320 );
}
// Trees scrolling
for ( ILoop = 1; ILoop < 5; ILoop++ ){
XTrees[ ILoop ] = XTr ees[ ILoop ] - 0.70;
if ( XTrees[ ILoop ]& nbsp;< -512 ){
XTrees[ ILoop ]&nbs p;= XTrees[ ILoop ] + 2048.0;
}
}
// Clouds scrolling using 2 parallax
for ( ILoop = 1; ILoop < 3; ILoop++ ){
XClouds[1][ ILoop ] = ;XClouds[1][ ILoop ] - 0.15;
if ( XClouds[1][ ILoop&nbs p;] < -640.0 ){
XClouds[1][ ILoop ] = XClouds[1][ ILoop ] + 640.0;
}
XClouds[2][ ILoop ] = ;XClouds[2][ ILoop ] - 0.30;
if ( XClouds[2][ ILoop&nbs p;] < -640.0 ){
XClouds[2][ ILoop ] = XClouds[2][ ILoop ] + 640.0;
}
XClouds[3][ ILoop ] = ;XClouds[3][ ILoop ] - 0.45;
if ( XClouds[3][ ILoop&nbs p;] < -640.0 ){
XClouds[3][ ILoop ] = XClouds[3][ ILoop ] + 640.0;
}
XClouds[4][ ILoop ] = ;XClouds[4][ ILoop ] - 0.60;
if ( XClouds[4][ ILoop&nbs p;] < -640.0 ){
XClouds[4][ ILoop ] = XClouds[4][ ILoop ] + 640.0;
}
XClouds[5][ ILoop ] = ;XClouds[5][ ILoop ] - 0.75;
if ( XClouds[5][ ILoop&nbs p;] < -640.0 ){
XClouds[5][ILoop ] = XClouds[5][ ILoop ] + 640.0;
}
}
// Display all clouds
DEPasteImageEx( 7, XClouds[1][ 1 ], 178, 1 );
DEPasteImageEx( 7, XClouds[1][ 2 ], 178, 1 );
DEPasteImageEx( 8, XClouds[2][ 1 ], 160, 1 );
DEPasteImageEx( 8, XClouds[2][ 2 ], 160, 1 );
DEPasteImageEx( 9, XClouds[3][ 1 ], 122, 1 );
DEPasteImageEx( 9, XClouds[3][ 2 ], 122, 1 );
DEPasteImageEx( 10, XClouds[4][ 1 ;], 42, 1 );
DEPasteImageEx( 10, XClouds[4][ 2 ;], 42, 1 );
DEPasteImageEx( 11, XClouds[5][ 1 ;], 0, 1 );
DEPasteImageEx( 11, XClouds[5][ 2 ;], 0, 1 );
// Display the trees.
for( ILoop = 1; ILoop <&n bsp;3; ILoop++ ){
DEPasteImageEx( ILoop + 2, (int)XTrees[ ILoop ], 214, 1 );
DEPasteImageEx( ILoop + 2, (int)XTrees[ ILoop + 2 ], 214, 1 );
DEPasteImage( 12, (int)XTrees[& nbsp;ILoop ], 420 );
DEPasteImage( 12, (int)XTrees[& nbsp;ILoop + 2 ], 420 );
}
// Grass scroll
for ( ILoop = 1; ILoop < 4; ILoop++ ){
XHerbs[ ILoop ] = XHe rbs[ ILoop ] - 1.0;
if ( XHerbs[ ILoop ]& nbsp;< - 512 ){
XHerbs[ ILoop ]&nbs p;= XHerbs[ ILoop ] + 1536.0;
}
DEPasteImageEx( 5, XHerbs[ ;ILoop ], 440, 1 );
}
// display Demo logo
DEPasteImageEx( 13, 64, 48, 1&nbs p;);
// Synchro.
DESync();
}
// Erase all images from memory.
for ( ILoop = 1; ILoop < 14; ILoop++ ){
DEDeleteImage( ILoop );
}
}
Wow ! So similar to Basic languages :p and it's C :)
Feel free to give your opinion about this small demo.
@ +
AmiDARK
Edited by freddix on 2009/9/15 20:49:10
Edited by freddix on 2009/9/15 20:49:48