Skip to content

Commit

Permalink
run formatter and add a squiggly line
Browse files Browse the repository at this point in the history
  • Loading branch information
Ju Liu committed Mar 3, 2019
0 parents commit 63b27a8
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# The directory Mix will write compiled artifacts to.
/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover/

# The directory Mix downloads your dependencies sources to.
/deps/

# Where 3rd-party dependencies like ExDoc output generated docs.
/doc/

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# Ignore package tarball (built via "mix hex.build").
foo-*.tar


# Ignore scripts marked as secret - usually passwords and such in config files
*.secret.exs
*.secrets.exs
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Readme text goes here


From template
25 changes: 25 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config

# Configure the main viewport for the Scenic application
config :scenic_escher, :viewport, %{
name: :main_viewport,
size: {700, 600},
default_scene: {ScenicEscher.Scene.Home, nil},
drivers: [
%{
module: Scenic.Driver.Glfw,
name: :glfw,
opts: [resizeable: false, title: "scenic_escher"]
}
]
}

# 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"
47 changes: 47 additions & 0 deletions lib/scenes/home.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
defmodule ScenicEscher.Scene.Home do
use Scenic.Scene

alias Scenic.Graph

import Scenic.Primitives
# import Scenic.Components

@note """
This is a very simple starter application.
If you want a more full-on example, please start from:
mix scenic.new.example
"""

@graph Graph.build(font: :roboto, font_size: 24)
|> group(
fn g ->
g
|> text(@note, translate: {20, 60})
|> path(
[
:begin,
{:move_to, 0, 0},
{:bezier_to, 0, 20, 0, 50, 40, 50},
{:bezier_to, 60, 50, 60, 20, 80, 20},
{:bezier_to, 100, 20, 110, 0, 120, 0},
{:bezier_to, 140, 0, 160, 30, 160, 50}
],
stroke: {2, :red},
translate: {355, 230},
rotate: 0.5
)
end,
translate: {15, 20}
)

# ============================================================================
# setup

# --------------------------------------------------------
def init(_, _) do
push_graph(@graph)
{:ok, @graph}
end
end
17 changes: 17 additions & 0 deletions lib/scenic_escher.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
defmodule ScenicEscher do
@moduledoc """
Starter application using the Scenic framework.
"""

def start(_type, _args) do
# load the viewport configuration from config
main_viewport_config = Application.get_env(:scenic_escher, :viewport)

# start the application with the viewport
children = [
{Scenic, viewports: [main_viewport_config]}
]

Supervisor.start_link(children, strategy: :one_for_one)
end
end
30 changes: 30 additions & 0 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
defmodule ScenicEscher.MixProject do
use Mix.Project

def project do
[
app: :scenic_escher,
version: "0.1.0",
elixir: "~> 1.7",
build_embedded: true,
start_permanent: Mix.env() == :prod,
deps: deps()
]
end

# Run "mix help compile.app" to learn about applications.
def application do
[
mod: {ScenicEscher, []},
extra_applications: []
]
end

# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:scenic, "~> 0.9"},
{:scenic_driver_glfw, "~> 0.9", targets: :host}
]
end
end
5 changes: 5 additions & 0 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%{
"elixir_make": {:hex, :elixir_make, "0.5.2", "96a28c79f5b8d34879cd95ebc04d2a0d678cfbbd3e74c43cb63a76adf0ee8054", [:mix], [], "hexpm"},
"scenic": {:hex, :scenic, "0.9.0", "129594f918b4e2dd97465b95b4fb3582294ac6bb3e931f12edd09913743964eb", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"},
"scenic_driver_glfw": {:hex, :scenic_driver_glfw, "0.9.1", "b64d345929007186c6b2ca603aec21b1fdde758d3eb32f8467a236e58ccd6a19", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:scenic, "~> 0.9", [hex: :scenic, repo: "hexpm", optional: false]}], "hexpm"},
}

0 comments on commit 63b27a8

Please sign in to comment.