The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > Graphic & Game Programming > General Game Development


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags: , , ,

Reply
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 11-14-2007, 10:40 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,119
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
Icon4 How to setup DirectX and Visual Studio 2005?

PLEASE HELP!!! I've searched over the web, so please don't tell me to Google it!!! I'm hoping that there's someone out there know how to set this up... Thanx a lot!

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #2 (permalink)  
Old 11-15-2007, 02:43 AM
Lee's Avatar
Lee Lee is offline
PT Staff*
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: Blackpool, UK
Posts: 616
iTrader: (0)
Lee is just really niceLee is just really niceLee is just really niceLee is just really nice
First entry in Google:
http://www.moon-labs.com/resources/Book2Setup.pdf

Explains it in a similar if not easier way then the book that i have. (Make sure DirectX is installed first).

Hope it helps,
Lee.
Reply With Quote
  #3 (permalink)  
Old 11-15-2007, 10:33 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,119
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
Thanx a lot Lee, I'll try this out and let you know what I got

I forgot that you've done something with DirectX, so what have you done so far with DirectX? Have you memorized the Win32 create a window, that's just a lot of codes to be memorized! XD

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #4 (permalink)  
Old 11-15-2007, 12:25 PM
Lee's Avatar
Lee Lee is offline
PT Staff*
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: Blackpool, UK
Posts: 616
iTrader: (0)
Lee is just really niceLee is just really niceLee is just really niceLee is just really nice
Not much i set it up and i think i have that in my head but then it got put behind so not done much else so far.
Reply With Quote
  #5 (permalink)  
Old 11-15-2007, 06:40 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,119
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
Alright, that's cool.. I'll get ahead from you then so you better start learning from now on...

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #6 (permalink)  
Old 11-16-2007, 02:00 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,119
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
I'm still receiving this error for some reason:

Quote:
Error 1 error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup MSVCRTD.lib
Error 2 fatal error LNK1120: 1 unresolved externals C:\Documents and Settings\helloworld\My Documents\Visual Studio 2005\Projects\t1\Debug\t1.exe 1
here's the code:

PHP Code:
// include the basic windows header files and the Direct3D header file
#include <windows.h>
#include <windowsx.h>
#include <d3d9.h>

// include the Direct3D Library file
#pragma comment (lib, "d3d9.lib")

// global declarations
LPDIRECT3D9 d3d;    // the pointer to our Direct3D interface
LPDIRECT3DDEVICE9 d3ddev;    // the pointer to the device class

// function prototypes
void initD3D(HWND hWnd);    // sets up and initializes Direct3D
void render_frame(void);    // renders a single frame
void cleanD3D(void);    // closes Direct3D and releases memory

// the WindowProc function prototype
LRESULT CALLBACK WindowProc(HWND hWndUINT messageWPARAM wParamLPARAM lParam);

// this function initializes and prepares Direct3D for use
void initD3D(HWND hWnd)
{
    
d3d Direct3DCreate9(D3D_SDK_VERSION);    // create the Direct3D interface

    
D3DPRESENT_PARAMETERS d3dpp;    // create a struct to hold various device information

    
ZeroMemory(&d3dppsizeof(d3dpp));    // clear out the struct for use
    
d3dpp.Windowed TRUE;    // program windowed, not fullscreen
    
d3dpp.SwapEffect D3DSWAPEFFECT_DISCARD;    // discard old frames
    
d3dpp.hDeviceWindow hWnd;    // set the window to be used by Direct3D

    // create a device class using this information and information from the d3dpp stuct
    
d3d->CreateDevice(D3DADAPTER_DEFAULT,
                      
D3DDEVTYPE_HAL,
                      
hWnd,
                      
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                      &
d3dpp,
                      &
d3ddev);

    return;
}

HRESULT CreateDevice(
    
UINT Adapter,
    
D3DDEVTYPE DeviceType,
    
HWND hFocusWindow,
    
DWORD BehaviorFlags,
    
D3DPRESENT_PARAMETERS *pPresentationParameters,
    
IDirect3DDevice9 **ppReturnedDeviceInterface
);

// this is the function used to render a single frame
void render_frame(void)
{
    
// clear the window to a deep blue
    
d3ddev->Clear(0NULLD3DCLEAR_TARGETD3DCOLOR_XRGB(040100), 1.0f0);

    
d3ddev->BeginScene();    // begins the 3D scene

    // do 3D rendering on the back buffer here

    
d3ddev->EndScene();    // ends the 3D scene

    
d3ddev->Present(NULLNULLNULLNULL);    // displays the created frame

    
return;
}

// this is the function that cleans up Direct3D and COM
void cleanD3D(void)
{
    
d3ddev->Release();    // close and release the 3D device
    
d3d->Release();    // close and release Direct3D

    
return;

I think this code is the introductory tutorial from Microsoft...? I've seen it somewhere in their library...

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #7 (permalink)  
Old 11-16-2007, 02:02 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,119
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
Nevermind.. it works perfect..

PHP Code:
// include the basic windows header files and the Direct3D header file
#include <windows.h>
#include <windowsx.h>
#include <d3d9.h>

// include the Direct3D Library file
#pragma comment (lib, "d3d9.lib")

// global declarations
LPDIRECT3D9 d3d;    // the pointer to our Direct3D interface
LPDIRECT3DDEVICE9 d3ddev;    // the pointer to the device class

// function prototypes
void initD3D(HWND hWnd);    // sets up and initializes Direct3D
void render_frame(void);    // renders a single frame
void cleanD3D(void);    // closes Direct3D and releases memory

// the WindowProc function prototype
LRESULT CALLBACK WindowProc(HWND hWndUINT messageWPARAM wParamLPARAM lParam);


// the entry point for any Windows program
int WINAPI WinMain(HINSTANCE hInstance,
                   
HINSTANCE hPrevInstance,
                   
LPSTR lpCmdLine,
                   
int nCmdShow)
{
    
HWND hWnd;
    
WNDCLASSEX wc;

    
ZeroMemory(&wcsizeof(WNDCLASSEX));

    
wc.cbSize sizeof(WNDCLASSEX);
    
wc.style CS_HREDRAW CS_VREDRAW;
    
wc.lpfnWndProc = (WNDPROC)WindowProc;
    
wc.hInstance hInstance;
    
wc.hCursor LoadCursor(NULLIDC_ARROW);
    
wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
    
wc.lpszClassName L"WindowClass";

    
RegisterClassEx(&wc);

    
hWnd CreateWindowEx(NULL,
                          
L"WindowClass",
                          
L"Our First Direct3D Program",
                          
WS_OVERLAPPEDWINDOW,
                          
300300,
                          
640480,
                          
NULL,
                          
NULL,
                          
hInstance,
                          
NULL);

    
ShowWindow(hWndnCmdShow);

    
// set up and initialize Direct3D
    
initD3D(hWnd);

    
// enter the main loop:

    
MSG msg;

    while(
TRUE)
    {
        
DWORD starting_point GetTickCount();

        if (
PeekMessage(&msgNULL00PM_REMOVE))
        {
            if (
msg.message == WM_QUIT)
                break;

            
TranslateMessage(&msg);
            
DispatchMessage(&msg);
        }

        
render_frame();

        while ((
GetTickCount() - starting_point) < 25);
    }

    
// clean up DirectX and COM
    
cleanD3D();

    return 
msg.wParam;
}


// this is the main message handler for the program
LRESULT CALLBACK WindowProc(HWND hWndUINT messageWPARAM wParamLPARAM lParam)
{
    switch(
message)
    {
        case 
WM_DESTROY:
            {
                
PostQuitMessage(0);
                return 
0;
            } break;
    }

    return 
DefWindowProc (hWndmessagewParamlParam);
}


// this function initializes and prepares Direct3D for use
void initD3D(HWND hWnd)
{
    
d3d Direct3DCreate9(D3D_SDK_VERSION);    // create the Direct3D interface

    
D3DPRESENT_PARAMETERS d3dpp;    // create a struct to hold various device information

    
ZeroMemory(&d3dppsizeof(d3dpp));    // clear out the struct for use
    
d3dpp.Windowed TRUE;    // program windowed, not fullscreen
    
d3dpp.SwapEffect D3DSWAPEFFECT_DISCARD;    // discard old frames
    
d3dpp.hDeviceWindow hWnd;    // set the window to be used by Direct3D


    // create a device class using this information and the info from the d3dpp stuct
    
d3d->CreateDevice(D3DADAPTER_DEFAULT,
                      
D3DDEVTYPE_HAL,
                      
hWnd,
                      
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                      &
d3dpp,
                      &
d3ddev);

    return;
}


// this is the function used to render a single frame
void render_frame(void)
{
    
// clear the window to a deep blue
    
d3ddev->Clear(0NULLD3DCLEAR_TARGETD3DCOLOR_XRGB(040100), 1.0f0);

    
d3ddev->BeginScene();    // begins the 3D scene

    // do 3D rendering on the back buffer here

    
d3ddev->EndScene();    // ends the 3D scene

    
d3ddev->Present(NULLNULLNULLNULL);   // displays the created frame on the screen

    
return;
}


// this is the function that cleans up Direct3D and COM
void cleanD3D(void)
{
    
d3ddev->Release();    // close and release the 3D device
    
d3d->Release();    // close and release Direct3D

    
return;


__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 01:51 AM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50