11 July 2013, 17:54 | #1 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
(Lame) C OS starfield
Hello people.
Here is a lame starfield in C (OS friendly). Usage: sf [numofstars] [speed] Opens a 2 bitplane screen and places a borderless window on top of it. Then goes to draw stars (pixels really) in 3 colors. (..of gray, dim to bright) Press left mouse button to exit. Adds a vertical interrupt routine to count actual frames and reports an aproximation on frames per second. I know it's lame, but maybe it will help someone starting coding in C :-) Laters, /Alkis [Edited to update file] Last edited by alkis; 11 July 2013 at 18:45. |
11 July 2013, 18:03 | #2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,000
|
Why do you use OpenScreenTags/OpenWindowTags which only exist in 2.0+ but then don't use AllocVec/FreeVec which would make memory handling a lot easier because you wouldn't need to remember the size you allocated?
And of course you should check for allocation failures. You check IntuitionBase, but don't do anything in case of failure. You don't check GfxBase, my_window, vbint and stars. You check my_screen but then crash badly if it really fails because if my_screen fails to open, you close IntuitionBase but nevetheless call OpenWindowTags. |
11 July 2013, 18:46 | #3 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
@thomas wow :-) Fixed :P
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Asm: 4 bitplanes starfield (68020+) | alkis | Coders. Asm / Hardware | 20 | 06 September 2013 07:30 |
Does anyone know what Starfield called in Alien Breed? | Amiga Forever | Coders. General | 5 | 24 June 2011 01:44 |
Starfield in Blitz Basic - helpful critique sought | Anding | Coders. General | 10 | 13 January 2009 21:46 |
Too lame for Stardust? | Maverick | Retrogaming General Discussion | 18 | 02 September 2005 17:28 |
(f)lame section | Jim | project.EAB | 5 | 14 January 2005 14:11 |
|
|