diff --git a/Project.toml b/Project.toml index 5e782a6..b08ddb1 100644 --- a/Project.toml +++ b/Project.toml @@ -7,16 +7,14 @@ version = "0.0.1" Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" Crayons = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" -Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Requires = "ae029012-a4dd-5104-9daa-d747884805df" [compat] Colors = "0.12" -MacroTools = "0.5" Crayons = "4.0" +MacroTools = "0.5" Requires = "1.1" -Makie = "0.11" julia = "1" [extras] diff --git a/README.md b/README.md index 36f5f54..6a18729 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,10 @@ w(TURN_LEFT) w(TURN_RIGHT) # play interactively with Makie. +# you need to manually install Makie with the following command first +# ] add Makie # first time plot may be slow +using Makie play(w;file_name="example.gif",frame_rate=5) ``` diff --git a/src/GridWorlds.jl b/src/GridWorlds.jl index 8d533f9..b9986c6 100644 --- a/src/GridWorlds.jl +++ b/src/GridWorlds.jl @@ -13,9 +13,8 @@ include("abstract_grid_world.jl") include("envs/envs.jl") include("render_in_terminal.jl") -# function __init__() -# @require Makie="ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" include("render_with_Makie.jl") -# end -include("render_with_Makie.jl") +function __init__() + @require Makie="ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" include("render_with_Makie.jl") +end end diff --git a/src/render_with_Makie.jl b/src/render_with_Makie.jl index 3b16b51..fd9e8a6 100644 --- a/src/render_with_Makie.jl +++ b/src/render_with_Makie.jl @@ -5,7 +5,7 @@ using Colors # coordinate transform for Makie.jl transform(x::Int) = p -> CartesianIndex(p[2], x-p[1]+1) -using Makie +using .Makie function init_screen(w::Observable{<:AbstractGridWorld}; resolution=(1000,1000)) scene = Scene(resolution = resolution, raw = true, camera = campixel!)