Real time splash window

A forum to store posts deemed exceptionally wise and useful
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

sorry Emil for not posting earlier. I downloaded your zip file and started a new project. Compiled and:

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(7) : error C2146: syntax error : missing ';' before identifier 'mywind'
CSplash.cpp(7) : error C2501: 'TSplash::HWND' : missing storage-class or type specifiers
CSplash.cpp(7) : error C2501: 'TSplash::mywind' : missing storage-class or type specifiers
CSplash.cpp(8) : error C2146: syntax error : missing ';' before identifier 'oldStyle'
CSplash.cpp(8) : error C2501: 'TSplash::DWORD' : missing storage-class or type specifiers
CSplash.cpp(8) : error C2501: 'TSplash::oldStyle' : missing storage-class or type specifiers
CSplash.cpp(9) : error C2143: syntax error : missing ';' before '<'
CSplash.cpp(9) : error C2501: 'TSplash::dimension2d' : missing storage-class or type specifiers
CSplash.cpp(9) : error C2238: unexpected token(s) preceding ';'
CSplash.cpp(12) : error C2143: syntax error : missing ')' before '*'
CSplash.cpp(12) : error C2143: syntax error : missing ';' before '*'
CSplash.cpp(12) : error C2460: 'TSplash::IVideoDriver' : uses 'TSplash', which is being defined
        CSplash.cpp(6) : see declaration of 'TSplash'
CSplash.cpp(12) : error C2059: syntax error : ')'
CSplash.cpp(12) : error C2501: 'TSplash::ivd' : missing storage-class or type specifiers
CSplash.cpp(14) : error C2146: syntax error : missing ';' before identifier 'Dat'
CSplash.cpp(14) : error C2501: 'TSplash::SExposedVideoData' : missing storage-class or type specifiers
CSplash.cpp(14) : error C2065: 'ivd' : undeclared identifier
CSplash.cpp(14) : error C2227: left of '->getExposedVideoData' must point to class/struct/union
        type is ''unknown-type''
CSplash.cpp(14) : error C2864: 'Dat' : only const static integral data members can be initialized inside a class or struct
CSplash.cpp(14) : error C2501: 'TSplash::Dat' : missing storage-class or type specifiers
CSplash.cpp(15) : error C2065: 'HWND' : undeclared identifier
CSplash.cpp(15) : error C2864: 'mywind' : only const static integral data members can be initialized inside a class or struct
CSplash.cpp(15) : error C2501: 'TSplash::mywind' : missing storage-class or type specifiers
CSplash.cpp(15) : error C2146: syntax error : missing ';' before identifier 'Dat'
CSplash.cpp(15) : error C2143: syntax error : missing ';' before '.'
CSplash.cpp(15) : error C2501: 'TSplash::Dat' : missing storage-class or type specifiers
CSplash.cpp(15) : error C2238: unexpected token(s) preceding ';'
CSplash.cpp(16) : error C2065: 'mywind' : undeclared identifier
CSplash.cpp(16) : error C2065: 'GWL_STYLE' : undeclared identifier
CSplash.cpp(16) : error C3861: 'GetWindowLong': identifier not found, even with argument-dependent lookup
CSplash.cpp(16) : error C2864: 'oldStyle' : only const static integral data members can be initialized inside a class or struct
CSplash.cpp(16) : error C2501: 'TSplash::oldStyle' : missing storage-class or type specifiers
CSplash.cpp(17) : error C2061: syntax error : identifier 'mywind'
CSplash.cpp(17) : error C2059: syntax error : ')'
CSplash.cpp(17) : error C2143: syntax error : missing ')' before ';'
CSplash.cpp(17) : warning C4183: 'SetWindowLong': missing return type; assumed to be a member function returning 'int'
CSplash.cpp(18) : error C2227: left of '->getScreenSize' must point to class/struct/union
        type is ''unknown-type''
CSplash.cpp(18) : error C3861: 'ivd': identifier not found, even with argument-dependent lookup
CSplash.cpp(18) : error C2864: 'size' : only const static integral data members can be initialized inside a class or struct
CSplash.cpp(18) : error C2501: 'TSplash::size' : missing storage-class or type specifiers
CSplash.cpp(21) : error C2588: '::~TSplash' : illegal global destructor
CSplash.cpp(23) : error C3861: 'MY_BOOLFUNC_TYPE': identifier not found, even with argument-dependent lookup
CSplash.cpp(23) : error C2146: syntax error : missing ')' before identifier 'func'
CSplash.cpp(23) : error C2182: 'playSplash' : illegal use of type 'void'
CSplash.cpp(23) : error C2059: syntax error : ')'
CSplash.cpp(24) : error C2143: syntax error : missing ';' before '{'
CSplash.cpp(24) : error C2447: '{' : missing function header (old-style formal list?)
CSplash.cpp(44) : error C2059: syntax error : '}'
CSplash.cpp(44) : error C2143: syntax error : missing ';' before '}'
CSplash.cpp(44) : error C2059: syntax error : '}'
Process terminated with status 1 (0 minutes, 1 seconds)
so, so far I haven't been able to see your marvelous splash screen working :(

Perhaps I'll try instaling devc++ this afternoon.
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

really very strange things,

please does any one else have the same error when compiling with
Dev-C++.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

MSVC 6.0 try:

Code: Select all

c:\irrlicht\my_projects\splash\csplash.cpp(25) : warning C4554: '&' : check operator precedence for possible error; use parentheses to clarify precedence
c:\irrlicht\my_projects\splash\csplash.cpp(34) : warning C4554: '&' : check operator precedence for possible error; use parentheses to clarify precedence
CSplash.cpp
c:\irrlicht\my_projects\splash\csplash.cpp(3) : error C2065: 'MY_BOOLFUNC_TYPE' : undeclared identifier
c:\irrlicht\my_projects\splash\csplash.cpp(3) : error C2100: illegal indirection
c:\irrlicht\my_projects\splash\csplash.cpp(3) : error C2501: 'BOOL' : missing storage-class or type specifiers
c:\irrlicht\my_projects\splash\csplash.cpp(3) : error C2143: syntax error : missing ';' before '('
c:\irrlicht\my_projects\splash\csplash.cpp(3) : error C2062: type 'void' unexpected
c:\irrlicht\my_projects\splash\csplash.cpp(3) : error C2059: syntax error : ')'
c:\irrlicht\my_projects\splash\csplash.cpp(7) : error C2146: syntax error : missing ';' before identifier 'mywind'
c:\irrlicht\my_projects\splash\csplash.cpp(7) : error C2501: 'HWND' : missing storage-class or type specifiers
c:\irrlicht\my_projects\splash\csplash.cpp(7) : error C2501: 'mywind' : missing storage-class or type specifiers
c:\irrlicht\my_projects\splash\csplash.cpp(8) : error C2146: syntax error : missing ';' before identifier 'oldStyle'
c:\irrlicht\my_projects\splash\csplash.cpp(8) : error C2501: 'DWORD' : missing storage-class or type specifiers
c:\irrlicht\my_projects\splash\csplash.cpp(8) : error C2501: 'oldStyle' : missing storage-class or type specifiers
c:\irrlicht\my_projects\splash\csplash.cpp(9) : error C2143: syntax error : missing ';' before '<'
c:\irrlicht\my_projects\splash\csplash.cpp(9) : error C2501: 'dimension2d' : missing storage-class or type specifiers
c:\irrlicht\my_projects\splash\csplash.cpp(9) : error C2059: syntax error : '<'
c:\irrlicht\my_projects\splash\csplash.cpp(9) : error C2238: unexpected token(s) preceding ';'
c:\irrlicht\my_projects\splash\csplash.cpp(12) : error C2629: unexpected 'class TSplash ('
c:\irrlicht\my_projects\splash\csplash.cpp(12) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
c:\irrlicht\my_projects\splash\csplash.cpp(23) : error C2061: syntax error : identifier 'MY_BOOLFUNC_TYPE'
Error executing cl.exe.

splash.exe - 19 error(s), 2 warning(s)
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

MS Visual Studio .NET 2003 Try:

Code: Select all

Compiling...
CSplash.cpp
\Irrlicht\My_projects\splash\CSplash.cpp(3) : error C2065: 'MY_BOOLFUNC_TYPE' : undeclared identifier
\Irrlicht\My_projects\splash\CSplash.cpp(3) : error C2501: 'BOOL' : missing storage-class or type specifiers
\Irrlicht\My_projects\splash\CSplash.cpp(3) : error C2143: syntax error : missing ';' before '('
\Irrlicht\My_projects\splash\CSplash.cpp(3) : error C2062: type 'void' unexpected
\Irrlicht\My_projects\splash\CSplash.cpp(3) : error C2059: syntax error : ')'
\Irrlicht\My_projects\splash\CSplash.cpp(7) : error C2146: syntax error : missing ';' before identifier 'mywind'
\Irrlicht\My_projects\splash\CSplash.cpp(7) : error C2501: 'TSplash::HWND' : missing storage-class or type specifiers
\Irrlicht\My_projects\splash\CSplash.cpp(7) : error C2501: 'TSplash::mywind' : missing storage-class or type specifiers
\Irrlicht\My_projects\splash\CSplash.cpp(8) : error C2146: syntax error : missing ';' before identifier 'oldStyle'
\Irrlicht\My_projects\splash\CSplash.cpp(8) : error C2501: 'TSplash::DWORD' : missing storage-class or type specifiers
\Irrlicht\My_projects\splash\CSplash.cpp(8) : error C2501: 'TSplash::oldStyle' : missing storage-class or type specifiers
\Irrlicht\My_projects\splash\CSplash.cpp(9) : error C2143: syntax error : missing ';' before '<'
\Irrlicht\My_projects\splash\CSplash.cpp(9) : error C2501: 'TSplash::dimension2d' : missing storage-class or type specifiers
\Irrlicht\My_projects\splash\CSplash.cpp(9) : error C2238: unexpected token(s) preceding ';'
\Irrlicht\My_projects\splash\CSplash.cpp(12) : error C2143: syntax error : missing ')' before '*'
\Irrlicht\My_projects\splash\CSplash.cpp(12) : error C2143: syntax error : missing ';' before '*'
\Irrlicht\My_projects\splash\CSplash.cpp(12) : error C2460: 'TSplash::IVideoDriver' : uses 'TSplash', which is being defined
        \Irrlicht\My_projects\splash\CSplash.cpp(6) : see declaration of 'TSplash'
\Irrlicht\My_projects\splash\CSplash.cpp(12) : error C2059: syntax error : ')'
\Irrlicht\My_projects\splash\CSplash.cpp(12) : error C2501: 'TSplash::ivd' : missing storage-class or type specifiers
\Irrlicht\My_projects\splash\CSplash.cpp(14) : error C2146: syntax error : missing ';' before identifier 'Dat'
\Irrlicht\My_projects\splash\CSplash.cpp(14) : error C2501: 'TSplash::SExposedVideoData' : missing storage-class or type specifiers
\Irrlicht\My_projects\splash\CSplash.cpp(14) : error C2065: 'ivd' : undeclared identifier
\Irrlicht\My_projects\splash\CSplash.cpp(14) : error C2227: left of '->getExposedVideoData' must point to class/struct/union
        type is ''unknown-type''
\Irrlicht\My_projects\splash\CSplash.cpp(14) : error C2864: 'Dat' : only const static integral data members can be initialized inside a class or struct
\Irrlicht\My_projects\splash\CSplash.cpp(14) : error C2501: 'TSplash::Dat' : missing storage-class or type specifiers
\Irrlicht\My_projects\splash\CSplash.cpp(15) : error C2065: 'HWND' : undeclared identifier
\Irrlicht\My_projects\splash\CSplash.cpp(15) : error C2864: 'mywind' : only const static integral data members can be initialized inside a class or struct
\Irrlicht\My_projects\splash\CSplash.cpp(15) : error C2501: 'TSplash::mywind' : missing storage-class or type specifiers
\Irrlicht\My_projects\splash\CSplash.cpp(15) : error C2146: syntax error : missing ';' before identifier 'Dat'
\Irrlicht\My_projects\splash\CSplash.cpp(15) : error C2143: syntax error : missing ';' before '.'
\Irrlicht\My_projects\splash\CSplash.cpp(15) : error C2501: 'TSplash::Dat' : missing storage-class or type specifiers
\Irrlicht\My_projects\splash\CSplash.cpp(15) : error C2238: unexpected token(s) preceding ';'
\Irrlicht\My_projects\splash\CSplash.cpp(16) : error C2065: 'mywind' : undeclared identifier
\Irrlicht\My_projects\splash\CSplash.cpp(16) : error C2065: 'GWL_STYLE' : undeclared identifier
\Irrlicht\My_projects\splash\CSplash.cpp(16) : error C3861: 'GetWindowLong': identifier not found, even with argument-dependent lookup
\Irrlicht\My_projects\splash\CSplash.cpp(16) : error C2864: 'oldStyle' : only const static integral data members can be initialized inside a class or struct
\Irrlicht\My_projects\splash\CSplash.cpp(16) : error C2501: 'TSplash::oldStyle' : missing storage-class or type specifiers
\Irrlicht\My_projects\splash\CSplash.cpp(17) : error C2061: syntax error : identifier 'mywind'
\Irrlicht\My_projects\splash\CSplash.cpp(17) : error C2059: syntax error : ')'
\Irrlicht\My_projects\splash\CSplash.cpp(17) : error C2143: syntax error : missing ')' before ';'
\Irrlicht\My_projects\splash\CSplash.cpp(17) : warning C4183: 'SetWindowLong': missing return type; assumed to be a member function returning 'int'
\Irrlicht\My_projects\splash\CSplash.cpp(18) : error C2227: left of '->getScreenSize' must point to class/struct/union
        type is ''unknown-type''
\Irrlicht\My_projects\splash\CSplash.cpp(18) : error C3861: 'ivd': identifier not found, even with argument-dependent lookup
\Irrlicht\My_projects\splash\CSplash.cpp(18) : error C2864: 'size' : only const static integral data members can be initialized inside a class or struct
\Irrlicht\My_projects\splash\CSplash.cpp(18) : error C2501: 'TSplash::size' : missing storage-class or type specifiers
\Irrlicht\My_projects\splash\CSplash.cpp(21) : error C2588: '::~TSplash' : illegal global destructor
\Irrlicht\My_projects\splash\CSplash.cpp(23) : error C3861: 'MY_BOOLFUNC_TYPE': identifier not found, even with argument-dependent lookup
\Irrlicht\My_projects\splash\CSplash.cpp(23) : error C2146: syntax error : missing ')' before identifier 'func'
\Irrlicht\My_projects\splash\CSplash.cpp(23) : error C2182: 'playSplash' : illegal use of type 'void'
\Irrlicht\My_projects\splash\CSplash.cpp(23) : error C2059: syntax error : ')'
\Irrlicht\My_projects\splash\CSplash.cpp(24) : error C2143: syntax error : missing ';' before '{'
\Irrlicht\My_projects\splash\CSplash.cpp(24) : error C2447: '{' : missing function header (old-style formal list?)
\Irrlicht\My_projects\splash\CSplash.cpp(44) : error C2059: syntax error : '}'
\Irrlicht\My_projects\splash\CSplash.cpp(44) : error C2143: syntax error : missing ';' before '}'
\Irrlicht\My_projects\splash\CSplash.cpp(44) : error C2059: syntax error : '}'
main.cpp
c:\Irrlicht\My_projects\splash\CSplash.cpp(25) : warning C4554: '&' : check operator precedence for possible error; use parentheses to clarify precedence
c:\Irrlicht\My_projects\splash\CSplash.cpp(34) : warning C4554: '&' : check operator precedence for possible error; use parentheses to clarify precedence
Generating Code...

Build log was saved at "file://c:\Irrlicht\My_projects\splash\Splash\Debug\BuildLog.htm"
Splash - 54 error(s), 3 warning(s)
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

this drives me crazy.

i have tested it with VC Tool Kit 2003 and works very well .
i tested it with irrlicht 0.10 ver.

if you want i could post the exe file to you.

Code: Select all


// CSplash.cpp file
typedef BOOL (*MY_BOOLFUNC_TYPE) (void);
class TSplash
 {
     HWND  mywind;
     DWORD oldStyle;
     dimension2d<s32> size;
     
     public:
       TSplash(IVideoDriver* ivd)
        {
           SExposedVideoData Dat = ivd->getExposedVideoData();
           mywind = (HWND)Dat.D3D9.HWnd;
           oldStyle = GetWindowLong(mywind,GWL_STYLE);
           SetWindowLong(mywind,GWL_STYLE,(oldStyle&(~WS_CAPTION))|WS_POPUP);
           size = ivd->getScreenSize();  
        }
        
       ~TSplash() {} 
       
       void playSplash(MY_BOOLFUNC_TYPE func,u32 duration,s32 width = 0 ,s32 height = 0)
        {
            if (width > 0 & height > 0)
             {
                 s32 x = (GetSystemMetrics(SM_CXSCREEN)-width)>>1;
                 s32 y = (GetSystemMetrics(SM_CYSCREEN)-height)>>1;
                 SetWindowPos(mywind,NULL,x,y,width,height,SWP_NOZORDER|SWP_FRAMECHANGED);
             }     
            u32 tick  = GetTickCount();
            u32 ticks = tick + duration;
            BOOL Flag = TRUE;
            while(ticks>tick & Flag )
             {
                Flag = func(); 
                tick = GetTickCount();
             }
            SetWindowLong(mywind,GWL_STYLE,oldStyle); 
            s32 xx = (GetSystemMetrics(SM_CXSCREEN)-size.Width)>>1;
            s32 yy = (GetSystemMetrics(SM_CYSCREEN)-size.Height)>>1;  
            SetWindowPos(mywind,NULL,xx,yy,size.Width,size.Height,SWP_NOZORDER|SWP_FRAMECHANGED);
        }   
  };     

-----------------------------------------------------------
// Splash window tested with VCTOOLKIT2003

#include <windows.h>    

#include "irrlicht.h"
// Irrlicht Namespaces
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

#include "CSplash.cpp"

#pragma comment(lib,"irrlicht.lib")
#pragma comment(lib,"user32.lib")

static IrrlichtDevice *irrDevice;
static IVideoDriver *irrVideo;
static ISceneManager *irrSceneMgr;
static ITexture *images;
static IAnimatedMesh *mesh;
static IAnimatedMeshSceneNode *node;
static TSplash *splah;

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));
mesh=irrSceneMgr->getMesh("../../media/sydney.md2");
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));
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,200,0,0));
  irrVideo->draw2DImage(images,position2d<s32>(0,0),rect<s32>(0,0,342,224),0,SColor(255,255,255,255),TRUE);
  irrVideo->endScene();
  return TRUE;
}


afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

then it's even weirder cause I also always use the VC toolkit 2003 with codeblocks as IDE.

which include/lib folders do you use?
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

i am using it with Platform SDK include files

see it here

http://sdks.icarusindie.com:2004/index. ... include%2F
OpenSource

Post by OpenSource »

#include <windows.h>
#include <irrlicht.h>
#include "irrlicht.h"

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

// CSplash.cpp file
typedef BOOL (*MY_BOOLFUNC_TYPE) (void);
class TSplash
{

add this piece of code with the splash.cpp
it will help u
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

this is the first lines of demo

Code: Select all

// Splash window tested with VCTOOLKIT2003 

#include <windows.h>    

#include "irrlicht.h" 
// Irrlicht Namespaces 
using namespace irr; 
using namespace core; 
using namespace scene; 
using namespace video; 
using namespace io; 
using namespace gui; 

#include "CSplash.cpp" 

#pragma comment(lib,"irrlicht.lib") 

so you can see that CSplash.cpp was includeing after includeing windows.h
and irrlich.h and using namespaces,so why i must do that again in
the CSplash.cpp file, what is the point here ?
Guest

Post by Guest »

I'm using Dev C++ and the lastest version of Irrlicht

I downloaded the zip file and created a new project

the following are the errors I get

Code: Select all

2 F:\CSplash.cpp ISO C++ forbids declaration of `BOOL' with no type
2 F:\CSplash.cpp typedef `BOOL' is initialized (use __typeof__ instead) 
2 F:\CSplash.cpp `MY_BOOLFUNC_TYPE' was not declared in this scope 
2 F:\CSplash.cpp expected `,' or `;' before '(' token 
6 F:\CSplash.cpp `HWND' does not name a type
7 F:\CSplash.cpp `DWORD' does not name a type 
8 F:\CSplash.cpp ISO C++ forbids declaration of `dimension2d' with no type 
8 F:\CSplash.cpp expected `;' before '<' token 
11 F:\CSplash.cpp expected `)' before '*' token 
22 F:\CSplash.cpp variable or field `playSplash' declared void 
22 F:\CSplash.cpp expected `;' before '(' token 
43 F:\CSplash.cpp expected `;' before '}' token 
F:\splash\Makefile.win [Build Error]  [../CSplash.o] Error 1
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

are you sure that ,you include windows.h with your code,because those
errors means that the compiler did not recognize the BOOL and HWND
types and they are defining in windows.h header.

hope this will solve your problem
Guest

Post by Guest »

Emil_halim wrote:are you sure that ,you include windows.h with your code,because those
errors means that the compiler did not recognize the BOOL and HWND
types and they are defining in windows.h header.

hope this will solve your problem
Yes I have

Code: Select all

 #include <windows.h> 
OpenSource

I have Compiled and Run this code

Post by OpenSource »

this code is working on my PC

/****************************************************************************************************/
// CSplash.cpp
/****************************************************************************************************/
#include <windows.h>
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

typedef BOOL (*MY_BOOLFUNC_TYPE) (void);

class TSplash
{
HWND mywind;
DWORD oldStyle;
dimension2d<s32> size;

public:
TSplash(IVideoDriver* ivd)
{
SExposedVideoData Dat = ivd->getExposedVideoData();
mywind = (HWND)Dat.D3D9.HWnd;
oldStyle = GetWindowLong(mywind,GWL_STYLE);
SetWindowLong(mywind,GWL_STYLE,(oldStyle&(~WS_CAPTION))|WS_POPUP);
size = ivd->getScreenSize();
}

~TSplash() {}

void playSplash(MY_BOOLFUNC_TYPE func,u32 duration,s32 width = 0 ,s32 height = 0)
{
if (width > 0 & height > 0)
{
s32 x = (GetSystemMetrics(SM_CXSCREEN)-width)>>1;
s32 y = (GetSystemMetrics(SM_CYSCREEN)-height)>>1;
SetWindowPos(mywind,NULL,x,y,width,height,SWP_NOZORDER|SWP_FRAMECHANGED);
}
u32 tick = GetTickCount();
u32 ticks = tick + duration;
BOOL Flag = TRUE;
while(ticks>tick & Flag )
{
Flag = func();
tick = GetTickCount();
}
SetWindowLong(mywind,GWL_STYLE,oldStyle);
s32 xx = (GetSystemMetrics(SM_CXSCREEN)-size.Width)>>1;
s32 yy = (GetSystemMetrics(SM_CYSCREEN)-size.Height)>>1;
SetWindowPos(mywind,NULL,xx,yy,size.Width,size.Height,SWP_NOZORDER|SWP_FRAMECHANGED);
}
};



/****************************************************************************************************/
// main.cpp
/****************************************************************************************************/
#include "CSplash.cpp"

#pragma comment(lib, "Irrlicht.lib")

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,200,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;
}
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

@OpenSource

thanks for your post,but it drive me crazy,is that means include directive
did not actually insert the code in the main code!!!!!!!!

@Guest

does the OpenSource's solution work with you ?
OpenSource

Post by OpenSource »

Dude that is an amazing work u have done...

Dude in my opinion, the compiler first checks all the local header files then the global header files. it worked on ur PC coz u have included the irrlict.h that is local header in ur PC(so it will compile irrlicht first). but when i tried to compile it it was giving me the same errors that people are getting on others PC(reason other guyz including me have global irrlicht header file so it will compile CSplash first)

It is ma opinion but i m not sure.

But great work...
Post Reply