Просмотр исходного кода

Fixed broken UI module pak in player, fixed broken examples

Ivan Safrin 13 лет назад
Родитель
Сommit
aeb455552e

BIN
Assets/UIThemes.pak


BIN
Assets/UIThemes/default/menu_bg.png


+ 13 - 10
Assets/UIThemes/default/theme.xml

@@ -67,13 +67,13 @@
 	<uiWindowSkinB>17</uiWindowSkinB>
 	<uiWindowSkinL>17</uiWindowSkinL>
 	<uiWindowSkinPadding>15</uiWindowSkinPadding>		
-	<uiWindowTitleFont>mono</uiWindowTitleFont>
+	<uiWindowTitleFont>sans</uiWindowTitleFont>
 	<uiWindowFontColor>0xe4e0e3c8</uiWindowFontColor>	
 	<uiWindowTitleFontSize>14</uiWindowTitleFontSize>
 	<uiWindowTitleX>15</uiWindowTitleX>	
-	<uiWindowTitleY>10</uiWindowTitleY>	
+	<uiWindowTitleY>10</uiWindowTitleY>
 	<uiWindowTitleBarHeight>25</uiWindowTitleBarHeight>
-	<uiWindowTitleBarOffset>5</uiWindowTitleBarOffset>	
+	<uiWindowTitleBarOffset>5</uiWindowTitleBarOffset>
 	<uiWindowCloseIcon>UIThemes/default/closeIcon.png</uiWindowCloseIcon>
 	<uiCloseIconX>11</uiCloseIconX>	
 	<uiCloseIconY>11</uiCloseIconY>		
@@ -120,20 +120,20 @@
 	<uiMenuFontSize>12</uiMenuFontSize>
 	<uiMenuTextOffsetX>10</uiMenuTextOffsetX>
 	<uiMenuTextOffsetY>-1</uiMenuTextOffsetY>		
-	<uiMenuPaddingX>7</uiMenuPaddingX>
-	<uiMenuPaddingY>20</uiMenuPaddingY>
+	<uiMenuPaddingX>3</uiMenuPaddingX>
+	<uiMenuPaddingY>10</uiMenuPaddingY>
 	<uiMenuItemHeight>22</uiMenuItemHeight>
 	<uiMenuBgImage>UIThemes/default/menu_bg.png</uiMenuBgImage>	
-	<uiMenuBgT>25</uiMenuBgT>
-	<uiMenuBgR>18</uiMenuBgR>
-	<uiMenuBgB>22</uiMenuBgB>
-	<uiMenuBgL>18</uiMenuBgL>			
+	<uiMenuBgT>4</uiMenuBgT>
+	<uiMenuBgR>6</uiMenuBgR>
+	<uiMenuBgB>9</uiMenuBgB>
+	<uiMenuBgL>6</uiMenuBgL>			
 	<uiMenuSelectorBgImage>UIThemes/default/menu_selector.png</uiMenuSelectorBgImage>	
 	<uiMenuSelectorBgT>0</uiMenuSelectorBgT>
 	<uiMenuSelectorBgR>0</uiMenuSelectorBgR>
 	<uiMenuSelectorBgB>0</uiMenuSelectorBgB>
 	<uiMenuSelectorBgL>0</uiMenuSelectorBgL>
-	<uiMenuSelectorPadding>2</uiMenuSelectorPadding>
+	<uiMenuSelectorPadding>3</uiMenuSelectorPadding>
 
 	<uiColorBoxFrameImage>UIThemes/default/colorboxFrame.png</uiColorBoxFrameImage>
 	<uiColorBoxFrameImageT>7</uiColorBoxFrameImageT>
@@ -157,4 +157,7 @@
 	<uiHSliderBgB>5</uiHSliderBgB>
 	<uiHSliderBgL>6</uiHSliderBgL>
 
+	<uiFileBrowserFileIcon>UIThemes/default/file.png</uiFileBrowserFileIcon>
+	<uiFileBrowserFolderIcon>UIThemes/default/folder.png</uiFileBrowserFolderIcon>
+	<uiFileBrowserPlaceIcon>UIThemes/default/boxIcon.png</uiFileBrowserPlaceIcon>
 </PolyConfig>

+ 1 - 1
Examples/Lua/2D_Graphics/2DParticles/2DParticles.polyproject

@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DParticles.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DParticles.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <polyarray:packedItems>
         <item type="folder" path="Resources" />

+ 1 - 1
Examples/Lua/2D_Graphics/2DParticles/Scripts/2DParticles.lua

@@ -2,7 +2,7 @@
 
 screen = Screen()
 
-emitter = ScreenParticleEmitter("Resources/particle.png", screen, Particle.BILLBOARD_PARTICLE,
+emitter = ScreenParticleEmitter("Resources/particle.png", Particle.BILLBOARD_PARTICLE,
 	ParticleEmitter.CONTINUOUS_EMITTER, 4, 200, Vector3(0.0,-50.0,0.0), Vector3(0.0,0.0,0.0),
 	Vector3(20.5, 40.0, 0.0), Vector3(0.0,0.0,0.0))
 

+ 1 - 1
Examples/Lua/2D_Graphics/BasicText/BasicText.polyproject

@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/BasicText.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/BasicText.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <packedItems>
         <item type="folder" path="Scripts" />

+ 2 - 4
Examples/Lua/2D_Physics/2DPhysics_Basic/2DPhysics_Basic.polyproject

@@ -1,9 +1,7 @@
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_Basic.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_Basic.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
-    <polyarray:modules>
-        <module>Physics2D</module>
-    </polyarray:modules>
+    <polyarray:modules />
     <packedItems>
         <item type="folder" path="Scripts" />
     </packedItems>

+ 2 - 4
Examples/Lua/2D_Physics/2DPhysics_CollisionOnly/2DPhysics_CollisionOnly.polyproject

@@ -1,9 +1,7 @@
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_CollisionOnly.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_CollisionOnly.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
-    <polyarray:modules>
-        <module>Physics2D</module>
-    </polyarray:modules>
+    <polyarray:modules />
     <packedItems>
         <item type="folder" path="Scripts" />
     </packedItems>

+ 16 - 24
Examples/Lua/2D_Physics/2DPhysics_CollisionOnly/Scripts/2DPhysics_CollisionOnly.lua

@@ -1,24 +1,3 @@
-class "Detector" (EventHandler)
-
-function Detector:Detector(shape)
-        self.shape = shape
-        EventHandler.EventHandler(self)
-end
-
-function Detector:handleEvent(e)
-        if e:getDispatcher() == screen then
-                local pe = PhysicsScreenEvent(e)
-                if e:getEventCode() == PhysicsScreenEvent.EVENT_NEW_SHAPE_COLLISION then
-                        if pe:getFirstEntity() == self.shape or pe:getSecondEntity() == self.shape then
-                                pe:getFirstEntity():setColor(1.0, 0.0, 0.0, 1.0)
-                                pe:getSecondEntity():setColor(1.0, 0.0, 0.0, 1.0)
-                        end
-                elseif e:getEventCode() == PhysicsScreenEvent.EVENT_END_SHAPE_COLLISION then
-                        pe:getFirstEntity():setColor(1.0, 1.0, 1.0, 1.0)
-                        pe:getSecondEntity():setColor(1.0, 1.0, 1.0, 1.0)
-                end
-        end
-end
 
 screen = PhysicsScreen(10, 60)
 
@@ -32,9 +11,22 @@ for i=0,50 do
         screen:addCollisionChild(shape, PhysicsScreenEntity.ENTITY_RECT)
 end
 
-detector = Detector(checkShape)
-screen:addEventListener(detector, PhysicsScreenEvent.EVENT_NEW_SHAPE_COLLISION)
-screen:addEventListener(detector, PhysicsScreenEvent.EVENT_END_SHAPE_COLLISION)
+function onNewCollision(t, event)
+	physicsEvent = safe_cast(event, PhysicsScreenEvent)
+	if same_c_class(physicsEvent:getFirstEntity(),checkShape) or same_c_class(physicsEvent:getSecondEntity(),checkShape) then
+		physicsEvent:getFirstEntity():setColor(1.0, 0.0, 0.0, 1.0)
+		physicsEvent:getSecondEntity():setColor(1.0, 0.0, 0.0, 1.0)
+	end
+end
+
+function onEndCollision(t, event)
+	physicsEvent = safe_cast(event, PhysicsScreenEvent)
+	physicsEvent:getFirstEntity():setColor(1.0, 1.0, 1.0, 1.0)
+	physicsEvent:getSecondEntity():setColor(1.0, 1.0, 1.0, 1.0)
+end
+
+screen:addEventListener(nil, onNewCollision, PhysicsScreenEvent.EVENT_NEW_SHAPE_COLLISION)
+screen:addEventListener(nil, onEndCollision, PhysicsScreenEvent.EVENT_END_SHAPE_COLLISION)
 
 function onMouseMove(x,y)
 	checkShape:setPosition(x,y)

+ 2 - 4
Examples/Lua/2D_Physics/2DPhysics_Contacts/2DPhysics_Contacts.polyproject

@@ -1,9 +1,7 @@
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_Contacts.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_Contacts.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
-    <polyarray:modules>
-        <module>Physics2D</module>
-    </polyarray:modules>
+    <polyarray:modules />
     <polyarray:packedItems>
         <item type="folder" path="Resources" />
         <item type="folder" path="Scripts" />

+ 9 - 18
Examples/Lua/2D_Physics/2DPhysics_Contacts/Scripts/2DPhysics_Contacts.lua

@@ -1,20 +1,5 @@
-class "ImpactNoise" (EventHandler)
 
-function ImpactNoise:ImpactNoise()
-        self.collisionSound = Sound("Resources/collision.wav")
-        EventHandler.EventHandler(self)
-end
-
-function ImpactNoise:handleEvent(e)
-        if e:getDispatcher() == screen then
-                local pe = PhysicsScreenEvent(e)
-                if e:getEventCode() == PhysicsScreenEvent.EVENT_NEW_SHAPE_COLLISION then
-                        if pe.impactStrength > 5 then
-                                self.collisionSound:Play()
-                        end
-                end
-        end
-end
+-- makes a sound when a collision impact stronger than 5 happens
 
 screen = PhysicsScreen(10, 60)
 shape = ScreenShape(ScreenShape.SHAPE_RECT, 600,30)
@@ -29,7 +14,13 @@ for i=0,50 do
         screen:addPhysicsChild(shape, PhysicsScreenEntity.ENTITY_RECT, false)
 end
 
+collisionSound = Sound("Resources/collision.wav")
 
-noiseMaker = ImpactNoise()
+function onCollision(t, event)
+	physicsEvent = safe_cast(event, PhysicsScreenEvent)
+	if physicsEvent.impactStrength > 5 then
+			collisionSound:Play()
+		end
+end
 
-screen:addEventListener(noiseMaker, PhysicsScreenEvent.EVENT_NEW_SHAPE_COLLISION)
+screen:addEventListener(test, onCollision, PhysicsScreenEvent.EVENT_NEW_SHAPE_COLLISION)

+ 2 - 4
Examples/Lua/2D_Physics/2DPhysics_Joints/2DPhysics_Joints.polyproject

@@ -1,9 +1,7 @@
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_Joints.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_Joints.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
-    <polyarray:modules>
-        <module>Physics2D</module>
-    </polyarray:modules>
+    <polyarray:modules />
     <packedItems>
         <item type="folder" path="Scripts" />
     </packedItems>

+ 2 - 4
Examples/Lua/2D_Physics/2DPhysics_PointCollision/2DPhysics_PointCollision.polyproject

@@ -1,9 +1,7 @@
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_PointCollision.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_PointCollision.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
-    <polyarray:modules>
-        <module>Physics2D</module>
-    </polyarray:modules>
+    <polyarray:modules />
     <packedItems>
         <item type="folder" path="Scripts" />
     </packedItems>

+ 3 - 3
Examples/Lua/Audio/3DAudio/3DAudio.polyproject

@@ -1,8 +1,8 @@
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/3DAudio.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/3DAudio.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
-    <packedItems>
+    <polyarray:packedItems>
         <item type="folder" path="Resources" />
         <item type="folder" path="Scripts" />
-    </packedItems>
+    </polyarray:packedItems>
 </PolycodeProject>

+ 1 - 1
Examples/Lua/Audio/PlayingSounds/PlayingSounds.polyproject

@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/PlayingSounds.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/PlayingSounds.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <polyarray:packedItems>
         <item type="folder" path="Resources" />

+ 2 - 2
Examples/Lua/UI/UIDemo/Scripts/Main.lua

@@ -25,7 +25,7 @@ screen:addChild(window)
 -- and listen to its click event
 -- **********************************************************************
 
-button = UIButton("Rotate me", 100, 30)
+button = UIButton("Rotate me", 100, 24)
 window:addChild(button)
 button.position.x = 20
 button.position.y = 40
@@ -40,7 +40,7 @@ button:addEventListener(nil, onRotateButton, UIEvent.CLICK_EVENT)
 -- UITextInput is a text input field
 -- **********************************************************************
 
-input = UITextInput(false, 100, 24)
+input = UITextInput(false, 100, 16)
 input:setText("DEMO")
 window:addChild(input)
 input.position.x = 140

+ 1 - 1
Player/Contents/Source/PolycodePlayer.cpp

@@ -670,7 +670,7 @@ void PolycodePlayer::loadFile(const char *fileName) {
 	
 	Logger::log("Core created...\n");
 
-	CoreServices::getInstance()->getResourceManager()->addArchive("UIThemes.zip");
+	CoreServices::getInstance()->getResourceManager()->addArchive("UIThemes.pak");
 	CoreServices::getInstance()->getConfig()->loadConfig("Polycode", "UIThemes/default/theme.xml");
 	
 	CoreServices::getInstance()->getResourceManager()->addArchive("api.pak");