Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added game_include to allow for the inclusion of other files. #22

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion example/BasicGame/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function update(g::Game)
dx = 2
end


end

# If the "space" key is pressed, change the displayed image to the "hurt" variant.
Expand Down
7 changes: 5 additions & 2 deletions src/GameZero.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Colors
using Random

export Actor, Game, game, draw, schduler, schedule_once, schedule_interval, schedule_unique, unschedule,
collide, angle, distance, play_music, play_sound, line, clear, rungame
collide, angle, distance, play_music, play_sound, line, clear, rungame, game_include
export Keys, MouseButtons, KeyMods
export Line, Rect, Circle

Expand Down Expand Up @@ -74,6 +74,7 @@ end

getifdefined(m, s, v) = isdefined(m, s) ? getfield(m, s) : v


mainloop(g::Ref{Game}) = mainloop(g[])

function mainloop(g::Game)
Expand Down Expand Up @@ -224,7 +225,9 @@ function initgame(jlf::String)
g.screen = initscreen(game_module, "GameZero::"*name)
clear(g.screen)
return g
end
end

game_include(jlf::String) = Base.include(game[].game_module, jlf)


function getfn(m::Module, s::Symbol, maxargs=3)
Expand Down