Skip to content

mihir262/digital-clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Digital Clock

A 7-segment digital clock rendered from scratch in C using raylib.

Digital Clock

Features

  • Custom 7-segment display drawn using DrawTriangleStrip
  • Hours : Minutes : Seconds (HH:MM:SS) in local time
  • Red segments on a pure black background
  • Centered layout with proper spacing between time groups
  • Runs at a smooth 60 FPS

Prerequisites

  • macOS (build uses Apple frameworks)
  • raylib (installed via Homebrew)
  • pkg-config
  • clang (Xcode Command Line Tools)

Install raylib:

brew install raylib

Build & Run

make build    # compiles the binary
make run      # builds and launches the clock
make clean    # removes the binary

How It Works

  • Each digit is composed of up to 7 segments defined in a lookup table.
  • Segments are drawn as 6-point triangle strips (both horizontal and vertical variants).
  • Colons are rendered as two simple circles between the hour/minute and minute/second groups.
  • Time is fetched using standard C time() + localtime().
  • The display is recalculated and redrawn every frame.

About

A digital clock built in C with raylib, featuring a custom 7-segment renderer made from triangle strips and real-time updates using the C standard time library.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors