Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/gameplay3d/GamePlay
Browse files Browse the repository at this point in the history
Conflicts:
	samples/browser/sample-browser.vcxproj.filters
  • Loading branch information
seanpaultaylor committed Jan 24, 2015
2 parents 90a3336 + f13c398 commit aa1f685
Show file tree
Hide file tree
Showing 7 changed files with 320 additions and 128 deletions.
4 changes: 3 additions & 1 deletion gameplay/src/Sprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,14 @@ Sprite* Sprite::create(Properties* properties)
float heightPercentage = 0.0f;
if (properties->exists("width"))
{
if (properties->getType("width") == Properties::NUMBER) //TODO: Verify that this works for "100" but fails for "100%"
if (properties->getType("width") == Properties::NUMBER)
{
// Number only (200)
width = properties->getFloat("width");
}
else
{
// Number and something else (200%)
widthPercentage = properties->getFloat("width") / 100.0f;
}
}
Expand Down
2 changes: 1 addition & 1 deletion gameplay/src/TileSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ TileSet* TileSet::create(Properties* properties)
Vector2 cell;
Vector2 source;
if (tileProperties->getVector2("cell", &cell) && tileProperties->getVector2("source", &source) &&
(cell.x > 0 && cell.y > 0 && cell.x < set->_columnCount && cell.y < set->_rowCount))
(cell.x >= 0 && cell.y >= 0 && cell.x < set->_columnCount && cell.y < set->_rowCount))
{
set->_tiles[(int)cell.y * set->_columnCount + (int)cell.x] = source;
}
Expand Down
193 changes: 193 additions & 0 deletions samples/browser/res/common/sprites/sprite.scene
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
scene spriteSample
{
// Width and height are expected to be 1280x720
node camera
{
camera
{
type = ORTHOGRAPHIC
nearPlane = 0
farPlane = 100

// zoomX default is game width
// zoomY default is game height
// aspectRatio default is game width / game height
}
// width and height are divided in half
translate = 640, 360, 0
}

// Background sprite
node background
{
sprite
{
path = res/common/sprites/background.png

// game width * 5
width = 6400
height = 720
}
}

// Level floor
node floor
{
tileset
{
path = res/common/sprites/level.png

tileWidth = 70
tileHeight = 70
rows = 3
columns = 7

tile
{
cell = 0, 0
source = 568, 284
}
tile
{
cell = 1, 0
source = 568, 284
}
tile
{
cell = 2, 0
source = 568, 284
}
tile
{
cell = 3, 0
source = 568, 284
}
tile
{
cell = 4, 0
source = 497, 284
}

tile
{
cell = 0, 1
source = 568, 0
}
tile
{
cell = 1, 1
source = 568, 0
}
tile
{
cell = 2, 1
source = 568, 0
}
tile
{
cell = 3, 1
source = 568, 0
}
tile
{
cell = 4, 1
source = 710, 142
}
tile
{
cell = 5, 1
source = 497, 284
}

tile
{
cell = 0, 2
source = 568, 0
}
tile
{
cell = 1, 2
source = 568, 0
}
tile
{
cell = 2, 2
source = 568, 0
}
tile
{
cell = 3, 2
source = 568, 0
}
tile
{
cell = 4, 2
source = 568, 0
}
tile
{
cell = 5, 2
source = 710, 142
}
tile
{
cell = 6, 2
source = 497, 284
}
}
}

node player
{
sprite
{
path = res/common/sprites/player1.png

width = 72
height = 97
source = 67, 196, 66, 92
frameCount = 13
}

// Position player at lower-left. Y position is floor's tileset height (tileHeight * rows)
translate = 0, 210, 0
}

node rocket
{
sprite
{
path = res/common/sprites/rocket.png

width = 128
height = 128
blendMode = BLEND_ADDITIVE
anchor = 0.5, 0.3
offset = OFFSET_ANCHOR
}

translate = 1280, 0, 0
rotate = 0, 0, 1, -45
}

node water
{
// Sprite drawable set in code because Effect isn't supported
translate = 0, -50, 0
}

node text
{
text
{
font = res/ui/arial.gpb

text = P1
size = 18
color = 0, 0, 1, 1
}
}

// Set active camera
activeCamera = camera
}
16 changes: 16 additions & 0 deletions samples/browser/sample-browser.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ copy ..\..\gameplay\res\logo_powered_white.png res</Command>
<None Include="res\common\sample.material" />
<None Include="res\common\sample.scene" />
<None Include="res\common\sphere.gpb" />
<None Include="res\common\sprites\sprite.scene" />
<None Include="res\common\sprites\water2d.frag" />
<None Include="res\common\terrain\encode.bat" />
<None Include="res\common\terrain\heightmap.r16" />
<None Include="res\common\terrain\sample.scene" />
Expand Down Expand Up @@ -315,6 +317,14 @@ copy ..\..\gameplay\res\logo_powered_white.png res</Command>
<Image Include="res\common\particles\explosion.png" />
<Image Include="res\common\particles\fire.png" />
<Image Include="res\common\particles\smoke.png" />
<Image Include="res\common\sprites\background.png" />
<Image Include="res\common\sprites\level.png" />
<Image Include="res\common\sprites\player1.png" />
<Image Include="res\common\sprites\player2.png" />
<Image Include="res\common\sprites\player3.png" />
<Image Include="res\common\sprites\rocket.png" />
<Image Include="res\common\sprites\water2d-noise.png" />
<Image Include="res\common\sprites\water2d.png" />
<Image Include="res\common\terrain\dirt.dds" />
<Image Include="res\common\terrain\grass.dds" />
<Image Include="res\common\terrain\normalmap.dds" />
Expand All @@ -341,6 +351,12 @@ copy ..\..\gameplay\res\logo_powered_white.png res</Command>
<Media Include="res\common\audio\braking.wav" />
<Media Include="res\common\footsteps.wav" />
</ItemGroup>
<ItemGroup>
<Text Include="res\common\sprites\level.txt" />
<Text Include="res\common\sprites\player1.txt" />
<Text Include="res\common\sprites\player2.txt" />
<Text Include="res\common\sprites\player3.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
47 changes: 47 additions & 0 deletions samples/browser/sample-browser.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
<Filter Include="res\common\particles">
<UniqueIdentifier>{98333a4d-224e-4f83-ac60-baca4885bf82}</UniqueIdentifier>
</Filter>
<Filter Include="res\common\sprites">
<UniqueIdentifier>{5f9e3afc-ab2a-463d-9376-9d9df3e9fed4}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="game.config" />
Expand Down Expand Up @@ -307,6 +310,12 @@
<None Include="res\common\particles\grid.material">
<Filter>res\common</Filter>
</None>
<None Include="res\common\sprites\sprite.scene">
<Filter>res\common\sprites</Filter>
</None>
<None Include="res\common\sprites\water2d.frag">
<Filter>res\common\sprites</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\MeshPrimitiveSample.h">
Expand Down Expand Up @@ -544,6 +553,30 @@
<Image Include="res\common\particles\smoke.png">
<Filter>res\common\particles</Filter>
</Image>
<Image Include="res\common\sprites\background.png">
<Filter>res\common\sprites</Filter>
</Image>
<Image Include="res\common\sprites\level.png">
<Filter>res\common\sprites</Filter>
</Image>
<Image Include="res\common\sprites\player1.png">
<Filter>res\common\sprites</Filter>
</Image>
<Image Include="res\common\sprites\player2.png">
<Filter>res\common\sprites</Filter>
</Image>
<Image Include="res\common\sprites\player3.png">
<Filter>res\common\sprites</Filter>
</Image>
<Image Include="res\common\sprites\rocket.png">
<Filter>res\common\sprites</Filter>
</Image>
<Image Include="res\common\sprites\water2d.png">
<Filter>res\common\sprites</Filter>
</Image>
<Image Include="res\common\sprites\water2d-noise.png">
<Filter>res\common\sprites</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<Media Include="res\common\footsteps.wav">
Expand All @@ -553,4 +586,18 @@
<Filter>res\common\audio</Filter>
</Media>
</ItemGroup>
<ItemGroup>
<Text Include="res\common\sprites\level.txt">
<Filter>res\common\sprites</Filter>
</Text>
<Text Include="res\common\sprites\player1.txt">
<Filter>res\common\sprites</Filter>
</Text>
<Text Include="res\common\sprites\player2.txt">
<Filter>res\common\sprites</Filter>
</Text>
<Text Include="res\common\sprites\player3.txt">
<Filter>res\common\sprites</Filter>
</Text>
</ItemGroup>
</Project>
Loading

0 comments on commit aa1f685

Please sign in to comment.