Skip to content

Commit e353cd6

Browse files
committed
Adds flash game serving.
1 parent 1a7c9c1 commit e353cd6

File tree

13 files changed

+152
-1
lines changed

13 files changed

+152
-1
lines changed

competitions/osgcc_6.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ <h2 class='game'>Monastery</h2>
3737
<li class='screenshot'><a class='popup' href='/images/osgcc_6/monastery_2.png'><img src='/thumbs/osgcc_6/monastery_2.png'></a></li>
3838
</ul>
3939
<ul class='links'>
40+
<li class='link'>
41+
<a href='/games/osgcc_6-monastery.html'>play</a>
42+
</li>
4043
<li class='link'>
4144
<a href='http://github.com/osgcc/osgcc6-Monastery'>source</a>
4245
</li>
@@ -63,6 +66,9 @@ <h2 class='game'>Spectrum</h2>
6366
<li class='screenshot'><a class='popup' href='/images/osgcc_6/spectrum_2.png'><img src='/thumbs/osgcc_6/spectrum_2.png'></a></li>
6467
</ul>
6568
<ul class='links'>
69+
<li class='link'>
70+
<a href='/games/osgcc_6-spectrum.html'>play</a>
71+
</li>
6672
<li class='link'>
6773
<a href='http://github.com/osgcc/osgcc6-Spectrum'>source</a>
6874
</li>

competitions/osgcc_6.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ games:
55
participants: ["Andrea Della Corte, Rob Filippi, Mike Minella"]
66
languages: [ActionScript, HaXe]
77
slug: monastery
8+
flash: monastery
89
summary: "In this game you are the chef of the Monastery, a huge spaceship where food is running scarce!
910
But, when everything seemed lost, the Monastery landed on a wonderful planet full of vegetables! Bad thing is... The plants on this planet walk and are invading your space kitchen!!
1011
Can you restore the botanic order by bringing the invaders to the cooking hearth and keeping your comrades from starvation? WASD to move."
@@ -17,6 +18,7 @@ games:
1718
and the skeletal X-Ray. This is a very challenging Boss Battler designed with appropriately colorful
1819
original graphics done in a Zelda-like style. Arrow keys to move, Z to swing the light sword."
1920
languages: [ActionScript, HaXe]
21+
flash: spectrum
2022
slug: spectrum
2123
source: http://github.com/osgcc/osgcc6-Spectrum
2224
about: http://github.com/osgcc/osgcc6-Spectrum/blob/master/README

config.ru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use Rack::Static,
2-
:urls => ["/images", "/thumbs", "/js", "/css", "/competitions", "/"],
2+
:urls => ["/images", "/thumbs", "/js", "/css", "/competitions", "/", "/games"],
33
:root => "."
44

55
run lambda { |env|

flash/expressInstall.swf

773 Bytes
Binary file not shown.

games/monastery.swf

11.4 MB
Binary file not shown.

games/osgcc_6-monastery.html

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<link href='/css/reset.css' rel='stylesheet' type='text/css'>
5+
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600' rel='stylesheet' type='text/css'>
6+
<link href='/css/main.css' rel='stylesheet' type='text/css'>
7+
<link href='/css/magnific-popup.css' rel='stylesheet' type='text/css'>
8+
<title>
9+
Open Source Game Coding Competition
10+
</title>
11+
</head>
12+
<body>
13+
<nav>
14+
<ul class='navbar'>
15+
<li>
16+
<a href='/index.html'>Home</a>
17+
</li>
18+
<li>
19+
<a href='/competitions.html'>Competitions</a>
20+
</li>
21+
<li>
22+
<a href='/resources.html'>Resources</a>
23+
</li>
24+
</ul>
25+
</nav>
26+
<input id='game-name' type='hidden' value='Monastery'>
27+
<input id='game-slug' type='hidden' value='monastery'>
28+
<script src='/js/swfobject.js' type='text/javascript'></script>
29+
<script src='/js/flash.js' type='text/javascript'></script>
30+
<section class='game'>
31+
<h1>Monastery</h1>
32+
<div id='alt-content'>
33+
<a href='http://www.adobe.com/go/getflashplayer'>
34+
Requires Flash
35+
</a>
36+
</div>
37+
</section>
38+
<script src='/js/jquery.js' type='text/javascript'></script>
39+
<script src='/js/jquery.magnific-popup.min.js' type='text/javascript'></script>
40+
<script src='/js/app.js' type='text/javascript'></script>
41+
</body>
42+
</html>

games/osgcc_6-spectrum.html

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<link href='/css/reset.css' rel='stylesheet' type='text/css'>
5+
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600' rel='stylesheet' type='text/css'>
6+
<link href='/css/main.css' rel='stylesheet' type='text/css'>
7+
<link href='/css/magnific-popup.css' rel='stylesheet' type='text/css'>
8+
<title>
9+
Open Source Game Coding Competition
10+
</title>
11+
</head>
12+
<body>
13+
<nav>
14+
<ul class='navbar'>
15+
<li>
16+
<a href='/index.html'>Home</a>
17+
</li>
18+
<li>
19+
<a href='/competitions.html'>Competitions</a>
20+
</li>
21+
<li>
22+
<a href='/resources.html'>Resources</a>
23+
</li>
24+
</ul>
25+
</nav>
26+
<input id='game-name' type='hidden' value='Spectrum'>
27+
<input id='game-slug' type='hidden' value='spectrum'>
28+
<script src='/js/swfobject.js' type='text/javascript'></script>
29+
<script src='/js/flash.js' type='text/javascript'></script>
30+
<section class='game'>
31+
<h1>Spectrum</h1>
32+
<div id='alt-content'>
33+
<a href='http://www.adobe.com/go/getflashplayer'>
34+
Requires Flash
35+
</a>
36+
</div>
37+
</section>
38+
<script src='/js/jquery.js' type='text/javascript'></script>
39+
<script src='/js/jquery.magnific-popup.min.js' type='text/javascript'></script>
40+
<script src='/js/app.js' type='text/javascript'></script>
41+
</body>
42+
</html>

games/spectrum.swf

4.3 MB
Binary file not shown.

generate_game.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
require 'tilt'
2+
require 'yaml'
3+
4+
competition = "competitions/#{ARGV[0]}.yml"
5+
game = ARGV[1]
6+
7+
competition = YAML::load_file(competition)
8+
9+
game = competition["games"].select {|x| x["slug"] == game }.first
10+
11+
p game
12+
13+
layout = Tilt.new('layout/base.haml')
14+
15+
output = layout.render do
16+
renderer = Tilt.new('layout/game.haml')
17+
renderer.render self, :game => game
18+
end
19+
20+
File.open("games/#{competition["slug"]}-#{game["slug"]}.html", "w+b") do |f|
21+
f.write output
22+
end
23+

js/flash.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var flashvars = {
2+
};
3+
var params = {
4+
menu: "false",
5+
scale: "noScale",
6+
allowFullscreen: "true",
7+
allowScriptAccess: "always",
8+
bgcolor: "",
9+
wmode: "direct" // can cause issues with FP settings & webcam
10+
};
11+
var attributes = {
12+
id:"Monastery"
13+
};
14+
var game_name = document.getElementById('game-name').value;
15+
var game_slug = document.getElementById('game-slug').value;
16+
swfobject.embedSWF(
17+
"/games/" + game_slug + ".swf",
18+
"alt-content", "800px", "600px", "10.0.0",
19+
"/flash/expressInstall.swf",
20+
flashvars, params, attributes);

js/swfobject.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

layout/competition.haml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
- unless has_images
2020
No Screenshots Available
2121
%ul.links
22+
- if game["flash"]
23+
%li.link
24+
%a{:href => "/games/#{competition["slug"]}-#{game["slug"]}.html"} play
2225
- if game["source"]
2326
%li.link
2427
%a{:href => game["source"]} source

layout/game.haml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
%input#game-name{:type => "hidden", :value => game["name"]}
2+
%input#game-slug{:type => "hidden", :value => game["slug"]}
3+
%script{:type => "text/javascript", :src => "/js/swfobject.js"}
4+
%script{:type => "text/javascript", :src => "/js/flash.js"}
5+
%section.game
6+
%h1 #{game["name"]}
7+
#alt-content
8+
%a{:href => "http://www.adobe.com/go/getflashplayer"}
9+
Requires Flash

0 commit comments

Comments
 (0)