Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
* lib/shoes.rb: new splash window, opening with the modal file dialo…
Browse files Browse the repository at this point in the history
…g was weird.
  • Loading branch information
_why committed Dec 4, 2008
1 parent 457aef9 commit 79e4258
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 10 deletions.
1 change: 1 addition & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Copyright (c) 2008 why the lucky stiff
Except:
fonts/Coolvetica.ttf (c) 1999 Ray Larabie
fonts/Lacuna.ttf (c) 2003 Glashaus, designed by Peter Hoffman
samples/expert-minesweeper.rb (c) 2008 que
samples/expert-othello.rb (c) 2008 Tieg Zaharia
samples/expert-tankspank.rb (c) 2008 Kevin C.
Expand Down
Binary file added fonts/Lacuna.ttf
Binary file not shown.
60 changes: 51 additions & 9 deletions lib/shoes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,55 @@ def self.show_selector
Shoes.visit(fname) if fname
end

def self.splash
font "#{DIR}/fonts/Lacuna.ttf"
Shoes.app :width => 400, :height => 300, :resizable => false do
style(Para, :align => "center", :weight => "bold", :font => "Lacuna Regular")
style(Link, :stroke => yellow, :underline => nil)
style(LinkHover, :stroke => yellow, :fill => nil)

x1 = 77; y1 = 122
x2 = 148; y2 = -122
x3 = 245; y3 = 0

nofill
strokewidth 40.0

@waves = stack :top => 0, :left => 0

stack :margin => 22 do
para "Welcome to", :stroke => "#DFA", :margin => 0
para "SHOES", :size => 48, :stroke => "#DFA", :margin_top => 0
stack do
background black(0.2), :curve => 8
para link("Open an App.") { Shoes.show_selector and close }, :margin => 12, :margin_bottom => 4
para link("Read the Manual.") { Shoes.show_manual and close }, :margin => 12
end
inscription "Alt-Slash opens the console.", :stroke => "#DFA", :align => "center"
end

animate(10) do |ani|
a = Math.sin(ani * 0.02) * 20
@waves.clear do
background white
y = -30
16.times do |i|
shape do
move_to x = (-300 - (i*(a*0.8))), y
c = (a + 14) * 0.01
stroke rgb(i * 0.06, c + 0.1, 0.1, 1.0 - (ani * 0.0003))
4.times do
curve_to x1 + x, (y1-(i*a)) + y, x2 + x, (y2+(i*a)) + y, x3 + x, y3 + y
x += x3
end
end
y += 30
end
end
end
end
end

def self.make_pack
require 'shoes/pack'
Shoes.app(:width => 500, :height => 380, :resizable => false, &PackMake)
Expand Down Expand Up @@ -296,15 +345,8 @@ def self.run(path)
end

def self.args!
if PLATFORM !~ /darwin/
if ARGV.empty?
fname = ask_open_file
if fname
ARGV << fname
else
return false
end
end
if PLATFORM !~ /darwin/ and ARGV.empty?
Shoes.splash
end
OPTS.parse! ARGV
ARGV[0] or true
Expand Down
2 changes: 1 addition & 1 deletion shoes/native/cocoa.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ - (void)idle: (NSTimer *)t
{
count++;
if (count == 100 && RARRAY_LEN(shoes_world->apps) == 0)
rb_eval_string("Shoes.show_selector");
rb_eval_string("Shoes.splash");
}
rb_eval_string("sleep(0.001)");
}
Expand Down

0 comments on commit 79e4258

Please sign in to comment.