Skip to content

Commit 46872e8

Browse files
committed
Started working on ISteamInput support
1 parent 6cef0ee commit 46872e8

File tree

12 files changed

+747
-216
lines changed

12 files changed

+747
-216
lines changed

examples/examples.collection

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,22 @@ embedded_instances {
214214
"}\n"
215215
""
216216
}
217+
embedded_instances {
218+
id: "input"
219+
data: "components {\n"
220+
" id: \"screen_proxy\"\n"
221+
" component: \"/monarch/screen_proxy.script\"\n"
222+
" properties {\n"
223+
" id: \"screen_id\"\n"
224+
" value: \"input\"\n"
225+
" type: PROPERTY_TYPE_HASH\n"
226+
" }\n"
227+
"}\n"
228+
"embedded_components {\n"
229+
" id: \"collectionproxy\"\n"
230+
" type: \"collectionproxy\"\n"
231+
" data: \"collection: \\\"/examples/input/input.collection\\\"\\n"
232+
"\"\n"
233+
"}\n"
234+
""
235+
}

examples/input/input.collection

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: "input"
2+
scale_along_z: 0
3+
embedded_instances {
4+
id: "go"
5+
data: "components {\n"
6+
" id: \"input\"\n"
7+
" component: \"/examples/input/input.gui\"\n"
8+
"}\n"
9+
""
10+
}

examples/input/input.gui

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
script: "/examples/input/input.gui_script"
2+
fonts {
3+
name: "rpg"
4+
font: "/gooey-rpg/fonts/rpg.font"
5+
}
6+
textures {
7+
name: "rpg"
8+
texture: "/gooey-rpg/images/rpg.atlas"
9+
}
10+
nodes {
11+
position {
12+
x: 163.0
13+
y: 448.0
14+
}
15+
size {
16+
x: 300.0
17+
y: 400.0
18+
}
19+
type: TYPE_BOX
20+
texture: "rpg/panel_blue"
21+
id: "controllerspanel"
22+
inherit_alpha: true
23+
slice9 {
24+
x: 24.0
25+
y: 24.0
26+
z: 24.0
27+
w: 24.0
28+
}
29+
}
30+
nodes {
31+
position {
32+
x: -136.0
33+
y: 188.0
34+
}
35+
size {
36+
x: 200.0
37+
y: 100.0
38+
}
39+
type: TYPE_TEXT
40+
text: "<text>"
41+
font: "rpg"
42+
id: "controllersinfo"
43+
pivot: PIVOT_NW
44+
outline {
45+
x: 1.0
46+
y: 1.0
47+
z: 1.0
48+
}
49+
shadow {
50+
x: 1.0
51+
y: 1.0
52+
z: 1.0
53+
}
54+
parent: "controllerspanel"
55+
inherit_alpha: true
56+
}
57+
nodes {
58+
position {
59+
x: 112.0
60+
y: 683.0
61+
}
62+
type: TYPE_TEMPLATE
63+
id: "back"
64+
inherit_alpha: true
65+
template: "/gooey-rpg/components/button.gui"
66+
}
67+
nodes {
68+
type: TYPE_BOX
69+
id: "back/bg"
70+
parent: "back"
71+
template_node_child: true
72+
}
73+
nodes {
74+
type: TYPE_TEXT
75+
text: "< BACK"
76+
id: "back/label"
77+
parent: "back/bg"
78+
overridden_fields: 8
79+
template_node_child: true
80+
}
81+
nodes {
82+
position {
83+
x: 443.0
84+
y: 622.0
85+
}
86+
type: TYPE_TEMPLATE
87+
id: "button"
88+
inherit_alpha: true
89+
template: "/gooey-rpg/components/button.gui"
90+
}
91+
nodes {
92+
type: TYPE_BOX
93+
id: "button/bg"
94+
parent: "button"
95+
template_node_child: true
96+
}
97+
nodes {
98+
type: TYPE_TEXT
99+
text: "KABOOM"
100+
id: "button/label"
101+
parent: "button/bg"
102+
overridden_fields: 8
103+
template_node_child: true
104+
}
105+
layers {
106+
name: "below"
107+
}
108+
layers {
109+
name: "text"
110+
}
111+
material: "/builtins/materials/gui.material"
112+
adjust_reference: ADJUST_REFERENCE_PARENT

examples/input/input.gui_script

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
local rpg = require "gooey-rpg.rpg"
2+
local monarch = require "monarch.monarch"
3+
4+
function init(self)
5+
msg.post(".", "acquire_input_focus")
6+
7+
local status, error = steam.init()
8+
if not status then print("Error: " .. error) return end
9+
10+
steam.set_listener(function(self, e, t)
11+
print(e)
12+
pprint(t)
13+
end)
14+
15+
steam.input_get_connected_controllers()
16+
end
17+
18+
function final(self)
19+
steam.final()
20+
end
21+
22+
function update(self, dt)
23+
steam.update()
24+
end
25+
26+
function on_input(self, action_id, action)
27+
rpg.button("back", action_id, action, function()
28+
monarch.back()
29+
end)
30+
end

examples/menu/menu.gui

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,30 @@ nodes {
244244
overridden_fields: 8
245245
template_node_child: true
246246
}
247+
nodes {
248+
position {
249+
x: 1087.0
250+
y: 280.0
251+
}
252+
type: TYPE_TEMPLATE
253+
id: "input"
254+
inherit_alpha: true
255+
template: "/gooey-rpg/components/button.gui"
256+
}
257+
nodes {
258+
type: TYPE_BOX
259+
id: "input/bg"
260+
parent: "input"
261+
template_node_child: true
262+
}
263+
nodes {
264+
type: TYPE_TEXT
265+
text: "INPUT"
266+
id: "input/label"
267+
parent: "input/bg"
268+
overridden_fields: 8
269+
template_node_child: true
270+
}
247271
layers {
248272
name: "below"
249273
}

examples/menu/menu.gui_script

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ function on_input(self, action_id, action)
5252
print("Not implemented")
5353
--monarch.show("inventory")
5454
end)
55+
rpg.button("input", action_id, action, function()
56+
monarch.show("input")
57+
end)
5558
end
5659

5760
function on_reload(self)

game.project

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ include_dirs = steam
2828
[collection_proxy]
2929
max_count = 16
3030

31+
[steam]
32+
use_steam_input = 1
33+

0 commit comments

Comments
 (0)