Skip to content

Commit

Permalink
FranzCross: add xmas icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdanp committed Nov 23, 2023
1 parent 16dbc0f commit aae5169
Show file tree
Hide file tree
Showing 53 changed files with 72 additions and 5 deletions.
Binary file added FranzCross/assets/icon-xmas/icon-00.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/icon-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/icon-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/icon-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/icon-04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/icon-05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/icon-06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/icon-07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/icon-08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/icon-09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/icon-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/icon-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/icon-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FranzCross/assets/icon-xmas/[email protected]
Binary file added FranzCross/assets/icon-xmas/icon-13.png
Binary file added FranzCross/assets/icon-xmas/[email protected]
Binary file added FranzCross/assets/icon-xmas/icon-14.png
Binary file added FranzCross/assets/icon-xmas/[email protected]
Binary file added FranzCross/assets/icon-xmas/icon-15.png
Binary file added FranzCross/assets/icon-xmas/[email protected]
Binary file added FranzCross/assets/icon-xmas/icon-16.png
Binary file added FranzCross/assets/icon-xmas/[email protected]
Binary file added FranzCross/assets/icon-xmas/icon-17.png
Binary file added FranzCross/assets/icon-xmas/[email protected]
Binary file added FranzCross/assets/icon-xmas/icon-18.png
Binary file added FranzCross/assets/icon-xmas/[email protected]
Binary file added FranzCross/assets/icon-xmas/icon-19.png
Binary file added FranzCross/assets/icon-xmas/[email protected]
Binary file added FranzCross/assets/icon-xmas/icon-20.png
Binary file added FranzCross/assets/icon-xmas/[email protected]
Binary file added FranzCross/assets/icon-xmas/icon-21.png
Binary file added FranzCross/assets/icon-xmas/[email protected]
Binary file added FranzCross/assets/icon-xmas/icon-22.png
Binary file added FranzCross/assets/icon-xmas/[email protected]
Binary file added FranzCross/assets/icon-xmas/icon-23.png
Binary file added FranzCross/assets/icon-xmas/[email protected]
Binary file added FranzCross/assets/icon-xmas/icon-24.png
Binary file added FranzCross/assets/icon-xmas/[email protected]
13 changes: 12 additions & 1 deletion FranzCross/common.rkt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#lang racket/base

(require (prefix-in gui: racket/gui)
(require racket/format
(prefix-in gui: racket/gui)
racket/gui/easy/color
racket/gui/easy/font
racket/runtime-path)
Expand Down Expand Up @@ -93,6 +94,7 @@
code.png
gear.png
icon_512x512.png
icon-xmas
pause.png
play.png
plus.png
Expand All @@ -114,3 +116,12 @@
[play-bmp play.png]
[plus-bmp plus.png]
[viewfinder-ellipsis-bmp viewfinder-ellipsis.png])

(provide
xmas-icon-bmps)

(define xmas-icon-bmps
(for/vector ([i (in-range 25)])
(define path
(build-path icon-xmas (format "icon-~a.png" (~r i #:min-width 2 #:pad-string "0"))))
(gui:read-bitmap #:try-@2x? #t path)))
13 changes: 9 additions & 4 deletions FranzCross/welcome-window.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
(prefix-in p: pict)
racket/gui/easy
racket/gui/easy/operator
racket/math
(prefix-in ~ threading)
"canvas-list.rkt"
"common.rkt"
"mixin.rkt")
"mixin.rkt"
"observable.rkt"
"xmas-icon.rkt")

(provide
welcome-window)
Expand All @@ -25,9 +28,11 @@
(hpanel
(vpanel
#:alignment '(center center)
(image
#:size '(128 128)
icon_512x512.png)
(if xmas?
(xmas-icon)
(image
#:size '(128 128)
icon_512x512.png))
(text
#:font system-font-xl
"Welcome to Franz")
Expand Down
51 changes: 51 additions & 0 deletions FranzCross/xmas-icon.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#lang racket/gui/easy

(require racket/class
racket/math
"common.rkt"
"observable.rkt")

(provide
xmas?
xmas-icon)

(define xmas?
(let ([d (seconds->date (current-seconds))])
(define c (+ (* (date-month d) 100) (date-day d)))
(or (<= c 115)
(>= c 1115))))

(define (xmas-icon)
(define-observables
[@xmas-tick 0])
(define tick-thd
(void
(thread
(lambda ()
(define r (* 2 (/ 1 25.0)))
(define t (current-inexact-monotonic-milliseconds))
(let loop ()
(@xmas-tick:=
(exact-round
(/ (- (current-inexact-monotonic-milliseconds) t)
(* 1000 r))))
(sleep r)
(loop))))))
(add-hooks
#:on-destroy
(lambda ()
(kill-thread tick-thd))
(canvas
@xmas-tick
#:style '(transparent)
#:stretch '(#f #f)
#:min-size '(128 128)
(lambda (dc tick)
(define idx (modulo tick (vector-length xmas-icon-bmps)))
(define bmp (vector-ref xmas-icon-bmps idx))
(send dc draw-bitmap bmp 0 0)))))

(module+ main
(render
(window
(xmas-icon))))

0 comments on commit aae5169

Please sign in to comment.