Skip to main content

Posts

Showing posts with the label screenunlock

(VI) Frame control & locking the screen while drawing: screensync, cls, screenlock, screenunlock

Hiya everybody! Take a look at the code of the day: Let me explain the new keywords used: screensync  is the key to take the number of frames per second under control because this instruction waits until next refresh of the screen, usually 60 times per second known as 60 fps. After this we will draw our screen. cls  to CLear the Screen and draw from zero the new state of the game. screenlock  to lock the screen to hide it while we are drawing. screenunlock  to unlock the screen to show the new drawed screen. Is very important to respect that we have to draw inmediately after the screensync and remember that between screenlock and screenunlock you have to draw, nothing else to do this part of the code as fast as possible. How is the structure? more and more accurate every time: DESCRIPTION DECLARATIONS INITIALIZATIONS GAME LOOP INPUT DO UPDATE DRAW screensync screenlock cls ... screenunlock FREE UP CPU TIME sleep 1,1 E...