|
double buffering |
ferkaluk
Member #7,422
June 2006
|
Hi everyone please look for this code and give me advice what to correct: BITMAP *buffer = create_bitmap(SCREEN_W, SCREEN_H); do { clear(buffer); clear_to_color(buffer, 15); if(key[KEY_LEFT]) i-=4; if(key[KEY_RIGHT]) i+=4; if(key[KEY_UP]) j-=4; if(key[KEY_DOWN]) j+=4; draw_sprite(buffer, the_image, i, j);// clear_keybuf(); rest(20); vsync(); blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); }while(!key[KEY_ESC]);
|
Nils Fagerburg
Member #7,193
May 2006
|
What do you mean by "not soft"? Perhaps you are moving your sprite too fast. -- |
vixinu
Member #7,343
June 2006
|
#1..........spell check #2..........do you mean it just jumps to your destination? |
Elverion
Member #6,239
September 2005
|
Also, look into timers and separate your logic from drawing code. The forum search appears to be broken right now, or I'd help find a few useful topics. So, just read the manual and look up install_timer_ex and related functions. You might also Google search for Allegro timer tutorials. Without separating your logic and drawing, you are putting extra, unnecessary processing power into drawing when it doesn't need to be redrawn. Also, minor fluctuations in the process time slice allotment would cause minor hiccups during game play. You might also want to look into vsync() to help smooth things out. http://gpwiki.org/index.php/Allegro:Tutorials:Basics -- |
neil dwyer
Member #7,237
May 2006
|
If non soft means jumpy it maybe it is because you are going four pixels at a time with a small screen resolution. Edit: Also make your code a little more readable, you should never call a variable 'j'. |
ferkaluk
Member #7,422
June 2006
|
thx for all comments my code doesn't have a timer (maybe this is a reason) there is the code and exe(program) (310KB) //edit |
vixinu
Member #7,343
June 2006
|
To jest wspaniałe jeżeli wasz Język angielski nie jest bardzo dobry. pomyślę (obmyślił) was byliście po prostu (dopiero co) niedbały Amerykanin. Wy jesteście mały (niewielka ilość; trochę) lepszy (lepiej) niż niedbały Amerykanin, chociaż. |
CursedTyrant
Member #7,080
April 2006
|
Please tell me you're not from Poland Also, that translator sucks --------- |
ferkaluk
Member #7,422
June 2006
|
hmm vixinu |
CursedTyrant
Member #7,080
April 2006
|
I guess he's the only one who has any idea what he is talking about --------- |
ferkaluk
Member #7,422
June 2006
|
tak myślę , może popis jakiś czy co |
LennyLen
Member #5,313
December 2004
|
Quote: I guess he's the only one who has any idea what he is talking about Based on most of his posts, I doubt he does either.
|
vixinu
Member #7,343
June 2006
|
I was using a bad translator, but the only one I could find: poltran.com. No, I'm from the USA. So how 'bout we just start up a 'Complain about vixinu' thread? I promise not to interfere and get mad about it, in fact, I encourage it!!!>:( |
CursedTyrant
Member #7,080
April 2006
|
At least you learnt a lesson. Never use translators. They are evil! --------- |
LennyLen
Member #5,313
December 2004
|
Quote: At least you learnt a lesson. Never use translators. They are evil! Correction... don't use them to translate your own words to another language. When it comes to trying to get the gist of the meaning of a passage written in a foreign language, they are a great tool.
|
vixinu
Member #7,343
June 2006
|
Still reccomend the make fun of vixinu thred. I wasn't kidding!;D |
|