Jump to content
  • Advertisement

Tano

Member
  • Content Count

    37
  • Joined

  • Last visited

Community Reputation

120 Neutral

About Tano

  • Rank
    Member
  1. Tano

    Free .x Models?

    Where i can find some .x models with animation? Thanks a lot..
  2. I'm a stupid. I've included two type of dinput.h .. dinput of Summer Release and December Release. So now VC++ Express compile my program.. But now i have a error on linker.. Uff.. (Sorry for my bad english! =) ) 1>Linking... 1>winmain.obj : error LNK2019: unresolved external symbol _memcpy_s referenced in function "public: static char * __cdecl std::char_traits<char>::_Copy_s(char *,unsigned int,char const *,unsigned int)" (?_Copy_s@?$char_traits@D@std@@SAPADPADIPBDI@Z) 1>winmain.obj : error LNK2019: unresolved external symbol _memmove_s referenced in function "public: static char * __cdecl std::char_traits<char>::_Move_s(char *,unsigned int,char const *,unsigned int)" (?_Move_s@?$char_traits@D@std@@SAPADPADIPBDI@Z) 1>winmain.obj : error LNK2019: unresolved external symbol "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) referenced in function "public: __thiscall std::bad_alloc::bad_alloc(char const *)" (??0bad_alloc@std@@QAE@PBD@Z) 1>winmain.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ) 1>winmain.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) referenced in function "public: virtual __thiscall std::bad_alloc::~bad_alloc(void)" (??1bad_alloc@std@@UAE@XZ) 1>winmain.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) referenced in function "public: virtual __thiscall CModel::~CModel(void)" (??1CModel@@UAE@XZ) 1>winmain.obj : error LNK2019: unresolved external symbol ___security_cookie referenced in function "public: void __thiscall bn_Font::Initialise(struct IDirect3DDevice9 *,struct bn_FontInformations)" (?Initialise@bn_Font@@QAEXPAUIDirect3DDevice9@@Ubn_FontInformations@@@Z) 1>winmain.obj : error LNK2019: unresolved external symbol @__security_check_cookie@4 referenced in function "public: void __thiscall bn_Font::Initialise(struct IDirect3DDevice9 *,struct bn_FontInformations)" (?Initialise@bn_Font@@QAEXPAUIDirect3DDevice9@@Ubn_FontInformations@@@Z) 1>winmain.obj : error LNK2019: unresolved external symbol __invalid_parameter_noinfo referenced in function "public: class CGameObject * & __thiscall std::vector<class CGameObject *,class std::allocator<class CGameObject *> >::operator[](unsigned int)" (??A?$vector@PAVCGameObject@@V?$allocator@PAVCGameObject@@@std@@@std@@QAEAAPAVCGameObject@@I@Z) 1>winmain.obj : error LNK2001: unresolved external symbol "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) 1>winmain.obj : error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::erase(unsigned int,unsigned int)" (?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z) 1>winmain.obj : error LNK2019: unresolved external symbol ___CxxFrameHandler3 referenced in function __ehhandler$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEXII@Z 1>winmain.obj : error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) referenced in function "protected: bool __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Grow(unsigned int,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAE_NI_N@Z) 1>winmain.obj : error LNK2019: unresolved external symbol "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) referenced in function "public: bool __thiscall CModel::loadModel(struct IDirect3DDevice9 *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?loadModel@CModel@@QAE_NPAUIDirect3DDevice9@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 1>winmain.obj : error LNK2019: unresolved external symbol "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) referenced in function "public: __thiscall std::logic_error::logic_error(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0logic_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z) 1>winmain.obj : error LNK2019: unresolved external symbol "public: int __thiscall GestioneTurni::AssegnaTurnoSquadra1(int)" (?AssegnaTurnoSquadra1@GestioneTurni@@QAEHH@Z) referenced in function "public: bool __thiscall Game::init(struct HWND__ *,struct D3DXVECTOR3)" (?init@Game@@QAE_NPAUHWND__@@UD3DXVECTOR3@@@Z) 1>C:\Documents and Settings\Tano\Documenti\Visual Studio 2005\Projects\videologie0.1\directx\videologie0.1.exe : fatal error LNK1120: 16 unresolved externals
  3. When i used Visual C++ 6.0 to build my project this code work.. So now i use Visual C++ Express and when i try to declare my class: class diManager { public: .............. private: diManager(void); LPDIRECTINPUT8 g_lpDI; // the direct input object LPDIRECTINPUTDEVICE8 g_lpDIDeviceMouse; // the direct input device LPDIRECTINPUTDEVICE8 g_lpDIDeviceKeyboard; // the direct input device ... }; When i try to compile it: 1>.\winmain.cpp(9) : warning C4005: 'DIRECTINPUT_VERSION' : macro redefinition 1> C:\Programmi\Microsoft Visual Studio\VC98\Include\dinput.h(27) : see previous definition of 'DIRECTINPUT_VERSION' 1>.\winmain.cpp(375) : error C2146: syntax error : missing ';' before identifier 'g_lpDI' 1>.\winmain.cpp(375) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>.\winmain.cpp(375) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>.\winmain.cpp(376) : error C2146: syntax error : missing ';' before identifier 'g_lpDIDeviceMouse' 1>.\winmain.cpp(376) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>.\winmain.cpp(376) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>.\winmain.cpp(378) : error C2146: syntax error : missing ';' before identifier 'g_lpDIDeviceKeyboard' 1>.\winmain.cpp(378) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>.\winmain.cpp(378) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>.\winmain.cpp(390) : error C2065: 'g_lpDI' : undeclared identifier 1>.\winmain.cpp(391) : error C2065: 'g_lpDIDeviceMouse' : undeclared identifier 1>.\winmain.cpp(393) : error C2065: 'g_lpDIDeviceKeyboard' : undeclared identifier 1>.\winmain.cpp(411) : error C2065: 'IID_IDirectInput8' : undeclared identifier 1>.\winmain.cpp(410) : error C3861: 'DirectInput8Create': identifier not found Anyone can help me? I don't know what i can to do to solve this problem.
  4. With Visual C++ 6.0 i add only "dxerr9.lib d3dx9dt.lib dinput8.lib d3d9.lib" in project setting. But with VC++ Express that donsen't work! The Source code is really simple.. /**************************************************************** * example2 * shows the user how to setup a windowed directx application * which clears the window to a blue color ****************************************************************/ #include <windows.h> // include directx9 #include <d3d9.h> // global variables HINSTANCE hInst; // application instance HWND wndHandle; // application window handle LPDIRECT3D9 pD3D; // the Direct3D Object LPDIRECT3DDEVICE9 pd3dDevice; // the Direct3D Device ////////////////////////////////////////////// forward declarations bool initWindow(HINSTANCE hInstance); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // DirectX functions bool initDirect3D(); void render(void); /********************************************************************* * WinMain *********************************************************************/ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { if (!initWindow(hInstance)) { MessageBox(NULL, "Unable to create window", "ERROR", MB_OK); return false; } if (!initDirect3D()) { MessageBox(NULL, "Unable to init Direct3D", "ERROR", MB_OK); return false; } // Main message loop: MSG msg; ZeroMemory( &msg, sizeof(msg) ); while( msg.message!=WM_QUIT ) { if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } else { render(); } } // release the device and the direct3D object if( pd3dDevice != NULL) pd3dDevice->Release(); if( pD3D != NULL) pD3D->Release(); return (int) msg.wParam; } /********************************************************************* * initWindow *********************************************************************/ bool initWindow(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = 0; wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = NULL; wcex.lpszClassName = "DirectXExample"; wcex.hIconSm = 0; RegisterClassEx(&wcex); // create the window wndHandle = CreateWindow("DirectXExample", "DirectXExample", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, NULL, hInstance, NULL); if (!wndHandle) return false; ShowWindow(wndHandle, SW_SHOW); UpdateWindow(wndHandle); return true; } /********************************************************************* * WndProc *********************************************************************/ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_DESTROY: PostQuitMessage(0); break; } return DefWindowProc(hWnd, message, wParam, lParam); } /********************************************************************* * initDirect3D * initializes direct3D *********************************************************************/ bool initDirect3D() { pD3D = NULL; pd3dDevice = NULL; // create the directX object if( NULL == ( pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) ) { return false; } // fill the presentation parameters structure D3DPRESENT_PARAMETERS d3dpp; ZeroMemory( &d3dpp, sizeof(d3dpp) ); d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferFormat = D3DFMT_UNKNOWN; d3dpp.BackBufferCount = 1; d3dpp.BackBufferHeight = 480; d3dpp.BackBufferWidth = 640; d3dpp.hDeviceWindow = wndHandle; // create a default directx device if( FAILED( pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, wndHandle, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pd3dDevice ) ) ) { return false; } return true; } /********************************************************************* * render *********************************************************************/ void render(void) { // check to make sure we have a valid Direct3D Device if( NULL == pd3dDevice ) return; // Clear the backbuffer to a blue color pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 ); // Present the backbuffer contents to the display pd3dDevice->Present( NULL, NULL, NULL, NULL ); } Sorry for my bad english!
  5. When i try to compile a simple program i haven't any errors.. But when i try to start debugging.. And Make the .exe file, the compiler give me some error on the linker 1>Linking... 1>winmain.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcA@16 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z) 1>winmain.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z) 1>winmain.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "bool __cdecl initDirect3D(void)" (?initDirect3D@@YA_NXZ) 1>winmain.obj : error LNK2019: unresolved external symbol __imp__UpdateWindow@4 referenced in function "bool __cdecl initWindow(struct HINSTANCE__ *)" (?initWindow@@YA_NPAUHINSTANCE__@@@Z) 1>winmain.obj : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function "bool __cdecl initWindow(struct HINSTANCE__ *)" (?initWindow@@YA_NPAUHINSTANCE__@@@Z) 1>winmain.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function "bool __cdecl initWindow(struct HINSTANCE__ *)" (?initWindow@@YA_NPAUHINSTANCE__@@@Z) 1>winmain.obj : error LNK2019: unresolved external symbol __imp__RegisterClassExA@4 referenced in function "bool __cdecl initWindow(struct HINSTANCE__ *)" (?initWindow@@YA_NPAUHINSTANCE__@@@Z) 1>winmain.obj : error LNK2019: unresolved external symbol __imp__LoadCursorA@8 referenced in function "bool __cdecl initWindow(struct HINSTANCE__ *)" (?initWindow@@YA_NPAUHINSTANCE__@@@Z) 1>winmain.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _WinMain@16 1>winmain.obj : error LNK2019: unresolved external symbol __imp__PeekMessageA@20 referenced in function _WinMain@16 1>winmain.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function _WinMain@16 1>winmain.obj : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function _WinMain@16 1>C:\Documents and Settings\Tano\Documenti\Visual Studio 2005\Projects\videologie0.1\Debug\videologie0.1.exe : fatal error LNK1120: 12 unresolved externals 1>Build log was saved at "file://c:\Documents and Settings\Tano\Documenti\Visual Studio 2005\Projects\videologie0.1\videologie0.1\Debug\BuildLog.htm" 1>videologie0.1 - 13 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== I've setup the directories, but the problem persist.. Anyone can help me? There's any tutorial to setup directx with Visual C++ Express?
  6. I've tried to used this class: //Font informations struct bn_FontInformations { //Width of the font int iWidth; //Weight of the font int iWeight; //Height of the font int iHeight; //Specifies the character set for example: TURKISH_CHARSET;DEFAULT_CHARSET int iCharSet; //Specifies the pitch and family of the font FF_DECORATIVE;FF_DONTCARE;FF_MODERN int iPitchAndFamily; //Tests if it's italic bool bItalic; //The name of the font char *pFontName; }; //Class for the font class bn_Font { public: //Initialise DirectXGraphics bn_Font(); //Desturktor clears the class ~bn_Font(); //Initialise DirectXGraphics void Initialise(LPDIRECT3DDEVICE9 lpD3DDevice,bn_FontInformations FontInfo); //Draws the Text void DrawText(char *pText,int iX,int iY,int iWidth = 0,int iHeight = 0, D3DCOLOR TextColor = D3DCOLOR_XRGB(0xFF,0xFF,0)); //If the device'll be reseted void OnLostDevice(); //If the device has been reseted void OnResetDevice(); protected: //The font LPD3DXFONT m_lpD3DFont; //If it's initialised bool m_bInitialise; }; inline void CopyPointingString(char *pTarget,char *pSource,int size) { for(int i=0; i<size; i++) { if (i == size-1) pTarget='\0'; else pTarget=pSource; } } //Initialise DirectXGraphics bn_Font::bn_Font() { //Sets it 0 m_lpD3DFont = NULL; m_bInitialise = false; } //If the device'll be reseted void bn_Font::OnLostDevice() { m_lpD3DFont->OnLostDevice(); } //If the device has been reseted void bn_Font::OnResetDevice() { m_lpD3DFont->OnResetDevice(); } //Initialise DirectXGraphics void bn_Font::Initialise(LPDIRECT3DDEVICE9 lpD3DDevice,bn_FontInformations FontInfo) { D3DXFONT_DESC FontDesc; if (FontInfo.pFontName) CopyPointingString(FontDesc.FaceName,FontInfo.pFontName,sizeof(FontInfo.pFontName)); //Sets the informations FontDesc.Weight = FontInfo.iWeight; FontDesc.Width = FontInfo.iWidth; FontDesc.Height = FontInfo.iHeight; FontDesc.CharSet = FontInfo.iCharSet; FontDesc.PitchAndFamily = FontInfo.iPitchAndFamily; FontDesc.Italic = FontInfo.bItalic; FontDesc.MipLevels = 1; //Creates the font D3DXCreateFontIndirect(lpD3DDevice,&FontDesc,&m_lpD3DFont); m_bInitialise = true; } //Destructor clears the class bn_Font::~bn_Font() { //Clean if (NULL != m_lpD3DFont) { m_lpD3DFont->Release(); m_lpD3DFont = NULL; } } //Draws the Text void bn_Font::DrawText(char *pText,int iX,int iY,int iWidth,int iHeight,D3DCOLOR TextColor) { //Draws it if (m_bInitialise) { //Creates a buffer char strBuffer[255]; sprintf(strBuffer,"%s",pText); RECT r = {iX,iY,iWidth,iHeight}; //Sets the size if (iWidth == 0 || iHeight == 0) m_lpD3DFont->DrawText(NULL,strBuffer,-1,&r,DT_CALCRECT,TextColor); //Gives it out m_lpD3DFont->DrawText(NULL,strBuffer,-1,&r,DT_CENTER,TextColor); } } So i want use this class in my new class: class bn_Font; class Game { public: Game(void); ~Game(void); bool init(HWND wndHandle, D3DXVECTOR3 posCamera); void shutdown(void); int update(); void render(void); void fontManagerInit(void); void fontManagerDraw(void); private: LPDIRECT3DDEVICE9 pd3dDeviceGame; LPD3DXFONT g_pd3dxFontGame; bool createGameObjects(void); // timer variables LARGE_INTEGER timeStart; LARGE_INTEGER timeEnd; LARGE_INTEGER timerFreq; float anim_rate; int squadra; int squadra2; int contDestra; int contSinistra; int contDietro; int contAvanti; int matrix[5][5]; int n_1,j_1,n_2,j_2; char mamtfc; // Pointer to a CShip object CShip *pShip; // the player's spaceship Personaggio2 *pPersonaggio2; GestioneTurni *pGestTurni; bn_Font *pFont; // Pointer to a CPlanet object CPlanet *pPlanet; // The main planet // The game objects vector // This vector will store all the in-game objects to be updated and rendered std::vector <CGameObject*> objects; }; bool Game::init(HWND wndHandle, D3DXVECTOR3 posCamera) { .................... mamtfc = 'P'; pFont->Initialise(g_pd3dxFontGame, 10, 10, 10, DEFAULT_CHARSET, FF_DONTCARE, FALSE, mamtfc); return true; } When i try to compile hit, i've this errors: error C2027: use of undefined type 'bn_Font' : see declaration of 'bn_Font' error C2227: left of '->Initialise' must point to class/struct/union I see that's a stupid errors for you, but i can't resolve this little problem. Anyone can help me? Thanks a lot.
  7. I've this example.. class CPlanet : CGameObject { public: CPlanet(void); ~CPlanet(void); void setSize(float planetSize); // Overridden methods from the parent class bool create(LPDIRECT3DDEVICE9 device); void render(LPDIRECT3DDEVICE9 device); private: CModel *Model; D3DXVECTOR3 position; //LPDirect3DTexture9 texture; float size; float rotationRate; }; .............. void CPlanet::setSize(float planetSize) { size = planetSize; } And i use that with: pPlanet->setSize(2); That work.. but I do not understand as
  8. What is the function to widen a Mesh? Exist?
  9. Tano

    Two Device Input..

    Thank you to everyone!
  10. Tano

    Two Device Input..

    So i can do this? bool diManager::initDirectInput(HINSTANCE hInst, HWND wndHandle) { HRESULT hr; // Create the DirectInput object. hr = DirectInput8Create(hInst, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&g_lpDI, NULL); if FAILED(hr) return FALSE; // Retrieve a pointer to an IDirectInputDevice8 interface hr = g_lpDI->CreateDevice(GUID_SysMouse, &g_lpDIDeviceMouse, NULL); if FAILED(hr) return FALSE; hr = g_lpDIDevice->SetDataFormat(&c_dfDIMouse); if FAILED(hr) return FALSE; // Retrieve a pointer to an IDirectInputDevice8 interface hr = g_lpDIK->CreateDevice(GUID_SysKeyboard, &g_lpDIDeviceKeyboard, NULL); hr = g_lpDIDevice->SetDataFormat(&c_dfDIKeyboard); if FAILED(hr) return FALSE; hr = g_lpDIDevice->SetCooperativeLevel(wndHandle, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE); if FAILED(hr) return FALSE; // Set the cooperative level hr = g_lpDIDevice->SetCooperativeLevel(wndHandle, DISCL_FOREGROUND | DISCL_EXCLUSIVE); if FAILED(hr) return FALSE; // Get access to the input device. hr = g_lpDIDevice->Acquire(); if FAILED(hr) return FALSE; return true; }
  11. In my program i've tried to inizialize two Input devices, the first dedicate to Mouse Input and the second for KeyBoard Input. So: LPDIRECTINPUT8 g_lpDI; // the direct input object LPDIRECTINPUTDEVICE8 g_lpDIDeviceMouse; // the direct input device LPDIRECTINPUTDEVICE8 g_lpDIDeviceKeyboard; // the direct input device LPDIRECTINPUT8 g_lpDIK; // the direct input object I don't have problem when i try to inizialize the Mouse: bool diManager::initDirectInputMouse(HINSTANCE hInst, HWND wndHandle) { HRESULT hr; // Create the DirectInput object. hr = DirectInput8Create(hInst, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&g_lpDI, NULL); if FAILED(hr) return FALSE; // Retrieve a pointer to an IDirectInputDevice8 interface hr = g_lpDI->CreateDevice(GUID_SysMouse, &g_lpDIDeviceMouse, NULL); if FAILED(hr) return FALSE; hr = g_lpDIDeviceMouse->SetDataFormat(&c_dfDIMouse); if FAILED(hr) return FALSE; // Set the cooperative level hr = g_lpDIDeviceMouse->SetCooperativeLevel(wndHandle, DISCL_FOREGROUND | DISCL_EXCLUSIVE); if FAILED(hr) return FALSE; // Get access to the input device. hr = g_lpDIDeviceMouse->Acquire(); if FAILED(hr) return FALSE; return true; } But when i try to inizializze my Keyboard Device: bool diManager::initDirectInputKeyboard(HINSTANCE hInst, HWND wndHandle) { HRESULT hr; hr = DirectInput8Create(hInst, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&g_lpDIK, NULL); if FAILED(hr) return FALSE; // Retrieve a pointer to an IDirectInputDevice8 interface hr = g_lpDIK->CreateDevice(GUID_SysKeyboard, &g_lpDIDeviceKeyboard, NULL); hr = g_lpDIDeviceKeyboard->SetDataFormat(&c_dfDIKeyboard); if FAILED(hr) return FALSE; hr = g_lpDIDeviceKeyboard->SetCooperativeLevel(wndHandle, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE); if FAILED(hr) return FALSE; // Get access to the input device. hr = g_lpDIDeviceKeyboard->Acquire(); if FAILED(hr) return FALSE; } This return me "FALSE" in the first control of hr. In WinMain i write this two controls: if (!diMgr.initDirectInputMouse(hInst, wndHandle)) { MessageBox(NULL, "Unable to init DirectInput MOUSE", "ERROR", MB_OK); return false; } if (!diMgr.initDirectInputKeyboard(hInst, wndHandle)) { MessageBox(NULL, "Unable to init DirectInput KEYBOARD", "ERROR", MB_OK); return false; } But the second control give me FALSE.. Can i create a only device dedicated to Keyboard and mouse to solve this problem?
  12. Hi, I've this warning: warning C4243: type cast conversion from 'class CPlanet *' to 'class CGameObject *' exists, but is inaccessible The class are these: Class CPlanet class CPlanet : CGameObject { public: CPlanet(void); ~CPlanet(void); void setSize(float planetSize); // Overridden methods from the parent class bool create(LPDIRECT3DDEVICE9 device); void render(LPDIRECT3DDEVICE9 device); private: CModel *Model; D3DXVECTOR3 position; //LPDirect3DTexture9 texture; float size; float rotationRate; }; CPlanet::CPlanet(void) { } CPlanet::~CPlanet(void) { } bool CPlanet::create(LPDIRECT3DDEVICE9 device) { position.x = 0.0f; position.y = 0.0f; position.z = 0.0f; // Create the model for this planet Model = new CModel(); return Model->loadModel(device, "sphere.x"); } void CPlanet::render(LPDIRECT3DDEVICE9 device) { D3DXMATRIX transMatrix; // the translation matrix D3DXMATRIX scaleMatrix; // the scale matrix D3DXMATRIX rotateMatrix; // The rotation matrix // Setup the translation matrix D3DXMatrixTranslation(&transMatrix, position.x, position.y, position.z); // Cause the planet to rotate D3DXMatrixRotationY(&rotateMatrix, timeGetTime()/1000.0f); // Scale the planet by the size amount D3DXMatrixScaling(&scaleMatrix, size, size, size); // Multiply the rotation matrix by the translation D3DXMatrixMultiply(&transMatrix, &rotateMatrix, &transMatrix); // Multiply the translation matrix by the scale D3DXMatrixMultiply(&transMatrix, &scaleMatrix, &transMatrix); // Transform the object into world space device->SetTransform(D3DTS_WORLD, &transMatrix); // Render the planet Model->render(device); } void CPlanet::setSize(float planetSize) { size = planetSize; } Class CGameObject class CGameObject { public: CGameObject(void); virtual ~CGameObject(void); // Abstract methods, must be overridden virtual bool create(LPDIRECT3DDEVICE9 device) = 0; virtual void render(LPDIRECT3DDEVICE9 device) = 0; protected: CModel *Model; // A pointer to a model object D3DXVECTOR3 position; // The position of this object in world space }; CGameObject::CGameObject(void) { // Set the model pointer to NULL Model = NULL; // Set the default position to the origin position.x = 0.0f; position.y = 0.0f; position.z = 0.0f; } CGameObject::~CGameObject(void) { // Delete the Model pointer when the object is destroyed if (Model) delete Model; } So, what can i do? Thanks for help! :(
  13. Thanks i've solved the problem. Thanks a lot!
  14. Linking... LINK : fatal error LNK1104: cannot open file "3dx9dt.lib" Error executing link.exe. What hell is this error? How can i correct it? Any idea?
  15. I think that's a stupid problem.. but i can't solve it..
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!