Real time splash window

A forum to store posts deemed exceptionally wise and useful
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Real time splash window

Post by Emil_halim »

hi all

sometimes we need a real splash window (a window without title bar) in our game for
making our game introduction.

so i create a TSplash class, that allow you to changes your Irrlicht window to appeare as a splash window,also you could control of the time that the splash window will stay on our screen then the orignal window will appeare automatically.

you could put your splash code in a separate bool function,so that the splash window will stay untill the time is or the function return false, you could use it to skip the rest of introuduction if the user take some action like press escap or press any mouse buttom.

here is a link

http://www.irrforge.org/index.php/Real_ ... h_Irrlicht
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

wow! this looks tremendously helpful! thnx! your tuts at irrforge rock!

:D
X_for_Extra
Posts: 69
Joined: Mon May 23, 2005 4:42 pm

Post by X_for_Extra »

I just put some code on the wiki too:

http://www.irrforge.org/index.php/Custo ... ra_control

I'd be happy if some admin or something could look it over. This is my first contact with wikis..
Should put something witty here I suppose.
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

afecelis wrote:wow! this looks tremendously helpful! thnx! your tuts at irrforge rock!

:D
:D thanks a lot
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

i have extend the feature of class so that you could resize the splash window as you
prefer and ofcourse it will be centered in the screen then the orignal window of irrlicht
will appeare as you dimensioned it when creating the Device.

http://www.irrforge.org/index.php/Real_ ... h_Irrlicht
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

getting the following errors:

Code: Select all

main.cpp(40) : error C2065: 'splah' : undeclared identifier
main.cpp(41) : error C2227: left of '->playSplash' must point to class/struct/union
        type is ''unknown-type''
main.cpp(41) : error C3861: 'splah': identifier not found, even with argument-dependent lookup
main.cpp(52) : error C2562: 'main' : 'void' function returning a value
how do we declare your "splah" class?

and "mesh" and "node" hadn't been declared.

Code: Select all

IAnimatedMesh* mesh =0; //added this line
mesh=irrSceneMgr->getMesh("media/sydney.md2");
IAnimatedMeshSceneNode* node =0; //added this line
node=irrSceneMgr->addAnimatedMeshSceneNode(mesh);
or am I doing something wrong?
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

thanks for telling that error.

it is only error of forgot to declare the class,any way here is the correct code
i will post it to wiki.i have tested it with Dev-C++

Code: Select all

#include <windows.h>
 #include "irrlicht.h" 
 using namespace irr; 
 using namespace core; 
 using namespace scene; 
 using namespace video; 
 using namespace io; 
 using namespace gui; 
 
 #include "CSplash.cpp" 
 
 static IrrlichtDevice *irrDevice;
 static IVideoDriver *irrVideo;
 static ISceneManager *irrSceneMgr;
 static ITexture *images;
 
 BOOL    RenderSplash (void);
 
int main(int argc, char *argv[])
 { 
    irrDevice=createDevice(EDT_DIRECTX9,dimension2d<s32>(640,480),32,FALSE,FALSE,FALSE,0);
    irrDevice->setWindowCaption(L"Splash class demo by Emil Halim");
    irrVideo=irrDevice->getVideoDriver();
    irrSceneMgr=irrDevice->getSceneManager();
    images=irrVideo->getTexture("media/2ddemo.bmp");
    irrVideo->makeColorKeyTexture(images,position2d<s32>(0,0));
    
    IAnimatedMesh* mesh=irrSceneMgr->getMesh("media/sydney.md2");
    IAnimatedMeshSceneNode* node=irrSceneMgr->addAnimatedMeshSceneNode(mesh);
    node->setMaterialFlag(EMF_LIGHTING,FALSE);
    node->setFrameLoop(0,310);
    node->setMaterialTexture(0,irrVideo->getTexture("media/sydney.bmp"));
    irrSceneMgr->addCameraSceneNode(0,vector3df(0,30,-40),vector3df(0,5,0));
    
    TSplash* splah= new TSplash(irrVideo);
    splah->playSplash(RenderSplash,5000,342,224);
    while(irrDevice->run())
     {
         irrVideo->beginScene(TRUE,TRUE,SColor(0,200,200,200));
         irrSceneMgr->drawAll();
         irrVideo->endScene();
     }
    irrDevice->drop();
     
    return 0; 
 }    
 BOOL RenderSplash (void)
 {
      irrDevice->run();
      irrVideo->beginScene(TRUE,TRUE,SColor(0,0,0,0));
      irrVideo->draw2DImage(images,position2d<s32>(0,0),rect<s32>(0,0,342,224),0,SColor(255,255,255,255),TRUE);
      // irrSceneMgr->drawAll();
      irrVideo->endScene();
      return TRUE;
 }
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

thanks for the fix! gonna try it now! :D
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

things got worse! :(

Code: Select all

CSplash.cpp(3) : error C2065: 'MY_BOOLFUNC_TYPE' : undeclared identifier
CSplash.cpp(3) : error C2501: 'BOOL' : missing storage-class or type specifiers
CSplash.cpp(3) : error C2143: syntax error : missing ';' before '('
CSplash.cpp(3) : error C2062: type 'void' unexpected
CSplash.cpp(3) : error C2059: syntax error : ')'
CSplash.cpp(6) : error C2146: syntax error : missing ';' before identifier 'mywind'
CSplash.cpp(6) : error C2501: 'TSplash::HWND' : missing storage-class or type specifiers
CSplash.cpp(6) : error C2501: 'TSplash::mywind' : missing storage-class or type specifiers
CSplash.cpp(7) : error C2146: syntax error : missing ';' before identifier 'oldStyle'
CSplash.cpp(7) : error C2501: 'TSplash::DWORD' : missing storage-class or type specifiers
CSplash.cpp(7) : error C2501: 'TSplash::oldStyle' : missing storage-class or type specifiers
CSplash.cpp(8) : error C2143: syntax error : missing ';' before '<'
CSplash.cpp(8) : error C2501: 'TSplash::dimension2d' : missing storage-class or type specifiers
CSplash.cpp(8) : error C2238: unexpected token(s) preceding ';'
CSplash.cpp(11) : error C2143: syntax error : missing ')' before '*'
CSplash.cpp(11) : error C2143: syntax error : missing ';' before '*'
CSplash.cpp(11) : error C2460: 'TSplash::IVideoDriver' : uses 'TSplash', which is being defined
        CSplash.cpp(5) : see declaration of 'TSplash'
CSplash.cpp(11) : error C2059: syntax error : ')'
CSplash.cpp(11) : error C2501: 'TSplash::ivd' : missing storage-class or type specifiers
CSplash.cpp(13) : error C2146: syntax error : missing ';' before identifier 'Dat'
CSplash.cpp(13) : error C2501: 'TSplash::SExposedVideoData' : missing storage-class or type specifiers
CSplash.cpp(13) : error C2065: 'ivd' : undeclared identifier
CSplash.cpp(13) : error C2227: left of '->getExposedVideoData' must point to class/struct/union
        type is ''unknown-type''
CSplash.cpp(13) : error C2864: 'Dat' : only const static integral data members can be initialized inside a class or struct
CSplash.cpp(13) : error C2501: 'TSplash::Dat' : missing storage-class or type specifiers
CSplash.cpp(14) : error C2065: 'HWND' : undeclared identifier
CSplash.cpp(14) : error C2864: 'mywind' : only const static integral data members can be initialized inside a class or struct
CSplash.cpp(14) : error C2501: 'TSplash::mywind' : missing storage-class or type specifiers
CSplash.cpp(14) : error C2146: syntax error : missing ';' before identifier 'Dat'
CSplash.cpp(14) : error C2143: syntax error : missing ';' before '.'
CSplash.cpp(14) : error C2501: 'TSplash::Dat' : missing storage-class or type specifiers
CSplash.cpp(14) : error C2238: unexpected token(s) preceding ';'
CSplash.cpp(15) : error C2065: 'mywind' : undeclared identifier
CSplash.cpp(15) : error C2065: 'GWL_STYLE' : undeclared identifier
CSplash.cpp(15) : error C3861: 'GetWindowLong': identifier not found, even with argument-dependent lookup
CSplash.cpp(15) : error C2864: 'oldStyle' : only const static integral data members can be initialized inside a class or struct
CSplash.cpp(15) : error C2501: 'TSplash::oldStyle' : missing storage-class or type specifiers
CSplash.cpp(16) : error C2061: syntax error : identifier 'mywind'
CSplash.cpp(16) : error C2059: syntax error : ')'
CSplash.cpp(16) : error C2143: syntax error : missing ')' before ';'
CSplash.cpp(16) : warning C4183: 'SetWindowLong': missing return type; assumed to be a member function returning 'int'
CSplash.cpp(17) : error C2227: left of '->getScreenSize' must point to class/struct/union
        type is ''unknown-type''
CSplash.cpp(17) : error C3861: 'ivd': identifier not found, even with argument-dependent lookup
CSplash.cpp(17) : error C2864: 'size' : only const static integral data members can be initialized inside a class or struct
CSplash.cpp(17) : error C2501: 'TSplash::size' : missing storage-class or type specifiers
CSplash.cpp(20) : error C2588: '::~TSplash' : illegal global destructor
CSplash.cpp(22) : error C3861: 'MY_BOOLFUNC_TYPE': identifier not found, even with argument-dependent lookup
CSplash.cpp(22) : error C2146: syntax error : missing ')' before identifier 'func'
CSplash.cpp(22) : error C2182: 'playSplash' : illegal use of type 'void'
CSplash.cpp(22) : error C2059: syntax error : ')'
CSplash.cpp(23) : error C2143: syntax error : missing ';' before '{'
CSplash.cpp(23) : error C2447: '{' : missing function header (old-style formal list?)
CSplash.cpp(43) : error C2059: syntax error : '}'
CSplash.cpp(43) : error C2143: syntax error : missing ';' before '}'
CSplash.cpp(43) : error C2059: syntax error : '}'
Process terminated with status 1 (0 minutes, 1 seconds)
54 errors, 1 warnings
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

i think that all those errors becouse of BOOL type.

any way did you include the windows header in the fornt of code as
shown in demo, if so it must have define the BOOL type in it's header

the same thing for HWND type and DWORD type

please if it still does not work,let me know.

it works very will with me.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

you mean this?

Code: Select all

#include <windows.h> 
sure I got it; I completely copy-pasted your code :D
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

yes i ment that.

but it is very strang, this code compile and run without any error with
Dev-C++.
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

i have posted a zip file that contain source code ,so could you download it
from

http://www.irrforge.org/index.php/Real_ ... h_Irrlicht
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

well, it's c++; it should compile with MSVC as well.

Thanks for the zip file; downloading and testing :wink:
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

still waiting for the results of yuor test!!!

and if it works ,what was the reasone?
Post Reply