|
module(..., package.seeall) |
|
|
|
Component = require "hp/gui/Component" |
|
|
|
function onCreate(params) |
|
view = View { |
|
scene = scene, |
|
layout = { |
|
VBoxLayout { |
|
align = {"center", "center"}, |
|
padding = {10, 10, 10, 10}, |
|
} |
|
}, |
|
children = {{ |
|
Component { |
|
layout = { |
|
VBoxLayout { |
|
align = {"center", "center"}, |
|
padding = {10, 10, 10, 10}, |
|
} |
|
}, |
|
children = {{ |
|
Button { |
|
name = "startButton", |
|
text = "はじめ", |
|
onClick = onStartClick, |
|
}, |
|
Button { |
|
name = "backButton", |
|
text = "戻る", |
|
onClick = onBackClick, |
|
}, |
|
}}, |
|
}, |
|
Component { |
|
layout = { |
|
VBoxLayout { |
|
align = {"center", "center"}, |
|
padding = {10, 10, 10, 10}, |
|
} |
|
}, |
|
children = {{ |
|
Button { |
|
name = "testButton1", |
|
text = "disabled", |
|
enabled = false, |
|
}, |
|
}}, |
|
}, |
|
}}, |
|
} |
|
view:updateComponent() |
|
|
|
MOAIGfxDevice.setListener(MOAIGfxDevice.EVENT_RESIZE, onResize) |
|
end |
|
|
|
function onResize(width, height) |
|
print("onResize(width, height)", width, height) |
|
|
|
Application.screenWidth = width |
|
Application.screenHeight = height |
|
Application.viewWidth = width |
|
Application.viewHeight = height |
|
|
|
-- resize main view |
|
view:setSize(width, height) |
|
view:getLayer():setSize(width, height) |
|
--view:updateLayout() |
|
end |
|
|
|
function onStartClick(e) |
|
print("onStartClick") |
|
end |
|
|
|
function onBackClick(e) |
|
SceneManager:closeScene({animation = "fade"}) |
|
end |