|
optimizing code with Assemmbly |
av0k23
Member #7,284
May 2006
|
Hi y'all. i dont know if i am making sense cos i am sleepy from staying up all nite. if someone could be of litte assistance i would be most greatful |
ReyBrujo
Moderator
January 2001
|
No, don't use assembler, you are likely to make things worse. Either use direct bitmap access, through the bitmap array (search allegro.txt for that), or use the optimized versions: If you are using 8bpp, use the ones without number. If you are at other resolution, change accordingly. Finally, note that these functions (as far as I remember) don't check for clipping: in other words, if you use the common getpixel function with coordenates (10000,10000), nothing will happen. If you use such coordenates with any of these functions, your program will crash. -- |
av0k23
Member #7,284
May 2006
|
i never heard of optimized getpixel? hope i works on this for(i=0; i<sprite_width; i++) //_pallete[] contains color codes |
Tomasz Grajewski
Member #4,284
February 2004
|
You can also use the hline function instead of the putpixel because it is a lot faster when drawing on to a video bitmap, but only with the hardware acceleration. At least it works faster for me. ___________________________________________________________________________________________ |
av0k23
Member #7,284
May 2006
|
this is all great help but the problem is i am not implementing this directly into allegro. i was half-way into a projecct in game maker before i saw allegro and i cant begin to think of starting again (my comrades cant c++/c). if only i understood pascal/assembly
|
Evert
Member #794
November 2000
|
Quote: there was a clash with the <windows.h> api as bitmap means different things in both. Include winalleg.h. See the Windows-specifics section of the manual. Quote: thts why i was asking for assembly just incase asking for allegro sounded stupid. It's an Allegro forum. Of course it isn't stupid to ask questions about Allegro! Quote: if only i understood pascal/assembly
Why? |
Goalie Ca
Member #2,579
July 2002
|
I almost see no reason to use assembly anymore for any but embedded and extremely low-level tasks. Using any modern c-compiler an intelligent user can produce almost exactly the assembly they want without losing any cross-platform and readability. Even vector processing can be easily handled without leaving c/c++ nowadays. ------------- |
Sirocco
Member #88
April 2000
|
Quote: No, don't use assembler, you are likely to make things worse. Either use direct bitmap access, through the bitmap array (search allegro.txt for that), or use the optimized versions: Very true. Get/putpixel are damn slow compared to something like bitmap->line[y][x] = color. --> |
|