1-- This file is a part of Avoision.
2--
3-- Copyright (C) 2012 Jared Krinke.
4--
5-- Avoision is free software; you can redistribute it and/or
6-- modify it under the terms of the GNU General Public License
7-- as published by the Free Software Foundation; either version 2
8-- of the License, or (at your option) any later version.
9--
10-- This program is distributed in the hope that it will be useful,
11-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13-- GNU General Public License for more details.
14--
15-- You should have received a copy of the GNU General Public License
16-- along with this program; if not, write to the Free Software
17-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
19require("UI/Input.lua")
20require("UI/FormLayer.lua")
21require("Settings/Controls.lua")
22
23Common = {
24    version = "1.1",
25    textWidth = 15,
26    textHeight = 30,
27}
28
29Form.setDefaultTextSize(Common.textWidth, Common.textHeight)
30
31-- Controls
32Common.logicalEvents = {
33    up = { necessary = true },
34    down = { necessary = true },
35    left = { necessary = true },
36    right = { necessary = true },
37    activate = { necessary = true },
38    delete = { },
39    cancel = { },
40}
41
42Common.input = Input.new(Common.logicalEvents, controlsData)
43FormLayer.setDefaultInput(Common.input)
44
45-- Set up difficulty levels
46Common.difficultyLevelNames = {
47    "Easy",
48    "Normal",
49    "Hard",
50    "Extreme",
51}
52
53Common.difficultyLevel = { }
54
55local v = 1
56while v <= #Common.difficultyLevelNames do
57    Common.difficultyLevel[Common.difficultyLevelNames[v]] = v
58
59    v = v + 1
60end
61
62-- Collision detection
63Common.group = {
64    player  = 1,
65    goal    = 2,
66    enemy   = 3,
67}
68
69Common.playerColor = Color.new(0, 1, 0)
70Common.goalColor   = Color.new(1, 0, 0)
71Common.enemyColor  = Color.new(1, 1, 1)
72
73Common.squareMesh = Mesh.new()
74Common.squareMesh:addTriangle(-0.5, 0.5, -0.5, -0.5, 0.5, 0.5)
75Common.squareMesh:addTriangle(0.5, 0.5, -0.5, -0.5, 0.5, -0.5)
76
77Common.seekerMesh = Mesh.new()
78Common.seekerMesh:addTriangle(0.5, 0, -0.218, 0.5, -0.218, -0.5)
79Common.seekerMesh:addTriangle(-0.218, 0.5, -0.5, 0.5, -0.5, -0.5)
80Common.seekerMesh:addTriangle(-0.218, -0.5, -0.218, 0.5, -0.5, -0.5)
81
82