Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    422070

Untitled

Sign in to follow this  

83 views

Minor update time...

Tutorial 2's code is now complete. It covers:
  • Creating and filling a static vertex buffer
  • Setting up 3D transforms (View, projection and world matrices)
  • Framerate independant rendering
  • Resetting the device
  • Handling lost devices

    In other words, "It are spinny pretty colour triangle with button that make go fullscreen". Some "nice" things about it:
  • It stores the window position prior to going fullscreen and restores it on return (A pet peeve of mine that some apps don't do)
  • It frees up CPU time when the window isn't active (Via a Sleep(50); if the window isn't in focus)
  • It changes the window style when toggling fullscreen / windowed mode
  • It enumerates the adapter modes to chose a fullscreen mode closest to the window size specified.

    And, in doing the last point, I found a bug in the last tutorial; it creates a client area that's 640x480 - which is fine, but then passes the window size to the function that sets up the backbuffer, resulting in a backbuffer that's bigger than the client area; which is the whole point in using AdjustWindowRect [embarass]

    I get to escape work at lunch time tomorrow, which is nice. I'll hopefully be writing the article for this code soon - probably not tomorrow, but hopefully by the 27th or so, and I'll fix the bug mentioned above at the same time. I'll let you all look at my mistake and laugh at me for now [smile]

    Bed for I...
  • Sign in to follow this  


    2 Comments


    Recommended Comments

    Why did you choose for Sleep(50). In my render loop, when the application doesnt have focus, the render and update functions are skipped. So the total CPU time becomes 0 while the game is not active.

    What is better ? Is there a good reason to render and Sleep for 50 miliseconds, or, like me, make the application totally userless while not active ?

    Share this comment


    Link to comment
    Quote:
    Original post by MarijnStevens
    Why did you choose for Sleep(50). In my render loop, when the application doesnt have focus, the render and update functions are skipped. So the total CPU time becomes 0 while the game is not active.

    What is better ? Is there a good reason to render and Sleep for 50 miliseconds, or, like me, make the application totally userless while not active ?
    Not rendering at all causes the application not to redraw properly (Unless you're on Vista). I suppose I could render a frame inside WM_PAINT to fix that though - I'll look into doing that.

    Share this comment


    Link to comment

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now