new example based on dirtylarry
parent
3d3a3521df
commit
065254d2a4
Binary file not shown.
Before Width: | Height: | Size: 1017 B |
|
@ -1,6 +0,0 @@
|
||||||
images {
|
|
||||||
image: "/example/defold-icon.png"
|
|
||||||
}
|
|
||||||
margin: 0
|
|
||||||
extrude_borders: 0
|
|
||||||
inner_padding: 0
|
|
|
@ -3,8 +3,8 @@ scale_along_z: 0
|
||||||
embedded_instances {
|
embedded_instances {
|
||||||
id: "go"
|
id: "go"
|
||||||
data: "components {\n"
|
data: "components {\n"
|
||||||
" id: \"script\"\n"
|
" id: \"gui\"\n"
|
||||||
" component: \"/example/example.script\"\n"
|
" component: \"/example/example.gui\"\n"
|
||||||
" position {\n"
|
" position {\n"
|
||||||
" x: 0.0\n"
|
" x: 0.0\n"
|
||||||
" y: 0.0\n"
|
" y: 0.0\n"
|
||||||
|
@ -35,43 +35,3 @@ embedded_instances {
|
||||||
z: 1.0
|
z: 1.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
embedded_instances {
|
|
||||||
id: "icon"
|
|
||||||
data: "embedded_components {\n"
|
|
||||||
" id: \"sprite\"\n"
|
|
||||||
" type: \"sprite\"\n"
|
|
||||||
" data: \"tile_set: \\\"/example/example.atlas\\\"\\n"
|
|
||||||
"default_animation: \\\"defold-icon\\\"\\n"
|
|
||||||
"material: \\\"/builtins/materials/sprite.material\\\"\\n"
|
|
||||||
"blend_mode: BLEND_MODE_ALPHA\\n"
|
|
||||||
"\"\n"
|
|
||||||
" position {\n"
|
|
||||||
" x: 400.0\n"
|
|
||||||
" y: 300.0\n"
|
|
||||||
" z: 0.0\n"
|
|
||||||
" }\n"
|
|
||||||
" rotation {\n"
|
|
||||||
" x: 0.0\n"
|
|
||||||
" y: 0.0\n"
|
|
||||||
" z: 0.0\n"
|
|
||||||
" w: 1.0\n"
|
|
||||||
" }\n"
|
|
||||||
"}\n"
|
|
||||||
""
|
|
||||||
position {
|
|
||||||
x: 0.0
|
|
||||||
y: 0.0
|
|
||||||
z: 0.0
|
|
||||||
}
|
|
||||||
rotation {
|
|
||||||
x: 0.0
|
|
||||||
y: 0.0
|
|
||||||
z: 0.0
|
|
||||||
w: 1.0
|
|
||||||
}
|
|
||||||
scale3 {
|
|
||||||
x: 1.0
|
|
||||||
y: 1.0
|
|
||||||
z: 1.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,65 @@
|
||||||
|
local defos = require("defos.defos") --windows only
|
||||||
|
|
||||||
|
local dirtylarry = require "dirtylarry/dirtylarry"
|
||||||
|
|
||||||
|
function init(self)
|
||||||
|
self.is_cursor = true
|
||||||
|
msg.post(".", "acquire_input_focus")
|
||||||
|
end
|
||||||
|
|
||||||
|
local function change_mouse_label(text)
|
||||||
|
local label = gui.get_node("disable_mouse_cursor/larrylabel")
|
||||||
|
gui.set_text(label,text)
|
||||||
|
end
|
||||||
|
|
||||||
|
function on_input(self, action_id, action)
|
||||||
|
self.input_title = dirtylarry:input("window_title", action_id, action, gui.KEYBOARD_TYPE_DEFAULT, "Type text")
|
||||||
|
|
||||||
|
dirtylarry:button("set_window_title", action_id, action, function ()
|
||||||
|
defos.set_window_title(tostring(self.input_title))
|
||||||
|
end)
|
||||||
|
|
||||||
|
dirtylarry:button("disable_minimize_button", action_id, action, function ()
|
||||||
|
defos.disable_minimize_button()
|
||||||
|
end)
|
||||||
|
|
||||||
|
dirtylarry:button("disable_maximize_button", action_id, action, function ()
|
||||||
|
defos.disable_maximize_button()
|
||||||
|
end)
|
||||||
|
|
||||||
|
dirtylarry:button("disable_window_resize", action_id, action, function ()
|
||||||
|
defos.disable_window_resize()
|
||||||
|
end)
|
||||||
|
|
||||||
|
dirtylarry:button("random_window_size", action_id, action, function ()
|
||||||
|
defos.set_window_size(math.random(1,500),math.random(1,500),math.random(100,1024),math.random(100,768))
|
||||||
|
end)
|
||||||
|
|
||||||
|
dirtylarry:button("set_window_size", action_id, action, function ()
|
||||||
|
defos.set_window_size(-1,-1,800,600)
|
||||||
|
end)
|
||||||
|
|
||||||
|
dirtylarry:button("toggle_fullscreen", action_id, action, function ()
|
||||||
|
defos.toggle_fullscreen()
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
dirtylarry:button("toggle_maximize", action_id, action, function ()
|
||||||
|
defos.toggle_maximize()
|
||||||
|
end)
|
||||||
|
|
||||||
|
dirtylarry:button("disable_mouse_cursor", action_id, action, function ()
|
||||||
|
if self.is_cursor then
|
||||||
|
defos.disable_mouse_cursor()
|
||||||
|
self.is_cursor = false
|
||||||
|
change_mouse_label("Enable mouse cursor")
|
||||||
|
else
|
||||||
|
defos.enable_mouse_cursor()
|
||||||
|
self.is_cursor = true
|
||||||
|
change_mouse_label("Disable mouse cursor")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
gui.set_text(gui.get_node("is_fullscreen"),"is_fullscreen "..tostring(defos.is_fullscreen()))
|
||||||
|
gui.set_text(gui.get_node("is_maximize"),"is_maximize "..tostring(defos.is_maximize()))
|
||||||
|
end
|
|
@ -1,7 +1,7 @@
|
||||||
[project]
|
[project]
|
||||||
title = DefOS
|
title = DefOS
|
||||||
version = 1.0
|
version = 1.0
|
||||||
dependencies =
|
dependencies = latest zip URL as a dependency in your Defold project: https://github.com/andsve/dirtylarry/archive/master.zip
|
||||||
|
|
||||||
[bootstrap]
|
[bootstrap]
|
||||||
main_collection = /example/example.collectionc
|
main_collection = /example/example.collectionc
|
||||||
|
@ -10,8 +10,8 @@ main_collection = /example/example.collectionc
|
||||||
game_binding = /input/game.input_bindingc
|
game_binding = /input/game.input_bindingc
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
width = 800
|
width = 1024
|
||||||
height = 600
|
height = 768
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
scale = 0.02
|
scale = 0.02
|
||||||
|
|
|
@ -1,4 +1,16 @@
|
||||||
|
key_trigger {
|
||||||
|
input: KEY_BACKSPACE
|
||||||
|
action: "backspace"
|
||||||
|
}
|
||||||
mouse_trigger {
|
mouse_trigger {
|
||||||
input: MOUSE_BUTTON_1
|
input: MOUSE_BUTTON_1
|
||||||
action: "touch"
|
action: "touch"
|
||||||
}
|
}
|
||||||
|
text_trigger {
|
||||||
|
input: TEXT
|
||||||
|
action: "text"
|
||||||
|
}
|
||||||
|
text_trigger {
|
||||||
|
input: MARKED_TEXT
|
||||||
|
action: "marked_text"
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue