first steps to change overlay and savegames

This commit is contained in:
fanyx 2021-01-04 19:56:49 +01:00
parent d15fcd7583
commit a06f947c39
3 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,15 @@
defmodule YathEx.Data.Savegame do
def list_saves do
Path.wildcard("savegame/*.sav")
|> Enum.map(fn save ->
String.replace(save,"savegame\/","")
end)
end
def mk_save_dir do
if not File.exists?("savegame") do
File.mkdir("savegame")
end
end
end

17
lib/yath_ex/update.ex Normal file
View File

@ -0,0 +1,17 @@
defmodule YathEx.Update do
alias YathEx.Data.Savegame
def change_view(model, :savegame) do
data = Savegame.list_saves()
%{model | data: data}
end
def change_view(model, view_id) do
end
def set_overlay(model, id) do
%{model | overlay: id}
end
end

View File

@ -0,0 +1,8 @@
defmodule YathEx.Views.Menu do
import Ratatouille.View
def render do
bar()
end
end