Video Setting Problem
Hi. WHenever I make a program with the same res and color-setting as my desktop(using either DirectDraw 7 or Direct3D 8), The program won''t work when I run it. It''ll display all the graphics I tell it too, but the mouse cursor will change according to my VC++ IDE. When I click, my program just disappears (it''s still being run by the task manager.) Does anyone have any idea what my problem could be?
-Forcas
"Elvis is alive. He is Barney the purple dinosaur. He is the pied piper that leads our children into the wages of sin and eternal damnation."
BOOL InitGraphics(){ //~~ Create Almighty IDirect3D8 Object ~~\\ if(FAILED(lpd3d = Direct3DCreate8(D3D_SDK_VERSION))) Game = 0; // Snatch coder-defined video mode. D3DDISPLAYMODE displayMode; displayMode.Width=WINDOW_WIDTH; // Set the screen width to the window width displayMode.Height=WINDOW_HEIGHT; // Set the screen height to the window height displayMode.RefreshRate=0; // Set the refresh rate to default displayMode.Format=WINDOW_FORMAT; // Set the color format to pixel format // Set the present parameters! JUICY! D3DPRESENT_PARAMETERS d3dpp; ZeroMemory( &d3dpp, sizeof(d3dpp) ); d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferFormat = displayMode.Format; // The color format d3dpp.BackBufferWidth = displayMode.Width; // The back buffer width d3dpp.BackBufferHeight = displayMode.Height; // The back buffer height // Prepare for lift off! OH HEA'' YEAH!!!! if(FAILED(lpd3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &lp3dd))) { MessageBox(hwnd, "Couldn''t Create Device", "ashfasf", MB_OK); return 0; } D3DXMATRIX Ortho2D; D3DXMATRIX Identity; D3DXMatrixOrthoLH(&Ortho2D, (float)WINDOW_WIDTH, (float)WINDOW_HEIGHT, 0.0f, 1.0f); D3DXMatrixIdentity(&Identity); lp3dd->SetTransform(D3DTS_PROJECTION, &Ortho2D); lp3dd->SetTransform(D3DTS_WORLD, &Identity); lp3dd->SetTransform(D3DTS_VIEW, &Identity); // Make it so that it''ll draw triangles facing either towards or away from the camera lp3dd->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE ); // Turn off Direct3D''s lighting since we use our own vertex color. lp3dd->SetRenderState( D3DRS_LIGHTING, FALSE ); HFONT MyFont = CreateFont( 10, // logical height of font 10, // logical average character width 0, // angle of escapement 0, // base-line orientation angle FW_NORMAL, // font weight FALSE, // italic attribute flag FALSE, // underline attribute flag FALSE, // strikeout attribute flag ANSI_CHARSET, // character set identifier OUT_DEFAULT_PRECIS, // output precision CLIP_DEFAULT_PRECIS, // clipping precision DEFAULT_QUALITY, // output quality FF_SWISS, // pitch and family NULL // pointer to typeface name string); D3DXCreateFont(lp3dd, MyFont, &lpd3dfont); //Thank you for your cooperation. return 1;}
That''s it. The wierd thing is that it does the exact same thing in DirectDraw.
-Forcas
"Elvis is alive. He is Barney the purple dinosaur. He is the pied piper that leads our children into the wages of sin and eternal damnation."
*bump*
This is a really wierd problem. I''ve asked about it before, and no one''s figured out what was wrong.
-Forcas
"Elvis is alive. He is Barney the purple dinosaur. He is the pied piper that leads our children into the wages of sin and eternal damnation."
This is a really wierd problem. I''ve asked about it before, and no one''s figured out what was wrong.
-Forcas
"Elvis is alive. He is Barney the purple dinosaur. He is the pied piper that leads our children into the wages of sin and eternal damnation."
I used to have some problems using DirectDraw and I´ve figure out that they were occurring because I was creating DirectDraw in OnFormCreate. Then I moved the code to the OnActivate event and everything worked ok....
André
"- To begin with, said the Cat, a dog''s not mad. You grant that?
- I suppose so, said Alice.
- Well, then, - the Cat went on - you see, a dog growls when it''s angry, and wags its tail when it''s pleased. Now I growl when I''m pleased, and wag my tail when I''m angry. Therefore I''m mad."
André
"- To begin with, said the Cat, a dog''s not mad. You grant that?
- I suppose so, said Alice.
- Well, then, - the Cat went on - you see, a dog growls when it''s angry, and wags its tail when it''s pleased. Now I growl when I''m pleased, and wag my tail when I''m angry. Therefore I''m mad."
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement