SVP aider moi: Problem a l'intro

SVP aider moi: Problem a l'intro - C++ - Programmation

Marsh Posté le 02-01-2005 à 19:34:33    

Salut a tous
 
j'ai fais une simulation 3D d'un person qui se promaine ds un park mais depui que j'ai essayer de mettre un menu pour avoir une selection pou voir:
 
-comment jouer
-lancer une perti
-quiter
 
ma simulation ne marche plus
 
voici le code:
 

Code :
  1. // Include the directx 8 utility library:
  2. #include <dxu.h>
  3. #include <dxu3d.h>
  4. #include "D3dx8math.h"
  5. #include "Object3D.h"
  6. #include "SimpleObject3D.h"
  7. #include "GroundGrid.h"
  8. #include "OverlayGrid.h"
  9. #include "olliderClass.h"
  10. #include "Explosion.h"
  11. #include "Bullet.h"
  12. #include "resource.h"
  13. extern unsigned char OverlayMap[ARRAYSIZE][ARRAYSIZE];
  14. #define TITLE "SIMULATION: WALK THROUGH THE PARK"
  15. // some defines to use when changing camera view
  16. #define SHOULDER 0
  17. #define SIDE 1
  18. #define TOP 2
  19. #define INTRO 3
  20. #define HOW 4
  21. #define GAMEOVER 5
  22. #define SINGLE 6
  23. /*******************************************************************************************/
  24. #define ABOUT_BOX_INFORMATION "CMT 3311: COURSEWORK1 COPYRIGHT ALEXANDRE NALIN"
  25. #define ABOUT_BOX_INFORMATION1 "Main menu: S to start, Q to exit\nUse Key left to move left\nUse key right to move right"
  26. // Generated to handle Menu Actions:
  27. LRESULT WindowProcedure(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
  28. {
  29. // grap the message parameters stored in wParam:
  30. int loWord = LOWORD(wParam); // first 16 bits
  31. int hiWord = HIWORD(wParam); // last  16 bits
  32.     switch(msg)
  33.     {
  34.     case WM_COMMAND:  // This is a menu or button message
  35.     if ( loWord == ID_FILE_EXIT ) // exit menu item was selected
  36.     {
  37.      // Send a quit message which will destroy the application
  38.      DXUDestroyWindow();
  39.      return 0; // This declares that a message was processed
  40.     }
  41.     else if ( loWord == ID_MUSIC_SOUNDOFF )
  42.     {
  43.    DXUDeleteAllMusic();
  44.    return 0;
  45.     }
  46.   
  47.     else if ( loWord == ID_MUSIC_SFXOFF )
  48.     {
  49.    DXUDeleteAllSFX();
  50.    return 0;
  51.     }
  52.   
  53.     else if ( loWord == ID_HELP_ABOUT ) // about menu item was selected
  54.     {
  55.      // Display a Message Box identifiying the application  
  56.      MessageBox(hWnd,ABOUT_BOX_INFORMATION,"About",MB_ICONINFORMATION|MB_OK);
  57.      return 0; // This declares that a message was processed
  58.     }
  59.     else if ( loWord == ID_HOWTOPLAY )
  60.     {
  61.      // Display a Message Box identifiying the application  
  62.      MessageBox(hWnd,ABOUT_BOX_INFORMATION1,"About1",MB_ICONINFORMATION|MB_OK);
  63.      return 0; // This declares that a message was processed
  64.     }
  65.     }
  66.    // process any messages that we didn't take care of  
  67.    return (DefWindowProc(hWnd, msg, wParam, lParam));
  68. }
  69. /*****************************************************************************************/
  70. // Global Variables
  71. D3DXMATRIX   matWorld,matCamera,matProj,matCamera1;
  72. DXULIGHT     directLight,spotLight;
  73. // create an Object3D called car  
  74. Object3D car;
  75. // Create a grid for the ground
  76. GroundGrid groundgrid;
  77. // create a grid of overlay objects
  78. OverlayGrid overlayGrid;
  79. // create and instance of the collider class
  80. ColliderClass collider;
  81. // create an Object3D for an explosion
  82. Explosion explosion;
  83. // create an Object3D for a bullet
  84. Bullet bullet;
  85. DXUIMAGE imgLife; // Image to represent a life
  86. DXUSPRITE sprLife; // sprite datatype to show a life image on screen
  87. DXUIMAGE imgHow;
  88. DXUSPRITE sprHow;
  89. DXUIMAGE imgIntro;
  90. DXUSPRITE sprIntro;
  91. typedef struct
  92. {
  93. int x;
  94. }AMUSIC;
  95. AMUSIC m[9];
  96. DXUMIDIID m0,m1,m2,m3,m4,m5,m6,m7,m8,m9;
  97. DXUSFXID  SN1,SN2,SN3,SN4,SN5,SN6,SN7,SN8,SN9,SN10,SN11,SN12,SN13,SN14;
  98. int mode=INTRO;
  99. // a font for writing text on the screen
  100. DXUFONT dxuFont;
  101. //Function prototypes
  102. VOID LoadWorld();
  103. VOID UpdateWorld();
  104. VOID ReleaseWorld();
  105. // Initialise lighting
  106. VOID InitialiseLights()
  107. {
  108. // Turn lighting calculation on
  109. DXUEnableLighting(TRUE);
  110. // Create a directional light source
  111. DXUCreateDirectionalLight(&directLight,
  112.                      &D3DXVECTOR3(-1,-1,0.5),  // Direction Up Left
  113.                      &D3DXVECTOR3(1.0f,1.0f,1.0f)); // White Color Normalised
  114. // Associate light with D3D device
  115. DXUSetDeviceLight(&directLight);
  116. // Turn on this light source
  117. DXUEnableDeviceLight(&directLight,TRUE);
  118. // Set ambient light intensity for the world
  119. DXUSetWorldAmbientLight(RGB(64,64,64));//ambientIntensity
  120. }
  121. // the following are the vectors describing look at point
  122. // and the camera or eye position in space
  123. // they are defined globally so that they can be used by
  124. // individual classes for billboarding
  125. DXUVECTOR3D  vLookatPt,vEyePt;
  126. /***************************************** CAMERA SETTINGS *******************************/
  127. /******************************************* SHOULDER CAM ********************************/
  128. // This function sets the camera to be above and behind the car
  129. void SetShoulderCamera()
  130. {
  131. // distz specifies how far behind the camera should be
  132. // disty specifies how far above the camera should be
  133. float distz=50,disty=20;
  134. DXUMatrixLookAtRH(&matCamera1, &DXUVECTOR3D
  135.   (
  136.   // cameras world position is defined below as being
  137.   // distz and disty along the cars local z and y axes respectively
  138.   car.x-(car.matrix(2,0)*distz)+(car.matrix(1,0)*disty),
  139.   car.y-(car.matrix(2,1)*distz)+(car.matrix(1,1)*disty),
  140.   car.z-(car.matrix(2,2)*distz)+(car.matrix(1,2)*disty)
  141.   ),
  142.             &DXUVECTOR3D(car.x, car.y,car.z ), // look at point set to the car
  143.   // the direction up is set to the cars y axis direction  
  144.   &DXUVECTOR3D( car.matrix(1,0), car.matrix(1,1),car.matrix(1,2) ));
  145. // make matCamera camera the device camera:
  146. DXUSetDeviceCameraMatrix(&matCamera1);
  147. // global variable storing the look at point which set to the car
  148. vLookatPt.x=car.x; vLookatPt.y=car.y; vLookatPt.z=car.z;
  149. // global variable storing the position of the camera
  150. vEyePt.x= car.x-(car.matrix(2,0)*distz)+(car.matrix(1,0)*disty);
  151. vEyePt.y= car.y-(car.matrix(2,1)*distz)+(car.matrix(1,1)*disty);
  152. vEyePt.z= car.z-(car.matrix(2,2)*distz)+(car.matrix(1,2)*disty);
  153. }
  154. /******************************************* TOP CAM ************************************/
  155. // This function sets the camera to be very far above the car
  156. void SetTopCamera()
  157. {
  158. float disty=990,distx=100;
  159. DXUMatrixLookAtRH(&matCamera1, &DXUVECTOR3D
  160.   ( // cameras world position
  161.   car.x+(car.matrix(1,0)*disty),
  162.   car.y+(car.matrix(1,1)*disty),
  163.   car.z+(car.matrix(1,2)*disty)
  164.   ),
  165.             &DXUVECTOR3D(car.x, car.y,car.z ), // look at the car
  166.   // the direction up   
  167.   &DXUVECTOR3D( car.matrix(2,0), car.matrix(2,1),car.matrix(2,2) ));
  168. // make matCamera camera the device camera:
  169. DXUSetDeviceCameraMatrix(&matCamera1);
  170. vLookatPt.x=car.x; vLookatPt.y=car.y; vLookatPt.z=car.z;
  171. vEyePt.x= car.x-(car.matrix(2,0)*disty)+(car.matrix(1,0)*distx);
  172. vEyePt.y= car.y-(car.matrix(2,1)*disty)+(car.matrix(1,1)*distx);
  173. vEyePt.z= car.z-(car.matrix(2,2)*disty)+(car.matrix(1,2)*distx);
  174. }
  175. /******************************************* SIDE CAM ************************************/
  176. // this sets the camera to look at the car from above and to the side of the car
  177. void SetSideCamera()
  178. {
  179. float disty=50,distx=100;
  180. DXUMatrixLookAtRH(&matCamera1,&DXUVECTOR3D
  181.   ( // cameras world position
  182.   car.x+(car.matrix(0,0)*distx)+(car.matrix(1,0)*disty),
  183.   car.y+(car.matrix(0,1)*distx)+(car.matrix(1,1)*disty),
  184.   car.z+(car.matrix(0,2)*distx)+(car.matrix(1,2)*disty)
  185.   ),
  186.             &DXUVECTOR3D(car.x, car.y,car.z ), // look at the car
  187.   // the direction up   
  188.   &DXUVECTOR3D( car.matrix(1,0), car.matrix(1,1),car.matrix(1,2) ));
  189. // make matCamera camera the device camera:
  190. DXUSetDeviceCameraMatrix(&matCamera1);
  191. vLookatPt.x=car.x; vLookatPt.y=car.y; vLookatPt.z=car.z;
  192. vEyePt.x= car.x-(car.matrix(2,0)*disty)+(car.matrix(1,0)*distx);
  193. vEyePt.y= car.y-(car.matrix(2,1)*disty)+(car.matrix(1,1)*distx);
  194. vEyePt.z= car.z-(car.matrix(2,2)*disty)+(car.matrix(1,2)*distx);
  195. }
  196. /************************************ INITIALISE WORLD ************************************/
  197. // Initialise rendering states, and camera, projection and world matrices
  198. VOID Initialise3DWorld()
  199. {
  200.     // Enable Z-Buffering:
  201. DXUEnableZBuffering(TRUE);
  202. // Enable Writing to the Z-Buffer instead of the back buffer:
  203. DXUEnableZBufferWrite(TRUE);
  204. // set solid fill mode
  205. DXUSetFillMode(DXUFILL_SOLID);
  206. // set no culling modes
  207. DXUSetCullMode(DXUCULL_NONE);
  208. // We would normally set the camera up here but it is set in the
  209. // updateworld function in this program
  210. // initialise a perspective projection matrix:
  211. // at Field of view: 3.14/4 ( what a human can see )
  212. // aspect ratio same as screen ratio  
  213. // nearest visibility at 1.0
  214. // furthest  visibility at 1000.0*/
  215. DXUMatrixPerspectiveFovRH(&matProj,D3DX_PI/4,640.0f/480.f,1.0f,1000.0f);
  216. // set this projection matrix to be the worlds projection matrix
  217. DXUSetDeviceProjectionMatrix(&matProj);
  218. // initialise the world matrix to the identity matrix - no transformation
  219. DXUMatrixIdentity( &matWorld);
  220. // set the world matrix
  221. DXUSetDeviceWorldMatrix(&matWorld);
  222. }
  223. /**************************************** UPDATE WORLD ***********************************/
  224. // UpdateWorld reads keyboard input and transforms the car accordingly
  225. VOID UpdateWorld()
  226. {
  227. // int t = rand()%9;
  228. // DXUPlayMusic(m[t].x);
  229. D3DXMATRIX rot;
  230. // amount to increment rotation by
  231. float inc=3.0;
  232. static int r=1;
  233. int i,j;
  234. // camera is a staic variable which traks which of three possible
  235. // camera views the user has selected, default is the shoulder view
  236. static camera =SHOULDER;
  237. // FIRST OF ALL DEAL WITH KEYBOARD INPUT
  238. if( dxuKeyState[DIK_LEFT] )
  239. {// left arrow pressed
  240.  car.RotateY(inc);  // positive rotate around y axis
  241. }
  242. if( dxuKeyState[DIK_RIGHT])
  243. {// right arrow pressed
  244.  car.RotateY(-inc );  // negative rotate around y axis
  245. }
  246. if( dxuKeyState[DIK_UP] )
  247. {// up arrow pressed
  248.  car.RotateX(inc); // positive rotate around x axis
  249. }
  250. if( dxuKeyState[DIK_DOWN])
  251. {// down arrow pressed
  252.  car.RotateX(-inc);  // negative rotate around x axis
  253. }
  254. if( dxuKeyState[DIK_Z] )
  255. {// Z  pressed
  256.  car.RotateZ(inc);  // positive rotate around z axis
  257. }
  258. if( dxuKeyState[DIK_X])
  259. {// X  pressed
  260.  car.RotateZ(-inc);  // negative rotate around r axis
  261. }
  262. if( dxuKeyState[DIK_R])
  263. {// R  pressed
  264.  car.Reset();  // reset the car to the start position
  265.  car.LocalTranslation(0,5.9,20);
  266. }
  267. if( dxuKeyState[DIK_A])
  268. {// A  pressed,  
  269.  // move car forward
  270.  car.Advance();
  271.  // check for collision with overlay objects
  272.  for( i=0;i<ARRAYSIZE;i++)
  273.  {
  274.   for( j=0;j<ARRAYSIZE;j++)
  275.   {
  276.    // if the overlay map !=0 we need to check for collision
  277.    if (OverlayMap[i][j]!=0)
  278.    {
  279.     // call collision detection with threshold of 20
  280.     // ie: objects collide if dist between their
  281.     // centers is les than 20
  282.     if(collider.SimpleCollision(20,car.x,car.y,car.z,i*45,0,j*45))
  283.     {
  284.      // if the above test is true there is a collision
  285.      // in which case we reverse the car by one increment
  286.      // as we advanced the car by one increment before the collision test
  287.      // this has the net effect of making the car halt when
  288.      // it collides with a overlay object
  289.      car.Reverse();
  290.     }
  291.    }
  292.   }
  293.  }
  294. }
  295. if( dxuKeyState[DIK_S])
  296. {// S  pressed
  297.  car.Reverse();  // reverse the car
  298.  for( i=0;i<ARRAYSIZE;i++)
  299.  {
  300.   for( j=0;j<ARRAYSIZE;j++)
  301.   {
  302.    // if the overlay map !=0 we need to check for collision
  303.    if (OverlayMap[i][j]!=0)
  304.    {
  305.     // call collision detection with threshold of 20
  306.     // ie: objects collide if dist between their
  307.     // centers is les than 20
  308.     if(collider.SimpleCollision(20,car.x,car.y,car.z,i*45,0,j*45))
  309.     {
  310.      // if the above test is true there is a collision
  311.      // in which case we reverse the car by one increment
  312.      // as we advanced the car by one increment before the collision test
  313.      // this has the net effect of making the car halt when
  314.      // it collides with a overlay object
  315.      car.Advance();
  316.     }
  317.    }
  318.   }
  319.  }
  320. }
  321. if( dxuKeyState[DIK_SPACE])
  322. {// Space  pressed so we need to fire a bullet if we can
  323.  // first check that the bullet is not currently alive
  324.  // if it is currently alive the bullet cannot be fired  
  325.  if(!bullet.alive)
  326.   // fire the bullet from the car position
  327.   // and using the cars direction which is encoded in the cars rotmatrix
  328.   bullet.fire(car.rotMatrix,car.x,car.y,car.z);
  329. }
  330. // if f1 is pressed we will set camera to view from the side
  331. if(dxuKeyState[DIK_F1])
  332. {
  333.  camera=SIDE;
  334. }
  335. // if f2 is pressed we will set camera to view from the top
  336. if(dxuKeyState[DIK_F2])
  337. {
  338.  camera=TOP;
  339. }
  340. // if f3 is pressed we will set camera to view from the shoulder
  341. if(dxuKeyState[DIK_F3])
  342. {
  343.  camera=SHOULDER;
  344. }
  345. // NEXT DEAL WITH UPDATING GAME OBJECTS
  346. // If the bullet is currently alive it needs to be dealt with
  347. // ie: move it on a bit, and check whether it collides with anything
  348. // in the world overlay layer
  349. if(bullet.alive)
  350. {
  351.  // update moves the bullet on and kills it if it has gone too far
  352.  bullet.Update();
  353.  // transform applies the movement
  354.  bullet.Transform();
  355.  // do collision detection with all overlay world objects
  356.  for( i=0;i<ARRAYSIZE;i++)
  357.  {
  358.   for( j=0;j<ARRAYSIZE;j++)
  359.   {
  360.    // only need to do collision detect if there is an object
  361.    // at this position
  362.    if ((OverlayMap[i][j]!=0)&&(OverlayMap[i][j]!=6))
  363.    {
  364.     // collision detction treshold is set to 40
  365.     if(collider.SimpleCollision(40,bullet.x,bullet.y,bullet.z,i*45,6,j*45))
  366.     {
  367.      // if their is a collision we set the overlay map entry to 0
  368.      // this means the object wont be drawn anymore
  369.      OverlayMap[i][j]=0;
  370.      // we se bullet alive to false so the bullet wont be drawn
  371.      bullet.alive=false;
  372.      // set distanceTravelled to 0 ready for the next firing
  373.      bullet.distanceTravelled=0;
  374.      // start an explosion at the position of the bullet on  
  375.      // collision detection
  376.      explosion.StartExplosion(bullet.x,bullet.y,bullet.z);
  377.     }
  378.    }
  379.   }
  380.  }
  381. }
  382. // If the explosion is currently alive we need to update it
  383. if(explosion.alive)
  384.  explosion.Update();
  385. // We need to call tranform for the car to apply and transformation
  386. // that resulted from pushing keyboard buttons
  387. car.Transform();
  388. // FINALLY DEAL WITH THE CAMERA AND SET IT TO THE CHOSEN VIEW
  389. switch (camera)
  390. {
  391.  case 0:{
  392.   SetShoulderCamera();
  393.   break;
  394.  }
  395.  case 1:{
  396.   SetSideCamera();
  397.   break;
  398.  }
  399.  case 2:{
  400.   SetTopCamera();
  401.   break;
  402.  }
  403. }
  404. }
  405. /******************************************************************************************/
  406. int introScreen()
  407. {
  408. // DXURunMedia();
  409. int t = rand()%9;
  410. DXUPlayMusic(m[t].x);
  411. while (DXUProcessMessages()) // Process system Messages
  412. { // read key board  
  413.  DXUReadKeyboard();
  414.  // if Q is pressed return game over
  415.  if (dxuKeyState[DIK_Q] )
  416.   DXUDestroyWindow() ;
  417.  // if S is pressed return SINGLE player game
  418.  if (dxuKeyState[DIK_S])
  419.   return SINGLE;
  420.  if (dxuKeyState[DIK_H])
  421.   return HOW;
  422.  // Other wise draw the background  
  423.  DXURenderPrepare();
  424.  DXUDrawSpriteFast(&sprIntro);
  425.  DXURenderFinish();
  426. }
  427. // if there was error processing system messages return MESSAGEERROR
  428. return GAMEOVER;
  429. }
  430. /****** HOW TO ********** Display the instruction menu *****************************/
  431. int how()
  432. {
  433. double renderTime = 0;
  434. while (DXUProcessMessages()) // Process system Messages
  435. {
  436.  DXUReadKeyboard();
  437.  // if its time to render i.e. a 30th of a second  since last time
  438.  if (DXUIsTimeToRender() )
  439.   {
  440.    if ( dxuKeyState[DIK_ESCAPE] )
  441.    {
  442.     return INTRO;
  443.    }
  444.  renderTime += DXUGetSecsPerFrame();
  445.  DXURenderPrepare();
  446.  DXUDrawSpriteFast(&sprHow);
  447.  DXURenderFinish();
  448.   }
  449. }
  450. // if there was error processing system messages return MESSAGEERROR
  451. return GAMEOVER;
  452. }
  453. /******************************************* LOAD WORLD **********************************/
  454. // Load and initialise the 3D world
  455. VOID LoadWorld()
  456. {
  457. DXULoadImage(&imgLife,"life.bmp",DXUCKRGB(0,0,0));
  458. // initialise life sprite
  459. DXUSetSprite(&imgLife,&sprLife,32,45);
  460. DXULoadImage(&imgHow,"how.bmp",DXUCK_NOCOLOURKEY);
  461. DXUSetSprite(&imgHow,&sprHow,0,0);
  462. DXULoadImage(&imgIntro,"war1.bmp",DXUCK_NOCOLOURKEY);
  463. DXUSetSprite(&imgIntro,&sprIntro,0,0);
  464. car.LoadMesh("gun.x" ); // load the car mesh
  465. car.LocalTranslation(0,5.9,20); // move car onto ground plane
  466. explosion.LoadMesh("explode.x" ); // load the explosion mesh
  467. explosion.LocalTranslation(0,6,0); // move bullet onto ground plane
  468. bullet.LoadMesh("bullet2.x" );// load the bullet mesh
  469. bullet.LocalTranslation(0,6,0); // move bullet onto ground plane
  470. groundgrid.Initialise();
  471. overlayGrid.Initialise();
  472. DXULoadFont(&dxuFont,"Times new Roman",10,10); // load the font
  473. Initialise3DWorld();  // Initialise the world
  474. InitialiseLights();   // initialise lighting  
  475. }
  476. /************************************** RELEASE *************************************/
  477. // Release resources
  478. VOID ReleaseWorld()
  479. {
  480.  DXUReleaseFont(&dxuFont);
  481. car.Release();
  482. explosion.Release();
  483. bullet.Release();
  484. groundgrid.Release();
  485. overlayGrid.Release();
  486. }
  487. /************************************** RENDER ***************************************/
  488. // Render the world
  489. VOID RenderWorld()
  490. {
  491. TCHAR str[100];
  492. DXURenderPrepare();    // get ready to render  
  493.  // render al objects thats needs to be drawn
  494. //  int t = rand()%9;
  495. //  DXUPlayMusic(m[t].x);
  496.  if(bullet.alive)bullet.Render();
  497.  car.Render();
  498.  groundgrid.Render();
  499.  overlayGrid.Render();
  500.  if(explosion.alive)explosion.Render();
  501.  // get string ready to print frame rate on the screen
  502.  wsprintf(str,"Rendering %d fps",DXUGetFramesPerSecondpp());
  503.  // draw the string to the screen
  504.  DXUDrawTextFast(&dxuFont,str,0,0,DXURGB(0,255,0));
  505.  // Draw the only sprite used on the screen
  506.  DXUDrawSprite(&sprLife);
  507. DXURenderFinish();  // finish rendering
  508. }
  509. /************************************* MAIN LOOP ***************************************/
  510. // Main:
  511. int APIENTRY WinMain(HINSTANCE hinstance,
  512.                      HINSTANCE hPreInstance,
  513.                      LPSTR lpCmdLine,int nCmdShow)
  514. {   
  515. // Load the Direct3D COM and Build the current system device list:
  516. if ( !DXULoadDirectXGraphics() )
  517. {
  518.  DXUDisplayLastError();
  519.  return -1;
  520. }
  521. // Set Window Title Name and window name
  522. DXUSetWindowInfo(TITLE,"trans",NULL,NULL);
  523. // Create a WIN32 window:
  524. if(!DXUCreateWindow(hinstance,0,0,640+6,480+26))
  525. {
  526.    DXUDisplayLastError();
  527.    return -1;
  528. }
  529.     // Initialise Windowed Graphics:
  530. if (!DXUInitGraphics())
  531. {
  532.     DXUDisplayLastError();
  533.  return -1;
  534. }
  535. DXUInitSoundSystem();
  536. DXUInitMusicSystem();
  537. // int t = rand()%9;
  538. // DXUPlayMusic(m[t].x);
  539. m[0].x = DXULoadMusic("mid0.mid" );
  540. m[1].x = DXULoadMusic("mid1.mid" );
  541. m[2].x = DXULoadMusic("mid2.mid" );
  542. m[3].x = DXULoadMusic("mid3.mid" );
  543. m[4].x = DXULoadMusic("mid4.mid" );
  544. m[5].x = DXULoadMusic("mid5.mid" );
  545. m[6].x = DXULoadMusic("mid6.mid" );
  546. m[7].x = DXULoadMusic("mid7.mid" );
  547. m[8].x = DXULoadMusic("mid8.mid" );
  548. // LoadWorld();  // load and initialise 3D world
  549. DXUInitInput();  // initialise DirectInput
  550. DXUInitKeyboard(); // initialise keyboard input
  551. DXUEnableAlphaBlending(true);
  552. // Main game loop:
  553. /* while (DXUProcessMessages()) // Process The system Messages
  554. {
  555.  DXUReadKeyboard();  // read the keyboard
  556.  if (DXUIsTimeToRender() ) // if its time to render
  557.  {
  558.   LoadWorld();  // load and initialise 3D world
  559.   UpdateWorld();   // update the world objects
  560.      RenderWorld();   // render the world
  561.  }
  562. }
  563. */
  564. /************************************* GAME LOOP *****************************************/
  565. while(mode!=GAMEOVER)
  566. {
  567.  // introduction
  568.  if(mode==INTRO){mode=introScreen();}
  569.  if(mode==HOW){mode=how();}
  570.  // start the single player game from first level
  571.  if(mode==SINGLE)
  572.  {
  573.   LoadWorld();  // load and initialise 3D world
  574.   UpdateWorld();  // update the world objects
  575.      RenderWorld();  // render the world
  576.  }
  577. }
  578. /********************************************************************************************/
  579. // Do not forget to release everything:
  580. DXUReleaseSprite(&sprLife);
  581. DXUReleaseImage(&imgLife);
  582. DXUDeleteAllSFX();
  583. DXUDeleteAllMusic();
  584. DXUCloseSoundSystem();
  585. DXUCloseMusicSystem();
  586. ReleaseWorld();
  587. DXUReleaseKeyboard();
  588.     DXUCloseInput();
  589. DXUReleaseGraphics();
  590.     DXUUnloadDirectXGraphics();
  591. return DXUGetLastMessage()->wParam;
  592. }
  593. /**************************************** END OF GAME *************************************/


Message édité par nimo le 02-01-2005 à 19:37:21

---------------
NEC 3500 | YAMADA 6600 | NIMO_CORP
Reply

Marsh Posté le 02-01-2005 à 19:34:33   

Reply

Marsh Posté le 02-01-2005 à 19:39:26    

please i need your help
 
quand je lance le jeu, il joue le sont mais rien ne s'affiche a l'ecran, et apres il me donne une error comme quoi je doit fermer le program.
 
je croix que le problem vien de la loop pour lancer le jeux?
 
merci d'avance


---------------
NEC 3500 | YAMADA 6600 | NIMO_CORP
Reply

Marsh Posté le 02-01-2005 à 20:17:10    

nimo a écrit :

Salut a tous
 
j'ai fais une simulation 3D d'un person qui se promaine ds un park mais depui que j'ai essayer de mettre un menu pour avoir une selection pou voir:
 
-comment jouer
-lancer une perti
-quiter
 
ma simulation ne marche plus


 

nimo a écrit :

please i need your help
 
quand je lance le jeu, il joue le sont mais rien ne s'affiche a l'ecran, et apres il me donne une error comme quoi je doit fermer le program.
 
je croix que le problem vien de la loop pour lancer le jeux?
merci d'avance


putain, mais tu peux pas faire un effort sur l'orthographe ? c'est imbuvable, franchement !!
pour ce qui est de ton problème, il existe des outils bien pratiques nommés debuggers, qui te permettent de résoudre ce genre de problème très facilement


Message édité par Harkonnen le 02-01-2005 à 20:17:31

---------------
J'ai un string dans l'array (Paris Hilton)
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed