Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 19th, 2006, 1:04 PM   #41
cwl157
Professional Programmer
 
Join Date: Feb 2005
Posts: 343
Rep Power: 4 cwl157 is on a distinguished road
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?
cwl157 is offline   Reply With Quote
Old Dec 19th, 2006, 1:26 PM   #42
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Dec 19th, 2006, 1:37 PM   #43
cwl157
Professional Programmer
 
Join Date: Feb 2005
Posts: 343
Rep Power: 4 cwl157 is on a distinguished road
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?
cwl157 is offline   Reply With Quote
Old Dec 19th, 2006, 3:49 PM   #44
cwl157
Professional Programmer
 
Join Date: Feb 2005
Posts: 343
Rep Power: 4 cwl157 is on a distinguished road
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.
cwl157 is offline   Reply With Quote
Old Dec 19th, 2006, 8:46 PM   #45
cwl157
Professional Programmer
 
Join Date: Feb 2005
Posts: 343
Rep Power: 4 cwl157 is on a distinguished road
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.
cwl157 is offline   Reply With Quote
Old Dec 19th, 2006, 9:37 PM   #46
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:35 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC