|
@@ -84,20 +84,23 @@ suite "Work with Control nodes.":
|
|
|
- TextureRect texturerect1:
|
|
|
texture_mode: TEXTURE_KEEP_ASPECT_RATIO
|
|
|
texture_anchor: Anchor(0.5, 0.5, 0.5, 0.5)
|
|
|
- call setTexture(load("assets/sharp.jpg"))
|
|
|
- call resize(100, 100)
|
|
|
- call move(120, 0)
|
|
|
+ call:
|
|
|
+ setTexture(load("assets/sharp.jpg"))
|
|
|
+ resize(100, 100)
|
|
|
+ move(120, 0)
|
|
|
- TextureRect texturerect2:
|
|
|
texture_mode: TEXTURE_CROP
|
|
|
texture_anchor: Anchor(0.5, 0.5, 0.5, 0.5)
|
|
|
- call setTexture(load("assets/sharp.jpg"))
|
|
|
- call resize(100, 100)
|
|
|
- call move(220, 0)
|
|
|
+ call:
|
|
|
+ setTexture(load("assets/sharp.jpg"))
|
|
|
+ resize(100, 100)
|
|
|
+ move(220, 0)
|
|
|
- TextureRect texturerect3:
|
|
|
texture_mode: TEXTURE_FILL_XY
|
|
|
- call setTexture(load("assets/sharp.jpg"))
|
|
|
- call resize(100, 100)
|
|
|
- call move(320, 0)
|
|
|
+ call:
|
|
|
+ setTexture(load("assets/sharp.jpg"))
|
|
|
+ resize(100, 100)
|
|
|
+ move(320, 0)
|
|
|
getSceneByName("main").addChildren(texturerect1, texturerect2, texturerect3)
|
|
|
|
|
|
|
|
@@ -117,9 +120,10 @@ suite "Work with Control nodes.":
|
|
|
test "Button test":
|
|
|
build:
|
|
|
- Button btn:
|
|
|
- call setText("Press me ^^")
|
|
|
- call resize(196, 32)
|
|
|
- call move(420, 0)
|
|
|
+ call:
|
|
|
+ setText("Press me ^^")
|
|
|
+ resize(196, 32)
|
|
|
+ move(420, 0)
|
|
|
btn@onTouch(self, x, y):
|
|
|
echo "clicked btn!"
|
|
|
echo btn.text.chars[0].color
|
|
@@ -133,10 +137,11 @@ suite "Work with Control nodes.":
|
|
|
test "Box test":
|
|
|
build:
|
|
|
- Box box:
|
|
|
- call setChildAnchor(0.5, 0.5, 0.5, 0.5)
|
|
|
- call setPadding(2, 4, 8, 16)
|
|
|
- call move(420, 30)
|
|
|
- call setBackgroundColor(Color(1f, 1f, 1f))
|
|
|
+ call:
|
|
|
+ setChildAnchor(0.5, 0.5, 0.5, 0.5)
|
|
|
+ setPadding(2, 4, 8, 16)
|
|
|
+ move(420, 30)
|
|
|
+ setBackgroundColor(Color(1f, 1f, 1f))
|
|
|
- ColorRect first:
|
|
|
color: Color(0xff6699ff'u32)
|
|
|
call resize(80, 80)
|
|
@@ -151,10 +156,11 @@ suite "Work with Control nodes.":
|
|
|
test "HBox test":
|
|
|
build:
|
|
|
- HBox hbox:
|
|
|
- call setChildAnchor(1, 1, 1, 1)
|
|
|
- call setPadding(2, 4, 8, 16)
|
|
|
- call move(520, 30)
|
|
|
- call setBackgroundColor(Color(1f, 1f, 1f))
|
|
|
+ call:
|
|
|
+ setChildAnchor(1, 1, 1, 1)
|
|
|
+ setPadding(2, 4, 8, 16)
|
|
|
+ move(520, 30)
|
|
|
+ setBackgroundColor(Color(1f, 1f, 1f))
|
|
|
- ColorRect first:
|
|
|
color: Color(0xff6699ff'u32)
|
|
|
call resize(80, 80)
|
|
@@ -169,10 +175,11 @@ suite "Work with Control nodes.":
|
|
|
test "VBox test":
|
|
|
build:
|
|
|
- VBox vbox:
|
|
|
- call setChildAnchor(1, 1, 1, 1)
|
|
|
- call setPadding(2, 4, 8, 16)
|
|
|
- call move(420, 144)
|
|
|
- call setBackgroundColor(Color(1f, 1f, 1f))
|
|
|
+ call:
|
|
|
+ setChildAnchor(1, 1, 1, 1)
|
|
|
+ setPadding(2, 4, 8, 16)
|
|
|
+ move(420, 144)
|
|
|
+ setBackgroundColor(Color(1f, 1f, 1f))
|
|
|
- ColorRect first:
|
|
|
color: Color(0xff6699ff'u32)
|
|
|
call resize(80, 80)
|
|
@@ -187,10 +194,11 @@ suite "Work with Control nodes.":
|
|
|
test "GridBox test":
|
|
|
build:
|
|
|
- GridBox grid:
|
|
|
- call setPadding(2, 4, 8, 16)
|
|
|
- call move(530, 144)
|
|
|
- call setRow(3)
|
|
|
- call setBackgroundColor(Color(1f, 1f, 1f))
|
|
|
+ call:
|
|
|
+ setPadding(2, 4, 8, 16)
|
|
|
+ move(530, 144)
|
|
|
+ setRow(3)
|
|
|
+ setBackgroundColor(Color(1f, 1f, 1f))
|
|
|
- ColorRect first(color: Color(0xff6699ff'u32))
|
|
|
- ColorRect second(color: Color(0xff64ffff'u32))
|
|
|
- ColorRect third(color: Color(0xffaa00ff'u32))
|
|
@@ -213,9 +221,10 @@ suite "Work with Control nodes.":
|
|
|
- Scroll scroll:
|
|
|
call setAnchor(1, 0, 1, 0)
|
|
|
- GridBox grid:
|
|
|
- call setPadding(2, 4, 8, 16)
|
|
|
- call setRow(3)
|
|
|
- call setBackgroundColor(Color(1f, 1f, 1f))
|
|
|
+ call:
|
|
|
+ setPadding(2, 4, 8, 16)
|
|
|
+ setRow(3)
|
|
|
+ setBackgroundColor(Color(1f, 1f, 1f))
|
|
|
- ColorRect first(color: Color(0xff6699ff'u32), rect_size: Vector2(100, 200))
|
|
|
- ColorRect second(color: Color(0xff64ffff'u32))
|
|
|
- ColorRect third(color: Color(0xffaa00ff'u32))
|
|
@@ -230,21 +239,24 @@ suite "Work with Control nodes.":
|
|
|
- ProgressBar bar1:
|
|
|
progress_type: PROGRESS_BAR_HORIZONTAL
|
|
|
indeterminate: true
|
|
|
- call setProgress(50)
|
|
|
- call move(120, 110)
|
|
|
- call resize(100, 20)
|
|
|
+ call:
|
|
|
+ setProgress(50)
|
|
|
+ move(120, 110)
|
|
|
+ resize(100, 20)
|
|
|
- ProgressBar bar2:
|
|
|
progress_type: PROGRESS_BAR_VERTICAL
|
|
|
indeterminate: true
|
|
|
- call setProgress(50)
|
|
|
- call move(220, 100)
|
|
|
- call resize(20, 110)
|
|
|
+ call:
|
|
|
+ setProgress(50)
|
|
|
+ move(220, 100)
|
|
|
+ resize(20, 110)
|
|
|
- ProgressBar bar3:
|
|
|
progress_type: PROGRESS_BAR_CIRCLE
|
|
|
indeterminate: true
|
|
|
- call setProgress(50)
|
|
|
- call move(320, 110)
|
|
|
- call resize(100, 100)
|
|
|
+ call:
|
|
|
+ setProgress(50)
|
|
|
+ move(320, 110)
|
|
|
+ resize(100, 100)
|
|
|
getSceneByName("main").addChildren(bar1, bar2, bar3)
|
|
|
|
|
|
|
|
@@ -263,23 +275,25 @@ suite "Work with Control nodes.":
|
|
|
test "TextureButton test":
|
|
|
build:
|
|
|
- TextureButton button:
|
|
|
- call setNormalTexture(load("assets/button_normal.png", GL_RGBA))
|
|
|
- call setHoverTexture(load("assets/button_hover.png", GL_RGBA))
|
|
|
- call setPressTexture(load("assets/button_press.png", GL_RGBA))
|
|
|
- call resize(256, 64)
|
|
|
- call move(120, 220)
|
|
|
- call setText("Texture button")
|
|
|
+ call:
|
|
|
+ setNormalTexture(load("assets/button_normal.png", GL_RGBA))
|
|
|
+ setHoverTexture(load("assets/button_hover.png", GL_RGBA))
|
|
|
+ setPressTexture(load("assets/button_press.png", GL_RGBA))
|
|
|
+ resize(256, 64)
|
|
|
+ move(120, 220)
|
|
|
+ setText("Texture button")
|
|
|
getSceneByName("main").addChild(button)
|
|
|
|
|
|
|
|
|
test "TextureProgressBar test":
|
|
|
build:
|
|
|
- TextureProgressBar progress:
|
|
|
- call setProgressTexture(load("assets/texture_progress_1.png", GL_RGBA))
|
|
|
- call setBackgroundTexture(load("assets/texture_progress_0.png", GL_RGBA))
|
|
|
- call setProgress(50)
|
|
|
- call resize(256, 85)
|
|
|
- call move(100, 300)
|
|
|
+ call:
|
|
|
+ setProgressTexture(load("assets/texture_progress_1.png", GL_RGBA))
|
|
|
+ setBackgroundTexture(load("assets/texture_progress_0.png", GL_RGBA))
|
|
|
+ setProgress(50)
|
|
|
+ resize(256, 85)
|
|
|
+ move(100, 300)
|
|
|
getSceneByName("main").addChild(progress)
|
|
|
|
|
|
|
|
@@ -301,19 +315,21 @@ suite "Work with Control nodes.":
|
|
|
test "CheckBox test":
|
|
|
build:
|
|
|
- CheckBox check:
|
|
|
- call setText("smth checkbox")
|
|
|
- call enable()
|
|
|
- call move(700, 300)
|
|
|
+ call:
|
|
|
+ setText("smth checkbox")
|
|
|
+ enable()
|
|
|
+ move(700, 300)
|
|
|
getSceneByName("main").addChild(check)
|
|
|
|
|
|
|
|
|
test "SubWindow test":
|
|
|
build:
|
|
|
- SubWindow window1:
|
|
|
- call setIcon("assets/anim/0.jpg")
|
|
|
- call setTitle("subwindow")
|
|
|
- call move(500, 400)
|
|
|
- call open()
|
|
|
+ call:
|
|
|
+ setIcon("assets/anim/0.jpg")
|
|
|
+ setTitle("subwindow")
|
|
|
+ move(500, 400)
|
|
|
+ open()
|
|
|
getSceneByName("main").addChild(window1)
|
|
|
|
|
|
|
|
@@ -340,43 +356,43 @@ suite "Work with Control nodes.":
|
|
|
test "Line & Bar chart test":
|
|
|
build:
|
|
|
- Chart my_chart:
|
|
|
- call addChartData(
|
|
|
- newChartData(
|
|
|
- @["one", "two", "three", "four", "five", "six"],
|
|
|
- @[1, 8, 18, 32, 4, 16], "myData", current_theme~accent_dark, BAR_CHART))
|
|
|
- call addChartData(
|
|
|
- newChartData(
|
|
|
- @["one", "two", "three", "four", "five", "six"],
|
|
|
- @[1, 8, 18, 32, 4, 16], "myData", current_theme~accent, LINE_CHART))
|
|
|
-
|
|
|
- call move(100, 450)
|
|
|
- call resize(320, 196)
|
|
|
+ call:
|
|
|
+ addChartData(
|
|
|
+ newChartData(
|
|
|
+ @["one", "two", "three", "four", "five", "six"],
|
|
|
+ @[1, 8, 18, 32, 4, 16], "myData", current_theme~accent_dark, BAR_CHART))
|
|
|
+ addChartData(
|
|
|
+ newChartData(
|
|
|
+ @["one", "two", "three", "four", "five", "six"],
|
|
|
+ @[1, 8, 18, 32, 4, 16], "myData", current_theme~accent, LINE_CHART))
|
|
|
+ move(100, 450)
|
|
|
+ resize(320, 196)
|
|
|
|
|
|
getSceneByName("main").addChildren(my_chart)
|
|
|
|
|
|
test "Pie chart test":
|
|
|
build:
|
|
|
- Chart circle_chart:
|
|
|
- call addChartData(
|
|
|
- newChartData(
|
|
|
- @["one", "two", "three", "four", "five", "six"],
|
|
|
- @[1, 8, 18, 32, 4, 16], "myData", current_theme~accent_dark, PIE_CHART))
|
|
|
-
|
|
|
- call move(900, 450)
|
|
|
- call resize(128, 128)
|
|
|
+ call:
|
|
|
+ addChartData(
|
|
|
+ newChartData(
|
|
|
+ @["one", "two", "three", "four", "five", "six"],
|
|
|
+ @[1, 8, 18, 32, 4, 16], "myData", current_theme~accent_dark, PIE_CHART))
|
|
|
+ move(900, 450)
|
|
|
+ resize(128, 128)
|
|
|
|
|
|
getSceneByName("main").addChildren(circle_chart)
|
|
|
|
|
|
test "Radar chart test":
|
|
|
build:
|
|
|
- Chart spiderweb_chart:
|
|
|
- call addChartData(
|
|
|
- newChartData(
|
|
|
- @["one", "two", "three", "four", "five"],
|
|
|
- @[10, 24, 18, 32, 4], "myData", current_theme~accent_dark, RADAR_CHART))
|
|
|
-
|
|
|
- call move(700, 450)
|
|
|
- call resize(128, 128)
|
|
|
+ call:
|
|
|
+ addChartData(
|
|
|
+ newChartData(
|
|
|
+ @["one", "two", "three", "four", "five"],
|
|
|
+ @[10, 24, 18, 32, 4], "myData", current_theme~accent_dark, RADAR_CHART))
|
|
|
+ move(700, 450)
|
|
|
+ resize(128, 128)
|
|
|
|
|
|
getSceneByName("main").addChildren(spiderweb_chart)
|
|
|
|