This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
xuma202's profile picture

[CCGPU] Analog Clock [v1.0.3]

Started by xuma202, 30 March 2012 - 05:40 PM
xuma202 #1
Posted 30 March 2012 - 07:40 PM
Hello,

I've just finished my Analog Clock. Use it with the awesome CCGPU Peripheral.

The clock will display the real Minecarft time.

Picture:



More Pictures : http://imgur.com/a/OBOU3

Code:

v 1.0.3 http://pastebin.com/SqJNC5Mm
v 1.0.2 http://pastebin.com/hTa8afcM
v 1.0.1 http://pastebin.com/buxrPKVF
v 1.0.0 http://pastebin.com/SBJeGtaH

Changelog:

v 1.0.3 :
  • color fading is now time-based.
  • the time until the color fade restarts is adjustable
  • minor performance optimization (circle is now only calculated once)
v 1.0.2 :
  • adjustable frequency of frame updates (per second)
v 1.0.1 :
  • added optional Color fading
  • optimized vertex calculation (clock is now maximum size)
v 1.0.0 :
  • first official release
Mast3rPlan #2
Posted 30 March 2012 - 07:49 PM
Amazing man, I love it!
Loopin #3
Posted 30 March 2012 - 08:58 PM
Oh my god man, really amazing!, this is the first program made using Gpu peripheral and i loved it!(i think was the first.)
FuzzyPurp #4
Posted 31 March 2012 - 09:48 PM
Just tried this - its amazing! MC 1.2.3, just finish backporting ccGPU. So grab it now.
ssandiss #5
Posted 10 July 2012 - 02:54 PM
What's CCGPU peripheral?
I've coded all the code into a computer what shall i do to make it work? :/
(Sorry for asking a probably noob question) :/
xuma202 #6
Posted 10 July 2012 - 03:28 PM
You need this mod to run the code http://www.computercraft.info/forums2/index.php?/topic/986-132-ccgpu-a-gpu-addon-for-computercraft make shure yomu put a gpu next to the computer and place a graphical monitor with the same frequency and id in range.NOTE: there was an update made (see the last page of the thread)
maximouli #7
Posted 26 February 2013 - 09:43 AM
You program is awesome ! Somebody nows how to modify the code to have the time of the real world (on earth :D/>) thanks
xuma202 #8
Posted 27 February 2013 - 05:17 AM
You program is awesome ! Somebody nows how to modify the code to have the time of the real world (on earth :D/>) thanks

The important line is line 158

time = os.time()

When it's for example 8:37 the function will os.time() will return 8.6166666…
If you can manage to get the real world time into a variable you'll just have to manipulate this line or these lines: (160&161)


hours = math.floor(time)
minutes = math.floor((time-hours)*60)

hours must contain the hours [0-11] and minutes must contain the minutes [0-59] so you can modify lines 158-161.

However afaik you can't read the real wolrd time with a CC function so you maybe have to use the http api or something else.