closing a window now kiiiinda works

This commit is contained in:
Eric S. Londres 2022-08-15 21:53:14 -04:00
parent 23182d7c10
commit 0fa428277c
Signed by: slondr
GPG Key ID: A2D25B4D5CB970E4
2 changed files with 25 additions and 33 deletions

View File

@ -10,18 +10,11 @@ config :beepboop, :viewport, [
drivers: [
[
module: Scenic.Driver.Local,
name: :local
# opts: [resizeable: true, title: "beepboop"]
name: :local,
window: [title: "hello", resizeable: true],
on_close: :stop_system
]
]
]
config :scenic, :assets, module: Beepboop.Assets
# It is also possible to import configuration files, relative to this
# directory. For example, you can emulate configuration per environment
# by uncommenting the line below and defining dev.exs, test.exs and such.
# Configuration from the imported file will override the ones defined
# here (which is why it is important to import them last).
#
# import_config "prod.exs"

View File

@ -3,42 +3,41 @@ defmodule Beepboop.Scene.Home do
require Logger
# alias Scenic.Graph
# alias Scenic.ViewPort
import Scenic.Primitives
import Scenic.Components
import Scenic.Graph
# ============================================================================
# setup
alias Scenic.Graph
# --------------------------------------------------------
@graph Graph.build(font: :roboto)
|> text("status text", id: :text, translate: {20, 80})
|> button("OK", id: :push_me, translate: {20, 180})
@impl Scenic.Scene
def init(scene, _params, _opts) do
graph = Scenic.Graph.build(font: :roboto)
|> text("Hello worl", id: :text)
|> button("OK", id: :push_me)
scene = assign(scene, some_state: 123, graph: graph)
|> push_graph(graph)
{:ok, scene}
{:ok, push_graph(assign(scene, some_state: 123, graph: @graph), @graph)}
end
# display any received events
@impl Scenic.Scene
def handle_event(event, _, %{assigns: %{graph: graph}} = scene) do
IO.puts inspect event
graph = Scenic.Graph.modify( graph, :text, &text(&1, inspect(event)))
graph = Graph.modify(graph, :text, &text(&1, inspect(event)))
scene =
scene
|> assign( graph: graph )
|> push_graph( graph )
scene = assign(scene, graph: graph )
|> push_graph(graph)
{:noreply, scene}
end
# display any received input
@impl Scenic.Scene
def handle_input({event_type, _event_details} = input_event, hit_id, scene) do
Logger.info inspect input_event
Logger.info inspect hit_id
Logger.info "\n"
:ok = capture_input(scene, event_type)
{:noreply, scene}
end
end