English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 11 July 2013, 17:54   #1
alkis
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]
Attached Files
File Type: c sf.c (5.9 KB, 309 views)

Last edited by alkis; 11 July 2013 at 18:45.
alkis is offline  
Old 11 July 2013, 18:03   #2
thomas
Registered User
 
thomas's Avatar
 
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.
thomas is offline  
Old 11 July 2013, 18:46   #3
alkis
Registered User
 
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
@thomas wow :-) Fixed :P
alkis is offline  
 


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

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


All times are GMT +2. The time now is 23:52.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09279 seconds with 14 queries