![]() |
|
|
|
| ||||||
|
Welcome to the The ProgrammersTalk Community forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| Tags: |
![]() |
![]() | | LinkBack | Thread Tools | Display Modes | ![]() |
| |||
| [SOLVED] Computer games development graphics question? Generally, when I draw something to the screen, how do I get it off the screen again? For example, I want to draw a line onto the screen, appearing at a source, which then moves to a target, then disappears (this is to simulate a "bullet-streak" fired from a source) I know how to do all the calculations i.e vectors and radians etc. But I don't know how to get the thing off the screen >.< I'm using Python/Pygame. I really dont like Pygame but it's for Uni. I know not many people use Pygame, so if you give me an example in C++ that's fine. Thanks ! |
| |
| |||
| For almost all video games, at a constant framerate (e.g. 60 Hz) the entire screen is blanked and redrawn. The game loop typically will clear then redraw everything on the screen to a buffer in local memory (or non-displayed video memory). When rendering is finished, it will quickly copy this buffer to displayed video memory. This may seem like an inefficient approach, but considering all of the possible overlays and issues involved with selective redrawing, it is the easiest and most standard method. Other software, such as the Windows operating system, actually separately redraw only portions of the screen to ensure the software will run even on slow systems. |
| |||
| I use Pygame. Anyway, the basic idea is that you blit a section of the background onto the area you want to "clear." Don't think of it as erasing the sprite, but as pasting over it. In a complex game, you'd keep a list of dirty rects, which you can find more information about by googling. |
![]() |
| Thread Tools | |
| Display Modes | |
| |