• Content count

  • Joined

  • Last visited

Community Reputation

188 Neutral

About utilae

  • Rank
    Advanced Member
  1. iOS Development on PC

    Develop games for both iOS and Andoid: ---   Corona http://www.coronalabs.com/products/corona-sdk/   moai http://getmoai.com/   Gideros Mobile http://www.giderosmobile.com/   Develop apps for both iOS and Andoid: ---   Appcelerator Titanium http://www.appcelerator.com/platform/titanium-sdk/   PhoneGap http://phonegap.com/
  2. One question. How do I make sure that an iterator to a vector is valid when reading from one. eg if(itBestRect is valid, ie is pointing to an element in the vector) { RECT recSrcHole; recSrcHole.top=itBestRect->top; recSrcHole.left=itBestRect->left; recSrcHole.right=itBestRect->right; recSrcHole.bottom=itBestRect->bottom; } Thanks
  3. Hi thanks. You are right. In my focus on VS2008 and its settings, I forgot that I was for some reason thinking an iterator had an empty function.
  4. Spelling issues aside, can somebody actually help me solve the problem. If the vector class has a method called empty() then when I do it eg itBestRect.empty() well, pressing the . brings up some wierd methods I have never seen before and does not bring up and empty() method as a possible option. examples: itBestRect._Adopt itBestRect._Compat itBestRect._Getmycont What's with these? That's why I want to setup visual studio 8 with unmanaged code or otherwise known as native code. Because I don't want any of the fluff microsoft has added.
  5. if(itBestRect!=NULL) Why does functions I used to use not work? There was a function for vectors such as Empty() But it doesn't come up? I think I somehow still need to make my settings in Visual Studio 2008 as unmanaged / native.
  6. I'm sure it worked okay with Null in the past on VS 2003. Oh well then. Will do. Thanks
  7. Hi, ok. The first error refers to this piece of code: vector<RECT>::iterator itSearchRect=lstFilledRects.begin(); vector<RECT>::iterator itBestRect=NULL; //<<<<<===error 1 pointing here int nSrcRectMaxBottom=0, nSrcRectMinLeft=recContainer.right; while(itSearchRect!=lstFilledRects.end()) { The second error refers to this piece of code: if(itBestRect!=NULL) //<<<<<===error 2 pointing here { RECT recSrcHole; recSrcHole.top=itBestRect->top; recSrcHole.left=itBestRect->left; recSrcHole.right=itBestRect->right; recSrcHole.bottom=itBestRect->bottom;
  8. Hi, I am using C++ and am compiling my code in Visual Studio 2008 on Windows XP. Previously my code compiled fine in Visual Studio 2003, but now in VS2008 it gives me the following two errors. Maybe I don't have visual studio 2008 setup right. Any ideas. Thanks. 1>error C2440: 'initializing' : cannot convert from 'int' to 'std::_Vector_iterator<_Ty,_Alloc>' 1> with 1> [ 1> _Ty=RECT, 1> _Alloc=std::allocator<RECT> 1> ] 1> No constructor could take the source type, or constructor overload resolution was ambiguous 1>error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_Vector_iterator<_Ty,_Alloc>' (or there is no acceptable conversion) 1> with 1> [ 1> _Ty=RECT, 1> _Alloc=std::allocator<RECT> 1> ] 1> c:\program files\microsoft sdks\windows\v6.0a\include\guiddef.h(197): could be 'int operator !=(const GUID &,const GUID &)' 1> c:\program files\microsoft visual studio 2008\vc\include\vector(214): or 'bool std::_Vector_const_iterator<_Ty,_Alloc>::operator !=(const std::_Vector_const_iterator<_Ty,_Alloc> &) const' 1> with 1> [ 1> _Ty=RECT, 1> _Alloc=std::allocator<RECT> 1> ] 1> while trying to match the argument list '(std::_Vector_iterator<_Ty,_Alloc>, int)' 1> with 1> [ 1> _Ty=RECT, 1> _Alloc=std::allocator<RECT> 1> ]
  9. Hi, I am using C++ and on Windows XP. I am new to Visual Studio 2008 having previously used Visual Studio 2003. How do you setup the project to use native / unmanaged code. Thanks
  10. Ok, so I took the update mouse function out of teh WM_MOUSEMOVE case and put it in the GUI update loop. Now (with VSync) when I put the game loop ticks per second at 120, the mouse goes blazing fast, which is excellent, so thats that problem solved. EDIT: Ok, thank you. Problem sorted. [Edited by - utilae on February 23, 2008 3:06:02 AM]
  11. Activating Vertical Sync defintatly removes the tearing. But the problem I guess is that it makes the mouse and other things go slow. Most notably the mouse, since upon moving it really fast, it is 'late' and gets to its destination slower then it would in windows or without vertical sync. In my game loop, by putting the const int nTICKS_PER_SECOND=60; or =120; the mouse moves faster, but it still slower then I would like. In guild wars, with vertical sync on the mouse seems to move as it should, really fast and really responsive. For mouse movement I hide the mouse cursor and use an image (D3DXSprite) in its place. So I can set my own mouse icons. In the windows procedure I do this: case WM_MOUSEMOVE: { //mouse has moved GUIManager.m_pMouse->UpdateCurrentPos(); }break; case WM_LBUTTONDOWN: { //left button is down GUIManager.m_pMouse->SetMouseState(1); }break; case WM_LBUTTONUP: { //left button is up GUIManager.m_pMouse->SetMouseState(2); }break; case WM_RBUTTONDOWN: { //right button is down GUIManager.m_pMouse->SetMouseState(3); }break; case WM_RBUTTONUP: { //right button is up GUIManager.m_pMouse->SetMouseState(4); }break; In the GUIManager.m_pMouse->UpdateCurrentPos() function the code is basically this: //get mouse position on screen POINT ptMousePos; GetCursorPos(&ptMousePos); //calculate current mouse position m_ptCurrentMousePos.x=ptMousePos.x-16+m_ptHotSpot.x; m_ptCurrentMousePos.y=ptMousePos.y-16+m_ptHotSpot.y; //update screen rect position m_recPos.top=ptMousePos.y-16; m_recPos.left=ptMousePos.x-16; m_recPos.right=m_recPos.left+32; m_recPos.bottom=m_recPos.top+32;
  12. Yeah, I have implemented what I think is a time based game loop, but I don't know if it is working properly. I am pretty sure I have the interpolation part working. The main point of issue is the ticks per second and max frame skip. I'm not sure what those two are. I guess the ticks per second is the frames per second, cause if i set it to 60 or 120 I can move the mouse faster with vertical sync but it still is slow. The game loop is based on this article: http://dewitters.koonsolo.com/gameloop.html "Fixed Update and Variable Rendering" //message pump MSG msg; //start game with the Game_Core gamestate if(Game_Core_Load()==false) return(0); //set game state pointers to initial game states sCurrentGameState="Game_Core"; fnptrCurrentUpdateGameState=Game_Core_Update; fnptrCurrentRenderGameState=Game_Core_Render; //frame rate indepenent game loop variables const int nTICKS_PER_SECOND=25; const int nSKIP_TICKS=1000 / nTICKS_PER_SECOND; const int nMAX_FRAMESKIP=5; DWORD dwNextGameTick=timeGetTime(); int nLoops=0; float fInterpolation=0; //GAME LOOP while(true) { //PEEK MESSAGE //look for a message if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))//there is a message { if(msg.message==WM_QUIT) break;//quit if that is the message TranslateMessage(&msg);//translate message DispatchMessage(&msg);//dispatch message } //FRAME RATE INDEPENDENT GAME LOOP //fixed update nLoops=0; while(timeGetTime() > dwNextGameTick && nLoops < nMAX_FRAMESKIP) { //current update gamestate fnptrCurrentUpdateGameState(); dwNextGameTick += nSKIP_TICKS; nLoops++; } //need other while loops for different updates at different speeds //variable render fInterpolation=float(timeGetTime() + nSKIP_TICKS - dwNextGameTick) / float(nSKIP_TICKS); fnptrCurrentRenderGameState(fInterpolation);//current render gamestate } Game_Core_Unload();//clean up program data return(msg.wParam);//return the wparam from the WM_QUIT message
  13. Hi, I am using C++ and Direct3D9. When I move an object around on the screen at speed, I get the jaggies and refresh artifacts (possible blurring). Putting Vertical Sync on fixes this and makes it smooth, but everything is slow and the mouse movement is 'late' in terms of where you direct it. So V_Sync is not an option. I am working on a laptop with a good graphics card. The refresh rate is at 60Hz and I notice that when I move a notepad window around in windows xp sp2 it also does the same thing. But when playing games, ie guild wars, its perfect, no jaggies etc. So is this common for laptops? Would all games made for laptops do this. Or is there some way to cater for those on laptops. Edit: ok Guild Wars is using wait for vertical sync, but it is not as slow as my program when my program uses vertical sync. Help?
  14. Ok so if I have a car object then during update function I change the position eg //car.m_nPosition = car.m_nPosition + car.m_speed; car.m_nPosition = 500 + 10; // = 510 And in the render function I then just store a interpolated position locally eg //int nView_position = car.m_nPosition + (car.m_speed * interpolation); int nView_position = 510 + (10 * 0.5); // = 515 //render function here //dxSprite->Draw(...rect based on nView_position ...); Is that right? I think I get it now. Thanks