Kaynağa Gözat

Merge pull request #292 from seanpaultaylor/master

Fixes new project scripts
Sean Paul Taylor 13 yıl önce
ebeveyn
işleme
af9f747f92

+ 4 - 0
gameplay-newproject.bat

@@ -243,6 +243,10 @@ copy gameplay-template\res\* %projPath%\res\
 REM Copy icon
 copy gameplay-template\icon.png %projPath%\icon.png
 
+REM Copy config
+copy gameplay-template\game.config %projPath%\game.config
+call:replace %projPath%\game.config TEMPLATE_TITLE "%projName%"
+
 REM Open new project folder
 start %projPath%
 

+ 5 - 0
gameplay-newproject.sh

@@ -250,6 +250,11 @@ cp "gameplay-template/res/"* "$projPath/res/"
 # Copy icon
 cp "gameplay-template/icon.png" "$projPath/icon.png"
 
+# Copy config
+cp "gameplay-template/game.config" "$projPath/game.config"
+sed -i "" "s*TEMPLATE_TITLE*$title*g" "$projPath/game.config"
+
+
 # Open the new project folder
 open $projPath
 

+ 7 - 0
gameplay-template/game.config

@@ -0,0 +1,7 @@
+window
+{
+    title = TEMPLATE_TITLE
+    width = 1280
+    height = 720
+    fullscreen = false
+}

+ 2 - 1
gameplay-template/gameplay-template.vcxproj

@@ -165,7 +165,8 @@
     <None Include="bar-descriptor.xml" >
         <SubType>Designer</SubType>
     </None>
-    <None Include="icon.png" />
+    <None Include="game.config" />
+	<None Include="icon.png" />
     <None Include="res\box.dae" />
     <None Include="res\box.gpb" />
     <None Include="res\box.material" />

+ 1 - 0
gameplay-template/gameplay-template.vcxproj.filters

@@ -7,6 +7,7 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
+	<None Include="game.config" />
     <None Include="icon.png" />
     <None Include="bar-descriptor.xml" />
     <None Include="res\box.dae">

+ 4 - 0
gameplay-template/gameplay-template.xcodeproj/project.pbxproj

@@ -8,6 +8,7 @@
 
 /* Begin PBXBuildFile section */
 		42438B531491AD2000D218B8 /* libgameplay.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 42438B521491AD2000D218B8 /* libgameplay.a */; };
+		428F7BDE15CB131A009ED24C /* game.config in Resources */ = {isa = PBXBuildFile; fileRef = 428F7BDD15CB131A009ED24C /* game.config */; };
 		42C932C11491A0DB0098216A /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 42C932C01491A0DB0098216A /* Cocoa.framework */; };
 		42C932EE1491A4CB0098216A /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 42C932ED1491A4CB0098216A /* icon.png */; };
 		42C932F11491A5160098216A /* TemplateGame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 42C932EF1491A5160098216A /* TemplateGame.cpp */; };
@@ -42,6 +43,7 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+		428F7BDD15CB131A009ED24C /* game.config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = game.config; sourceTree = "<group>"; };
 		42438B521491AD2000D218B8 /* libgameplay.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgameplay.a; path = "~/Library/Developer/Xcode/DerivedData/gameplay-exiunaubxxjndaapmcqkaoeboiob/Build/Products/Debug/libgameplay.a"; sourceTree = "<group>"; };
 		42C932BC1491A0DB0098216A /* TEMPLATE_PROJECT-macosx.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "TEMPLATE_PROJECT-macosx.app"; sourceTree = BUILT_PRODUCTS_DIR; };
 		42C932C01491A0DB0098216A /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
@@ -122,6 +124,7 @@
 				5B61611214CCC2200073B857 /* TEMPLATE_PROJECT-macosx.plist */,
 				5B61612E14CCC24D0073B857 /* TEMPLATE_PROJECT-ios.plist */,
 				42C932ED1491A4CB0098216A /* icon.png */,
+				428F7BDD15CB131A009ED24C /* game.config */,
 				42C932F21491A53E0098216A /* res */,
 				42C932C61491A0DB0098216A /* src */,
 				42C932DD1491A1050098216A /* Libraries */,
@@ -279,6 +282,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				42C932EE1491A4CB0098216A /* icon.png in Resources */,
+				428F7BDE15CB131A009ED24C /* game.config in Resources */,
 				42C932F31491A53E0098216A /* res in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;

+ 1 - 1
gameplay-template/res/colored.frag

@@ -25,7 +25,7 @@ void main()
 
     // Diffuse
 	float attenuation = 1.0;
-    float ddot = dot(normalVector, lightDirection);
+    float ddot = dot(normalVector, -lightDirection);
     float intensity =  max(0.0, attenuation * ddot);
     vec3 diffuseColor = u_lightColor * baseColor.rgb * intensity;
 

+ 1 - 2
gameplay-template/src/TemplateGame.cpp

@@ -26,8 +26,7 @@ void TemplateGame::initialize()
     Node* boxNode = _scene->findNode("box");
     Model* boxModel = boxNode->getModel();
     Material* boxMaterial = boxModel->setMaterial("res/box.material");
-	boxMaterial->getParameter("u_ambientColor")->setValue(_scene->getAmbientColor());
-	boxMaterial->getParameter("u_ambientColor")->setValue(_scene->getAmbientColor());
+    boxMaterial->getParameter("u_ambientColor")->setValue(_scene->getAmbientColor());
     boxMaterial->getParameter("u_lightColor")->setValue(light->getColor());
     boxMaterial->getParameter("u_lightDirection")->setValue(lightNode->getForwardVectorView());
 }