   Role Playing Games with DirectX 2nd Edition help
  I purchased the book and been trying to follow along and having problems using the source code and don't understand why it isn't working as I had setup my Visual Studio like it says in the book. I have both Visual Studio 2008 Proffesional and Visual Studio 2010 Beta 2. If anyone else has this book and has had the same issues and know a fix to get it where I can run the source code and go along with the book I would appreciate it. Also if anyone has any suggestions on any tutorials to making games with C++ I'd appreciate it.   
  What version of Visual Studio is the book written for? I have the first edition of this book, and I believe it's written for VC6, (which is over a decade old) and for an ancient DirectX SDK which is a bit different from the current SDK (Especially in the D3DX library).What sort of "problems using the source code" are you having? Can't open the files? Won't compile? Won't link? Causes your PC to burst into flames when you put the CD in the drive?   ;  The source code is VC6 in the second edition and can't compile it.   ;Quote:Original post by striker87The source code is VC6 in the second edition and can't compile it.I'm not surprised to be honest - VC6 is not a C++ compiler, it was released before the first C++ standard, and it's broken in many, many ways.What sort of errors do you get that you're not able to fix yourself?   ;  Sorry it took me so long to reply been in the field the past few weeks. For one the source code I get these errors:Error2error C2664: 'D3DXCreateFontIndirectA' : cannot convert parameter 2 from 'LOGFONT *' to 'const D3DXFONT_DESCA *'d:\prpgdx\bookcode\chap02\font\winmain.cpp138FontError3error C2039: 'Begin' : is not a member of 'ID3DXFont'd:\prpgdx\bookcode\chap02\font\winmain.cpp171FontError4error C2660: 'ID3DXFont::DrawTextA' : function does not take 5 argumentsd:\prpgdx\bookcode\chap02\font\winmain.cpp172FontError5error C2039: 'End' : is not a member of 'ID3DXFont'd:\prpgdx\bookcode\chap02\font\winmain.cpp173Font;  Those errors are because the version of D3DX the book uses is out of date. You'll have to either uninstall your current SDK and install the one that comes with the book, or understand what the code is trying to do, and convert that to the current SDK function calls.Error 2 is because D3DXCreateFontIndirect now takes a D3DXFONT_DESC struct as the second parameter.Error 3 and 5 are because ID3DXFont doesn't have Begin() and End() methods any more, instead it takes an option ID3DXSprite parameter which you can call Begin() and End() onError 4 is because ID3DXFont::DrawText() has changed.   ;  I made my Visual Studio use the SDK from the one used in the book and getting these errors from another piece of code:Error1error C2440: '=' : cannot convert from 'const char [11]' to 'LPCWSTR'c:\users\david\documents\visual studio 2008\projects\baseframework\baseframework\winmain.cpp107BaseFrameworkError2error C2664: 'UnregisterClassW' : cannot convert parameter 1 from 'const char [11]' to 'LPCWSTR'c:\users\david\documents\visual studio 2008\projects\baseframework\baseframework\winmain.cpp119BaseFrameworkError3error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [11]' to 'LPCWSTR'c:\users\david\documents\visual studio 2008\projects\baseframework\baseframework\winmain.cpp130BaseFrameworkError4error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [2048]' to 'LPCWSTR'c:\users\david\documents\visual studio 2008\projects\baseframework\baseframework\winmain.cpp161BaseFrameworkI have been able to get some of the source code to work with both VS 2008 and VS 2010.Also here is the code thats generating those errors:// Include files#include <Windows.h>#include <stdio.h>#include <stdarg.h>// Main application instancesHINSTANCE g_hInst; // Global instance handleHWND g_hWnd; // Global window handle// Application window dimensions, type, class, and window name#define WNDWIDTH 400#define WNDHEIGHT 400#define WNDTYPE WS_OVERLAPPEDWINDOWconst char g_szClass[] = "FrameClass";const char g_szCaption[] = "FrameCaption";// Main application prototypes// Entry pointint PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev,LPSTR szCmdLine, int nCmdShow);// Function to display an error messagevoid AppError(BOOL Fatal, char *Text, ...);// Message Procedurelong FAR PASCAL WindowProc(HWND hWnd, UINT uMsg,WPARAM wParam, LPARAM lParam);// Functions to register and unregister windows' classesBOOL RegisterWindowClasses(HINSTANCE hInst);BOOL UnregisterWindowClasses(HINSTANCE hInst);// Function to create the application windowHWND CreateMainWindow(HINSTANCE hInst);// Functions to init, shutdown, and handle per-frame functionsBOOL DoInit();BOOL DoShutdown();BOOL DoPreFrame();BOOL DoFrame();BOOL DoPostFrame();int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev,LPSTR szCmdLine, int nCmdShow){MSG Msg;// Save application instanceg_hInst = hInst;// Register window classes - return on FALSEif((g_hWnd = CreateMainWindow(hInst)) == NULL)return FALSE;// Do application initialization - return on FALSEif(DoInit() == TRUE) {// Enter the message pumpZeroMemory(&Msg, sizeof(MSG));while(Msg.message != WM_QUIT) {// Handle Windows messages (if any)if(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) {TranslateMessage(&Msg);DispatchMessage(&Msg);} else {// Do pre-frame processing, break on FALSE return valueif(DoPreFrame() == FALSE)break;// Do per-frame proccessing, break on FALSE return valueif(DoFrame() == FALSE)break;// Do post-frame proccessing, break on FALSE return valueif(DoPostFrame() == FALSE)break;}}}// Do shutdown functionsDoShutdown();// Unregister windowUnregisterWindowClasses(hInst);return TRUE;}BOOL RegisterWindowClasses(HINSTANCE hInst){WNDCLASSEX wcex;// Create the window class here and register itwcex.cbSize = sizeof(wcex);wcex.style = CS_CLASSDC;wcex.lpfnWndProc = WindowProc;wcex.cbClsExtra = 0;wcex.cbWndExtra = 0;wcex.hInstance = hInst;wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);wcex.hCursor = LoadCursor(NULL, IDC_ARROW);wcex.hbrBackground = NULL;wcex.lpszMenuName =NULL;wcex.lpszClassName = g_szClass;wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);if(!RegisterClassEx(&wcex))return FALSE;return TRUE;}BOOL UnregisterWindowClasses(HINSTANCE hInst){// Unregister the window classUnregisterClass(g_szClass, hInst);return TRUE;}HWND CreateMainWindow(HINSTANCE hInst){HWND hWnd;// Create the Main WindowhWnd = CreateWindow(g_szClass, g_szCaption,WNDTYPE, 0, 0, WNDWIDTH, WNDHEIGHT,NULL, NULL, hInst, NULL);if(!hWnd)return NULL;// Show and update the windowShowWindow(hWnd, SW_NORMAL);UpdateWindow(hWnd);// Return the window handlereturn hWnd;}void AppError(BOOL Fatal, char *Text, ...){char CaptionText[12];char ErrorText[2048];va_list valist;// Build the message box caption based on fatal flagif(Fatal == FALSE)strcpy(CaptionText, "Error");elsestrcpy(CaptionText, "Fatal Error");// Build variable text bufferva_start(valist, Text);vsprintf(ErrorText, Text, valist);va_end(valist);// Display the message boxMessageBox(NULL, ErrorText, CaptionText,MB_OK | MB_ICONEXCLAMATION);// Post a quit message if error was fatalif(Fatal == TRUE)PostQuitMessage(0);}// The message procedure - empty except for destroy messagelong FAR PASCAL WindowProc(HWND hWnd, UINT uMsg,WPARAM wParam,  LPARAM lParam){switch(uMsg) {case WM_DESTROY:PostQuitMessage(0);return 0;}return DefWindowProc(hWnd, uMsg, wParam, lParam);}BOOL DoInit(){// Peform application initialization functions here// such as those that set up the graphics, sound, network, etc.// Return a vlaue of TRUE for success, FALSE otherwise.return TRUE;}BOOL DoShutdown(){// Perform application shutdown functions here// such as those that shut down the graphics, sound etc.// Return a value of TRUE for success, FALSE otherwise.return TRUE;}BOOL DoPreFrame(){// Perform pre-frame processing, such as setting up a timer.// Return TRUE on success, FALSE otherwise.return TRUE;}BOOL DoFrame(){// Perform per-frame processing, such as rendering.// Return TRUE on success, FALSE otherwise.return TRUE;}BOOL DoPostFrame(){// Perform post-frame processing, such as time synching, etc.// Return TRUE on success, FALSE otherwise.return TRUE;};  I was able to fix it by changing the Character Set to Use Multi-Byte Character Set.   ;  In case you're still unsure what the warnings were about, I'd recommend reading this.   