git repos / blockattack-game

commit 89b311eb

Poul Sander · 2019-03-27 19:34
89b311eb3b72873680622f43625f2d9b144db898 patch · browse files
parent 420ab05ca4a7c32a0a4679a449ee9402075acadd

Add ground to background

Changed files

M Game/data/sprites/blockattack1.sprite before
A Game/data/textures/background_ground.png
A source/assets/gfx/backgrounds/background_ground.svg
M source/code/main.cpp before
diff --git a/Game/data/sprites/blockattack1.sprite b/Game/data/sprites/blockattack1.sprite index 2774d9e..bc19114 100644 --- a/Game/data/sprites/blockattack1.sprite +++ b/Game/data/sprites/blockattack1.sprite
@@ -36,6 +36,15 @@
"number_of_frames" : 1,
"frame_time" : 1
},
+"background_ground" : {
+ "texture" : "background_ground",
+ "topx" : 0,
+ "topy" : 0,
+ "height" : 511,
+ "width" : 1920,
+ "number_of_frames" : 1,
+ "frame_time" : 1
+},
"ball_blue" : {
"texture" : "ball_blue",
"topx" : 0,
diff --git a/Game/data/textures/background_ground.png b/Game/data/textures/background_ground.png new file mode 100644 index 0000000..5e0dc35
Binary files /dev/null and b/Game/data/textures/background_ground.png differ
diff --git a/source/assets/gfx/backgrounds/background_ground.svg b/source/assets/gfx/backgrounds/background_ground.svg new file mode 100644 index 0000000..cd4a141 --- /dev/null +++ b/source/assets/gfx/backgrounds/background_ground.svg
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="210mm"
+ height="297mm"
+ viewBox="0 0 210 297"
+ version="1.1"
+ id="svg52"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)"
+ sodipodi:docname="background_ground.svg">
+ <defs
+ id="defs46" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.35"
+ inkscape:cx="400"
+ inkscape:cy="560"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="927"
+ inkscape:window-height="1016"
+ inkscape:window-x="993"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0" />
+ <metadata
+ id="metadata49">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <path
+ inkscape:connector-curvature="0"
+ style="opacity:1;fill:#eeff39;fill-opacity:1;stroke:none;stroke-width:4.23333311;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:4.23333333, 4.23333333;stroke-dashoffset:0;stroke-opacity:1"
+ d="M -28.877379,153.8995 H 242.05595 V 86.166171 c -88.50674,22.518259 -171.413605,-17.010807 -270.933329,0 z"
+ id="path3195"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccc"
+ id="path3197"
+ d="M -28.877379,153.8995 H 242.05595 v -47.52775 c -101.6,-8.912637 -162.059169,-3.9146 -270.933329,0 z"
+ style="opacity:1;fill:#ffdc39;fill-opacity:1;stroke:none;stroke-width:4.23333311;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:4.23333333, 4.23333333;stroke-dashoffset:0;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ style="opacity:1;fill:#ffed39;fill-opacity:1;stroke:none;stroke-width:4.23333311;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:4.23333333, 4.23333333;stroke-dashoffset:0;stroke-opacity:1"
+ d="M -28.877379,153.8995 H 242.05595 v -22.0837 c -101.6,8.67371 -162.059169,-3.91459 -270.933329,0 z"
+ id="path3199"
+ sodipodi:nodetypes="ccccc" />
+ <g
+ id="g3226"
+ transform="matrix(0.26458333,0,0,0.26458333,-40.821426,119.73046)"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3207"
+ d="m 479.10026,381.21815 -151.5226,135.76372 151.5226,81.29998 169.25958,-47.73819 z"
+ style="opacity:1;fill:#e0a010;fill-opacity:1;stroke:none;stroke-width:16;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:16, 16;stroke-dashoffset:0;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccc"
+ id="path3201"
+ d="M 640,547.38269 479.55512,386.86945 v 205.76807 z"
+ style="opacity:1;fill:#ffed39;fill-opacity:1;stroke:none;stroke-width:16;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:16, 16;stroke-dashoffset:0;stroke-opacity:1" />
+ <path
+ inkscape:connector-curvature="0"
+ style="opacity:1;fill:#ffdc39;fill-opacity:1;stroke:none;stroke-width:16;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:16, 16;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 335.94408,515.56288 479.55512,386.86945 v 205.76807 z"
+ id="path3205"
+ sodipodi:nodetypes="cccc" />
+ <path
+ inkscape:connector-curvature="0"
+ style="opacity:1;fill:#e0a010;fill-opacity:1;stroke:none;stroke-width:16;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:16, 16;stroke-dashoffset:0;stroke-opacity:1"
+ d="m 546.63271,577.77289 28.88608,-8.14388 -17.01682,-33.38335 -24.82398,7.00499 z"
+ id="path3224"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccc"
+ id="path3219"
+ d="m 549.75,572.82812 20.0625,-5.65624 -12.68701,-25.35645 -17.24121,4.86523 z"
+ style="opacity:1;fill:#493c00;fill-opacity:1;stroke:none;stroke-width:16;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:16, 16;stroke-dashoffset:0;stroke-opacity:1" />
+ </g>
+ </g>
+</svg>
diff --git a/source/code/main.cpp b/source/code/main.cpp index 882422f..0ab36c8 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp
@@ -271,7 +271,8 @@ void DrawBackground(SDL_Renderer* target) {
}
SDL_SetRenderDrawColor(target, 135, 206, 250, 255);
SDL_RenderClear(target);
- globalData.spriteHolder->GetSprite("background_sun").Draw(globalData.screen, SDL_GetTicks(), globalData.xsize-500, -400);
+ globalData.spriteHolder->GetSprite("background_sun").DrawScaled(globalData.screen, SDL_GetTicks(), globalData.xsize-320, -200, 600, 600);
+ globalData.spriteHolder->GetSprite("background_ground").DrawScaled(globalData.screen, SDL_GetTicks(), 0, globalData.ysize-200, globalData.xsize, 200);
//backgroundImage.DrawScaled(target, SDL_GetTicks(), 0, 0, globalData.xsize, globalData.ysize);
}