No Window Please

Started by
3 comments, last by gs384 19 years, 10 months ago
How do you get a lovely blank screen ,black or blue any colour will do, without a MS Window being anywhere in sight. All I want is a blank canvas on which to paint my dream. A link to a tutorial would be great and appreciated. Keepers of the flame never let it die
Advertisement
Hiya.

If you already have a windowed version running its very easy to switch to full screen. Essentialy all you have to do is set the D3DPRESENT_PARAMETERS during initialisation so it knows its supposed to be full screen. eg if D3DParams is your instance of the D3DPRESENT_PARAMETERS then:

D3DParams.Windowed = false;

Also the windows code will have to be modified slightly. When you create your window (using CreateWindowEx() I assume) set the following flags:

WS_POPUP | WS_VISIBLE

For a tutorial try looking at:

http://www.codesampler.com/dx9src.htm

Hope this helps
[size="1"] [size="4"]:: SHMUP-DEV ::
Thanks for the quick response motorherp; i''ll check out the link straight away

Keepers of the flame never let it die
Can you please explain further?

"all you have to do is set the D3DPRESENT_PARAMETERS during initialisation so it knows its supposed to be full screen. eg if D3DParams is your instance of the D3DPRESENT_PARAMETERS then:

D3DParams.Windowed = false;
////////////////////////////////////

Here is how my window has been created but No sign of D3DParams in this code.

#include <windows.h>

const char *ClsName = "BasicApp";
const char *WndName = "GS384''s Window";

LRESULT CALLBACK WndProcedure(HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam);

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MSG Msg;
HWND hWnd;
WNDCLASSEX WndClsEx;

// Create the application window
WndClsEx.cbSize = sizeof(WNDCLASSEX);
WndClsEx.style = CS_HREDRAW | CS_VREDRAW;
WndClsEx.lpfnWndProc = WndProcedure;
WndClsEx.cbClsExtra = 0;
WndClsEx.cbWndExtra = 0;
WndClsEx.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WndClsEx.hCursor = LoadCursor(NULL, IDC_ARROW);
WndClsEx.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
WndClsEx.lpszMenuName = NULL;
WndClsEx.lpszClassName = ClsName;
WndClsEx.hInstance = hInstance;
WndClsEx.hIconSm = LoadIcon(NULL, IDI_APPLICATION);

// Register the application
RegisterClassEx(&WndClsEx);

// Create the window object
hWnd = CreateWindow(ClsName,
WndName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);

// Find out if the window was created
if( !hWnd ) // If the window was not created,
return 0; // stop the application

// Display the window to the user
ShowWindow(hWnd, SW_SHOWNORMAL);
UpdateWindow(hWnd);

// Decode and treat the messages
// as long as the application is running
while( GetMessage(&Msg, NULL, 0, 0) )
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}

return Msg.wParam;
}

LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg,
WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
// If the user wants to close the application
case WM_DESTROY:
// then close it
PostQuitMessage(WM_QUIT);
break;
default:
// Process the left-over messages
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
// If something was not done, let it go
return 0;
}


#include <windows.h>const char *ClsName = "BasicApp";const char *WndName = "GS384's Window";LRESULT CALLBACK WndProcedure(HWND hWnd, UINT uMsg,WPARAM wParam, LPARAM lParam);INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow){MSG Msg;HWND hWnd;WNDCLASSEX WndClsEx;// Create the application windowWndClsEx.cbSize = sizeof(WNDCLASSEX);WndClsEx.style = CS_HREDRAW | CS_VREDRAW;WndClsEx.lpfnWndProc = WndProcedure;WndClsEx.cbClsExtra = 0;WndClsEx.cbWndExtra = 0;WndClsEx.hIcon = LoadIcon(NULL, IDI_APPLICATION);WndClsEx.hCursor = LoadCursor(NULL, IDC_ARROW);WndClsEx.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);WndClsEx.lpszMenuName = NULL;WndClsEx.lpszClassName = ClsName;WndClsEx.hInstance = hInstance;WndClsEx.hIconSm = LoadIcon(NULL, IDI_APPLICATION);// Register the applicationRegisterClassEx(&WndClsEx);// Create the window objecthWnd = CreateWindow(ClsName,WndName,WS_OVERLAPPEDWINDOW | WS_POPUP | WS_VISIBLE,  //heres where it goes into fullscreenCW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);// Find out if the window was createdif( !hWnd ) // If the window was not created,return 0; // stop the application// Display the window to the userShowWindow(hWnd, SW_SHOWNORMAL);UpdateWindow(hWnd);// Decode and treat the messages// as long as the application is runningwhile( GetMessage(&Msg, NULL, 0, 0) ){TranslateMessage(&Msg);DispatchMessage(&Msg);}return Msg.wParam;}LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg,WPARAM wParam, LPARAM lParam){switch(Msg){// If the user wants to close the applicationcase WM_DESTROY:// then close itPostQuitMessage(WM_QUIT);break;default:// Process the left-over messagesreturn DefWindowProc(hWnd, Msg, wParam, lParam);}// If something was not done, let it goreturn 0;}


though youll need to resize the window if youre not using DX or OpenGL to the current screen resolution

[edited by - redrabbit on June 6, 2004 2:24:05 PM]
//-----------------------------------------One short sleepe past, wee wake eternally, And Death shall be no more, Death thou shalt die.

This topic is closed to new replies.

Advertisement