![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#41 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 343
Rep Power: 4
![]() |
yea it does move around the screen as the user wants to however, it leaves a trail of all the old images because i can not figure out how to erase the old one. Since these are stored in video memory you think there is a function that could erase that part of the memory and then that image would be gone?
|
|
|
|
|
|
#42 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Record the state of the pixels that you plan to draw over. When you get ready to redraw, restore those pixels to their previous state. Then record the state of the pixels where you plan to redraw. Then redraw. Wash, rinse, and repeat. If your library is supposed to handle that for you, you'll have to research and find out how to use that ability.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#43 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 343
Rep Power: 4
![]() |
yea i don't know how to deal with the pixels because i'm just using all bitmap images. I draw the image on the screen and then move it. Should there be a way for me to access the individual pixels in the bitmap i load?
|
|
|
|
|
|
#44 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 343
Rep Power: 4
![]() |
i got it. There is a function in SDL called SDL_FillRect. It like redraws the screen or something so i just threw that in there and now i can move the image around the screen without getting artifacts.
EDIT: i think it does redraw the whole screen but thats ok because right after the bitmap is also redrawn and at the new location. Will this work for tetris though because if it redraws the whole screen how do i make it now redraw the blocks that are already down? The second parameter it takes is the rectangle that is to be filled. So if there is some way to keep track of the y coordinate where the blocks are then i think i could make a rectangle and pass that in and it would only fill above that. Last edited by cwl157; Dec 19th, 2006 at 4:00 PM. |
|
|
|
|
|
#45 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 343
Rep Power: 4
![]() |
what if i had a function that kept track of the starting and ending position for a 1 piece and then when the screen is redrawn redraw everything even the pieces that are already down however, they would be redrawn in the same place so it would look like they always there. And yea i have no clue how to do this. It would be the ending x and y position of the piece. but those could change based on where the user puts it.
|
|
|
|
|
|
#46 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
I think, in looking for answers, that you have ceased to consider the problem and its possible solutions. Bad move. There is enough information already posted to guide you to the answer. Your 3rd party library may include the answers and it may not. Find out and act accordingly. This may mean considering the relationship between what is on the screen or in the device context, what is going to be there next, and what was there before. All this is part of the process of understanding what is going on. I think you just have to deal with that and accept, with some understanding, what your library is giving you, without having to code it, yourself.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trying to setup an anti-cheat system for a game friend and I are creating | Dr.Backtick` | C++ | 14 | Feb 15th, 2006 11:12 PM |
| Java programmers, game developers, artists, be ware! RPG game team is recruiting! | atcomputers.us | Paid Job Offers | 7 | Sep 25th, 2005 7:25 PM |
| tetris game in c++ builder | rymas | C++ | 5 | Aug 4th, 2005 12:02 PM |
| Programmers Needed! Online Game | troy_eisert | C++ | 2 | Jan 29th, 2005 12:51 PM |