commit 97272f3b92699d70437596665cf92829b8be51a0
parent b13b5c7793b548b60bddb4cf3e95c066bd23d22b
Author: Brian C. Lane <bcl@brianlane.com>
Date: Sat, 12 Nov 2022 20:34:16 -0800
Add a simple MainScene
Learning how SceneGraph is structured by creating a basic Hello World
scene.
Diffstat:
7 files changed, 102 insertions(+), 3 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -5,4 +5,4 @@ root/
pyvirt/
.*.swp
library.db
-
+dist/
diff --git a/HMS/components/MainScene.brs b/HMS/components/MainScene.brs
@@ -0,0 +1,6 @@
+' MainScene entry point
+sub Init()
+ print "MainScene.Init() has been executed"
+
+
+end sub
diff --git a/HMS/components/MainScene.xml b/HMS/components/MainScene.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<component name="MainScene" extends="Scene" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://devtools.web.roku.com/schema/RokuSceneGraph.xsd">
+ <script type="text/brightscript" uri="MainScene.brs" />
+
+ <children>
+ <Label text="Hello World!" />
+ </children>
+</component>
diff --git a/HMS/components/setupserver.xml b/HMS/components/setupserver.xml
@@ -0,0 +1,60 @@
+<?xml version = "1.0" encoding = "utf-8" ?>
+<component name = "SetupServer" extends = "Scene" initialFocus = "getServerName" >
+ <script type = "text/brightscript" >
+ <![CDATA[
+ sub init()
+ m.top.backgroundURI = "pkg:/images/rsgde_bg_hd.jpg"
+
+ m.kbd = m.top.findNode("getServerName")
+
+ rect = m.kbd.boundingRect()
+ centerx = (1280 - rect.width) / 2
+ centery = (720 - rect.height) / 2
+ m.kbd.translation = [ centerx, centery ]
+
+ m.finishedButton = m.top.findNode("finished")
+ rect = m.finishedButton.boundingRect()
+ m.finishedButton.translation = [1280 - rect.width, 720 - rect.height]
+ m.finishedButton.ObserveField("buttonSelected", "onFinishPressed")
+
+ m.top.setFocus(true)
+ print "Running fucking server setup dialog"
+ end sub
+
+ sub onFinishedPressed()
+ print "finish button pressed"
+ print "server name is "; m.kbd.text
+ end sub
+
+ function onKeyEvent(key as String, press as Boolean) as Boolean
+ handled = false
+
+ print key
+ print m.finishedButton.hasFocus()
+ print press
+ print m.kbd.text
+ print
+
+ if press
+ if key = "down" and not m.finishedButton.hasFocus()
+ m.finishedButton.setFocus(true)
+ handled = true
+ else if key = "up" and not m.kbd.hasFocus()
+ m.kbd.setFocus(true)
+ handled = true
+ else if key = "OK" and m.finishedButton.hasFocus()
+ print "OK was pressed on finished"
+ print "server name is "; m.kbd.text
+ end if
+ end if
+
+ return handled
+ end function
+ ]]>
+ </script>
+
+ <children >
+ <Keyboard id = "getServerName" />
+ <Button id="finished" text="Finished" showFocusFootprint="true" />
+ </children>
+</component>
diff --git a/HMS/manifest b/HMS/manifest
@@ -4,6 +4,8 @@ mm_icon_focus_hd=pkg:/images/MainMenu_Icon_CenterFocus_HD.png
mm_icon_side_hd=pkg:/images/MainMenu_Icon_Side_HD.png
mm_icon_focus_sd=pkg:/images/MainMenu_Icon_CenterFocus_SD.png
mm_icon_side_sd=pkg:/images/MainMenu_Icon_Side_SD.png
-major_version=3
+major_version=4
minor_version=0
build_version=00001
+
+ui_resolutions=sd,hd,fhd
diff --git a/HMS/source/appMain.brs b/HMS/source/appMain.brs
@@ -2,7 +2,7 @@
'** Home Media Server Application - Main
'** Copyright (c) 2010-2013 Brian C. Lane All Rights Reserved.
'********************************************************************
-Sub Main()
+Sub OldMain()
'initialize theme attributes like titles, logos and overhang color
initTheme()
diff --git a/HMS/source/main.brs b/HMS/source/main.brs
@@ -0,0 +1,23 @@
+'********************************************************************
+'** Home Media Server Application - Main
+'** Copyright (c) 2022 Brian C. Lane All Rights Reserved.
+'********************************************************************
+sub Main()
+ ShowChannelRSGScreen()
+end sub
+
+sub ShowChannelRSGScreen()
+ screen = CreateObject("roSGScreen")
+ m.port = CreateObject("roMessagePort")
+ screen.SetMessagePort(m.port)
+ scene = screen.CreateScene("MainScene")
+ screen.Show()
+
+ while(true)
+ msg = wait(0, m.port)
+ msgType = type(msg)
+ if msgType = "roSGScreenEvent"
+ if msg.IsScreenClosed() then return
+ end if
+ end while
+end sub