Skip to content

Commit

Permalink
Merge in master
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleconroy committed Sep 5, 2012
2 parents 079154b + d86995b commit ca1ab57
Show file tree
Hide file tree
Showing 37 changed files with 239 additions and 232 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ build
.DS_Store
.*
full_soundtrack.ogg
hawkthorne
win32/*
win64/*
osx/love.app
redditors.txt
src/main.lua
src/maps/*.lua
venv
48 changes: 31 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: love osx clean contributors maps
.PHONY: love osx clean contributors win32 win64 maps

current_version = $(shell python scripts/version.py current)
next_version = $(shell python scripts/version.py next)
Expand All @@ -12,16 +12,24 @@ love: maps

maps: $(patsubst %.tmx,%.lua,$(wildcard src/maps/*.tmx))

osx: love
cp -r /Applications/love.app Journey\ to\ the\ Center\ of\ Hawkthorne.app
src/maps/%.lua: src/maps/%.tmx
tmx2lua $<

osx: love osx/love.app
cp -r osx/love.app Journey\ to\ the\ Center\ of\ Hawkthorne.app
cp build/hawkthorne.love Journey\ to\ the\ Center\ of\ Hawkthorne.app/Contents/Resources
cp osx/Hawkthorne.icns Journey\ to\ the\ Center\ of\ Hawkthorne.app/Contents/Resources/Love.icns
zip -r hawkthorne-osx Journey\ to\ the\ Center\ of\ Hawkthorne.app
mv hawkthorne-osx.zip build
rm -rf Journey\ to\ the\ Center\ of\ Hawkthorne.app

win: win32 win64
osx/love.app:
wget https://bitbucket.org/rude/love/downloads/love-0.8.0-macosx-ub.zip
unzip love-0.8.0-macosx-ub.zip
rm love-0.8.0-macosx-ub.zip
mv love.app osx

win: win32/love.exe win32 win64

win32: love
rm -rf hawkthorne
Expand All @@ -31,6 +39,11 @@ win32: love
zip -r hawkthorne-win-x86 hawkthorne -x "*/love.exe"
mv hawkthorne-win-x86.zip build

win32/love.exe:
wget https://github.com/downloads/kyleconroy/hawkthorne-journey/windows-build-files.zip
unzip windows-build-files.zip
rm windows-build-files.zip

win64: love
rm -rf hawkthorne
rm -f hawkthorne-win-x64.zip
Expand All @@ -39,11 +52,11 @@ win64: love
zip -r hawkthorne-win-x64 hawkthorne -x "*/love.exe"
mv hawkthorne-win-x64.zip build

upload: osx win
python scripts/upload.py build/hawkthorne.love
python scripts/upload.py build/hawkthorne-osx.zip
python scripts/upload.py build/hawkthorne-win-x86.zip
python scripts/upload.py build/hawkthorne-win-x64.zip
upload: osx win venv
venv/bin/python scripts/upload.py build/hawkthorne.love
venv/bin/python scripts/upload.py build/hawkthorne-osx.zip
venv/bin/python scripts/upload.py build/hawkthorne-win-x86.zip
venv/bin/python scripts/upload.py build/hawkthorne-win-x64.zip

tag:
sed -i '' 's/$(current_version)/$(next_version)/g' src/conf.lua
Expand All @@ -55,19 +68,20 @@ tag:

deploy: tag upload post

post:
python scripts/post.py $(previous_version) $(current_version)
post: venv
venv/bin/python scripts/post.py $(previous_version) $(current_version)

contributors:
python scripts/clean.py > CONTRIBUTORS
python scripts/credits.py > src/credits.lua
venv:
virtualenv --python=python2.7 venv
venv/bin/pip install -r requirements.txt

contributors: venv
venv/bin/python scripts/clean.py > CONTRIBUTORS
venv/bin/python scripts/credits.py > src/credits.lua

test:
cp src/main_testing.lua src/main.lua

src/maps/%.lua: src/maps/%.tmx
tmx2lua $<

clean:
rm -rf build
rm -rf Journey\ to\ the\ Center\ of\ Hawkthorne.app
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tweepy
requests
jinja2
26 changes: 18 additions & 8 deletions scripts/post.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import os
from datetime import datetime
import argparse
import requests
import jinja2
import json
import time
import tweepy
import subprocess


class Reddit(object):
Expand Down Expand Up @@ -44,9 +46,10 @@ def submit(self, subreddit, title, text='', auth=None):
return resp


url = ("https://api.github.com/repos/kyleconroy/"
"hawkthorne-journey/compare/{}...{}")
pulls_url = "https://api.github.com/repos/kyleconroy/hawkthorne-journey/pulls"
issues_url = "https://api.github.com/repos/kyleconroy/hawkthorne-journey/issues"
tag_url = "https://api.github.com/repos/kyleconroy/hawkthorne-journey/git/tags/{}"
GITHUB_TIME = "%Y-%m-%dT%H:%M:%SZ"

title = "[RELEASE] Journey to the Center of Hawkthorne {}"

Expand Down Expand Up @@ -75,20 +78,27 @@ def update_twitter(version, api_response):

def post_content(base, head):

diff = requests.get(url.format(base, head)).json
sha = subprocess.check_output(["git", "show-ref", base]).split(" ")[0]

template = jinja2.Template(open('templates/post.md').read())
tag = requests.get(tag_url.format(sha)).json

# Just pretend the date is UTC.
tag_date = datetime.strptime(tag['tagger']['date'].rsplit('-', 1)[0] + 'Z', GITHUB_TIME)

for commit in diff['commits']:
commit['commit']['message'] = commit['commit']['message'].replace("\n\n", "\n\n ")
new_features = []

diff = json.loads(requests.get(url.format(base, head)).text)
for pull_request in requests.get(pulls_url, params={'state': 'closed'}).json:
if not pull_request['merged_at']:
continue
if datetime.strptime(pull_request['merged_at'], GITHUB_TIME) > tag_date:
new_features.append(pull_request)

template = jinja2.Template(open('templates/post.md').read())

bugs = requests.get(issues_url, params={'labels': 'bug'}).json
features = requests.get(issues_url, params={'labels': 'enhancement'}).json

return template.render(commits=diff['commits'], version=head,
return template.render(new_features=new_features, version=head,
bugs=bugs, features=features)


Expand Down
4 changes: 1 addition & 3 deletions scripts/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
downloads_url = "https://api.github.com/repos/{user}/{repo}/downloads".format(
user="kyleconroy", repo="hawkthorne-journey")

github = json.load(open(os.path.expanduser("~/.githubrc")))

auth = ("kyleconroy", github['password'])
auth = ("kyleconroy", os.environ['GITHUB_PASSWORD'])

parser = argparse.ArgumentParser(description="Upload files to Github")
parser.add_argument("path", help="File to upload")
Expand Down
Binary file added src/audio/sfx/unreveal.ogg
Binary file not shown.
4 changes: 4 additions & 0 deletions src/blackjackgame.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local Gamestate = require 'vendor/gamestate'
local anim8 = require 'vendor/anim8'
local window = require 'window'
local fonts = require 'fonts'
local timer = require 'vendor/timer'
local Prompt = require 'prompt'
local Dialog = require 'dialog'
Expand Down Expand Up @@ -68,6 +69,8 @@ end
function state:enter(previous, screenshot)
sound.playMusic( "tavern" )

fonts.set( 'big' )

self.previous = previous
self.screenshot = screenshot

Expand All @@ -88,6 +91,7 @@ function state:enter(previous, screenshot)
end

function state:leave()
fonts.reset()
camera.x = self.camera_x
end

Expand Down
20 changes: 3 additions & 17 deletions src/cheatscreen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local window = require 'window'
local camera = require 'camera'
local Timer = require 'vendor/timer'
local sound = require 'vendor/TEsound'
local fonts = require 'fonts'
local state = Gamestate.new()
local cheat = require 'cheat'

Expand Down Expand Up @@ -41,30 +42,15 @@ function state:enter( previous, real_previous )

sound.playMusic( "daybreak" )

self.orig_font = love.graphics.getFont()

local courier = love.graphics.newImage( "courierfont.png" )
courier:setFilter('nearest', 'nearest')

love.graphics.setFont(
love.graphics.newImageFont(
courier,
" abcdefghijklmnopqrstuvwxyz" ..
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0" ..
"123456789.,!?-+/\\:;%&`'*#=\"$<>" ..
"\225\236\243\250\241\191\161\233\252",
--á í ó ú ñ ¿ ¡ é ü
12
)
)
fonts.set( 'courier' )

camera:setPosition(0, 0)
self.previous = real_previous

end

function state:leave()
love.graphics.setFont( self.orig_font )
fonts:reset()
end

function state:exit()
Expand Down
3 changes: 3 additions & 0 deletions src/credits.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local Gamestate = require 'vendor/gamestate'
local window = require 'window'
local fonts = require 'fonts'
local camera = require 'camera'
local sound = require 'vendor/TEsound'
local state = Gamestate.new()
Expand All @@ -8,6 +9,7 @@ function state:init()
end

function state:enter(previous)
fonts.set( 'big' )
love.graphics.setBackgroundColor(0, 0, 0)
sound.playMusic( "credits" )
self.ty = 0
Expand All @@ -16,6 +18,7 @@ function state:enter(previous)
end

function state:leave()
fonts.reset()
end

function state:update(dt)
Expand Down
6 changes: 1 addition & 5 deletions src/dialog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ function Dialog:draw(x, y)
if self.board.state == 'closed' then
return
end

local oldFont = love.graphics.getFont()
love.graphics.setFont(window.font)


self.board:draw(x, y)

if self.board.state == 'opened' then
Expand All @@ -53,7 +50,6 @@ function Dialog:draw(x, y)
end

love.graphics.setColor(255, 255, 255)
love.graphics.setFont(oldFont)
end

function Dialog:keypressed(key)
Expand Down
40 changes: 40 additions & 0 deletions src/fonts.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
local fonts = { 'arial', 'courier', 'big' }

local glyphs = " abcdefghijklmnopqrstuvwxyz" ..
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0" ..
"123456789.,!?-+/\\:;%&`'*#=\"$<>" ..
"\225\236\243\250\241\191\161\233\252"
-- á í ó ú ñ ¿ ¡ é ü

local Fonts = {
_default = 'arial',
_last = nil
}

for _,x in pairs( fonts ) do
local img = love.graphics.newImage( "fonts/" .. x .. ".png" )
img:setFilter( 'nearest', 'nearest' )
Fonts[x] = love.graphics.newImageFont( img, glyphs )
end

function Fonts.set( x )
Fonts._last = love.graphics.getFont()
if Fonts[x] then
love.graphics.setFont( Fonts[x] )
else
love.graphics.setFont( Fonts[Fonts._default] )
end
end

function Fonts.reset()
Fonts._last = Fonts[Fonts._default]
love.graphics.setFont( Fonts[Fonts._default] )
end

function Fonts.revert()
love.graphics.setFont( Fonts._last )
end

Fonts.reset()

return Fonts
Binary file renamed src/arialfont.png → src/fonts/arial.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 renamed src/imagefont.png → src/fonts/big.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
3 changes: 3 additions & 0 deletions src/instructions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local Gamestate = require 'vendor/gamestate'
local window = require 'window'
local camera = require 'camera'
local sound = require 'vendor/TEsound'
local fonts = require 'fonts'
local state = Gamestate.new()


Expand All @@ -26,13 +27,15 @@ function state:init()
end

function state:enter(previous)
fonts.set( 'big' )
sound.playMusic( "daybreak" )

camera:setPosition(0, 0)
self.previous = previous
end

function state:leave()
fonts.reset()
end

function state:keypressed(key)
Expand Down
13 changes: 3 additions & 10 deletions src/loader.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local Gamestate = require 'vendor/gamestate'
local Level = require 'level'
local window = require 'window'
local fonts = require 'fonts'
local state = Gamestate.new()

local home = require 'menu'
Expand All @@ -10,6 +11,8 @@ function state:init()
state.finished = false
state.current = 1
state.assets = {}

fonts.set( 'big' )

table.insert(state.assets, function()
Gamestate.load('valley', Level.new('valley'))
Expand Down Expand Up @@ -160,16 +163,6 @@ function state:init()
Gamestate.load('blackjackgame', require 'blackjackgame')
end)

table.insert(state.assets, function()
local font = love.graphics.newImage("imagefont.png")
font:setFilter('nearest', 'nearest')

love.graphics.setFont(love.graphics.newImageFont(font,
" abcdefghijklmnopqrstuvwxyz" ..
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0" ..
"123456789.,!?-+/:;%&`'*#=\"$"), 35)
end)

state.step = 240 / # self.assets
end

Expand Down
Loading

0 comments on commit ca1ab57

Please sign in to comment.