Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] 7 Segment Display Function - Useful for score display etc.

Author
Message
Pricey
21
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 22nd Aug 2008 23:10


This function will emulate the 7 segment LCD display as found on calculators and other electronic devices.
You could use this for any number of things, but what I had in mind was score displays in futuristic styled games.

drawdigit(X position, Y position, Number to display, Digits in display, RGB colour value)

Run the example to get the idea. If there are less digits in the 'number to display' than specified in the 'digits to display' then the gaps will be filled in with zeros.

Mr Tank
21
Years of Service
User Offline
Joined: 25th Nov 2002
Location: United Kingdom
Posted: 23rd Aug 2008 00:25
That looks surprisingly awesome. Reminds me of the gun counters in Aliens etc.

SBSX
[http://forum.thegamecreators.com/?m=forum_view&b=8&t=134372]ASTEROID WORLDS[/url]
Pricey
21
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 23rd Aug 2008 02:08
calcyman
16
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 27th Aug 2008 09:17
I made one with thickness a while ago, but it's much slower than yours:



The optomist's right, The pessimist's right.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 27th Aug 2008 21:13
Surprisingly simple - I like it.

Mr Kohlenstoff
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 29th Aug 2008 15:04
True, looks quite good. However, you should use box instead of line to draw the lines (they all seem to be vertical or horizontal) due to its higher speed. At least for me the box-command runs as fast as pase image or paste sprite, line on the other hand is quite slow.

Sixty Squares
17
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 3rd Sep 2008 01:23 Edited at: 3rd Sep 2008 01:25
Wow that's really nice ! I made Mr. Kohlenstoff's sugguested change and it looks a tad different... But now one can change thickness.



calcyman
16
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 5th Sep 2008 11:44
Using BOX you can just create rectangles, whereas the segments are not rectangles (they taper to a point on each side)

The optomist's right, The pessimist's right.

Login to post a reply

Server time is: 2024-05-19 03:39:50
Your offset time is: 2024-05-19 03:39:50