From 6fe884cd5ab710211aedab6c18e3f99d24381a51 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Wed, 26 Mar 2014 10:44:01 +0100 Subject: [PATCH] Platform and PlatformSystem added to the game. WiP. --- CMakeLists.txt | 2 ++ resources/graphics/platform.png | Bin 0 -> 2813 bytes src/platform.cpp | 41 +++++++++++++++++++++++++ src/platform.hpp | 46 ++++++++++++++++++++++++++++ src/platformsystem.cpp | 51 ++++++++++++++++++++++++++++++++ src/platformsystem.hpp | 43 +++++++++++++++++++++++++++ 6 files changed, 183 insertions(+) create mode 100644 resources/graphics/platform.png create mode 100644 src/platform.cpp create mode 100644 src/platform.hpp create mode 100644 src/platformsystem.cpp create mode 100644 src/platformsystem.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 36ea89a..671b8d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,8 @@ add_executable(${PROJECT_NAME} src/drawable.cpp src/sizeratio.cpp src/sizenotifiable.cpp + src/platform.cpp + src/platformsystem.cpp ) target_link_libraries(${PROJECT_NAME} diff --git a/resources/graphics/platform.png b/resources/graphics/platform.png new file mode 100644 index 0000000000000000000000000000000000000000..a5acc2c60dd10290499171aada40371f081fc6ee GIT binary patch literal 2813 zcmVWFU8GbZ8()Nlj2>E@cM*019PEL_t(&-qqRJb6Zz(2JqkA zu#+ITYPW28obkj{Qbpf6+(4e9{IgL z_|7BS8Y1C44;E5qp8B)@^jEKTXP;+Dyx7=>w$=?0T$ zT;EzZ5Q#(rfkM{J5LvP9p|5=DiF-CRBuEV$+qPrFD?R5XMkZ2$SS%LEP0dWZ>2CHx z^J7hSJoYcX^R+Lmm*(FFK!8|NM@vK04L;q=767aX6*4oac{i6Y01=2))Kyg_0&}@c zsBY5(U;3TL?&@fY1p>JhYu0Sqw(rQPGebjjp-@dlA$76%wmW`51l`Dr9bfy#cb<4; zU9DW>(&=4;A{2_%wA93(?*We`a&u!NW2sc35J)t%tY~XV#O6}OT6Wxb-$UEh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m4 zoJvbd92*$AFjIdIWoKoz;RD=K2o`N~?7w{Jkqs>YhE5$jHZ(9WbgZYRXN0IA8ov=m{2TSU~WHB2Ck{n@@p)@=x7PW2r+cV=X4Vx(_qY=)8Z zvW6?nq|)7t?nq|r)Js)C3BZmM=N{QmQ1RLq*=v3CQrO5$oI3VK-|9O_ypS3>GZSfPm6RRa2#{PRHCxm$vA=rbnLC;SxeI5d zmNzq(n=KyQ%`xkyrsZ@?0d+U)PRtEd%CxxAa2m9EXm#K^gQ>#A~7eG{>UP1`oK zD0{V+UOF+i;y};CvQAt0+L1jk>^szdD`@N%-I+5-Uf9uA(YivlnTa#c{iG*#Pu~NZ z8f9m>X!KJPLq|>>8w)jKQ>hEdqBoM7n|rGbf1pLvNfJyfwcJf}uk%Y+6$lsFxWmH*;p+55Bjj@Y1QF zJGM$qYr$L-Cywpw=@|<&f~77SmL<-6&iS+MjY6S{xLi0ll?o)9>KYP()Yyd!V{=4m zrK($(U}o$>--XG$@_9G1?y+zE(RaSEsU}jG>U-&X|Lt#H$!vM(v4^&7s!F8hhK3HD z*mvNKiO_0%^Zb5`v72`blTxu?lvD*~W(H+*+%*ae%rL5Uf^O9z7^S@l* zfvQNR@4mK*%*c^ve)QA}hcf2|dS2PErlle?G1M>f+OfWwME$pGTHYr;U%wx`^t9sE zd#GTU28$2*VK-E>>AnXZyJt;ZYT(eGU+n7{NF|z9wRN=08e<{-_YDlnyhi-L3c&ke z*)4wM9Fdwe8@6p~sg-w5M|#c-&3ALUv5J~nc`=vC%*;&8q;J9hKLFr2f-x$E`&Bg& zW-bhjOcv%ZxhN7Llq;l*I`Jy}|8D`HyAbXdl4?=bEc3Evc_$Fx=XL)BZvUZ#;xB(d P00000NkvXXu0mjfRvBUH literal 0 HcmV?d00001 diff --git a/src/platform.cpp b/src/platform.cpp new file mode 100644 index 0000000..0bf89bd --- /dev/null +++ b/src/platform.cpp @@ -0,0 +1,41 @@ +/* + Copyright 2014 Michele "King_DuckZ" Santullo + + This file is part of CloonelJump. + + CloonelJump is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + CloonelJump is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with CloonelJump. If not, see . +*/ + +#include "platform.hpp" +#include "texture.hpp" +#include + +namespace cloonel { + ///-------------------------------------------------------------------------- + ///-------------------------------------------------------------------------- + Platform::Platform (SDLMain* parSdlMain, const float2& parPos, Texture* parTexture, const float2& parSize) : + m_screenRatio(parSdlMain), + m_position(parPos), + m_size(parSize), + m_surface(parTexture) + { + assert(m_surface); + } + + ///-------------------------------------------------------------------------- + ///-------------------------------------------------------------------------- + void Platform::Draw() const { + m_surface->Render(m_position, m_size, m_screenRatio.Ratio(), false); + } +} //namespace cloonel diff --git a/src/platform.hpp b/src/platform.hpp new file mode 100644 index 0000000..988b3a1 --- /dev/null +++ b/src/platform.hpp @@ -0,0 +1,46 @@ +/* + Copyright 2014 Michele "King_DuckZ" Santullo + + This file is part of CloonelJump. + + CloonelJump is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + CloonelJump is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with CloonelJump. If not, see . +*/ + +#ifndef idDBDFC83B5EBA417D96A342111BFA463E +#define idDBDFC83B5EBA417D96A342111BFA463E + +#include "sizenotifiable.hpp" +#include "drawable.hpp" + +namespace cloonel { + class Texture; + class SDLMain; + + class Platform : public Drawable { + public: + Platform ( SDLMain* parSdlMain, const float2& parPos, Texture* parTexture, const float2& parSize ); + virtual ~Platform ( void ) noexcept = default; + Platform& operator= ( Platform&& parOther ); + + virtual void Draw ( void ) const; + + private: + SizeNotifiable m_screenRatio; + float2 m_position; + const float2 m_size; + Texture* const m_surface; + }; +} //namespace cloonel + +#endif diff --git a/src/platformsystem.cpp b/src/platformsystem.cpp new file mode 100644 index 0000000..5a29693 --- /dev/null +++ b/src/platformsystem.cpp @@ -0,0 +1,51 @@ +/* + Copyright 2014 Michele "King_DuckZ" Santullo + + This file is part of CloonelJump. + + CloonelJump is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + CloonelJump is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with CloonelJump. If not, see . +*/ + +#include "platformsystem.hpp" +#include "platform.hpp" + +namespace cloonel { + ///-------------------------------------------------------------------------- + ///-------------------------------------------------------------------------- + PlatformSystem::PlatformSystem() : + m_platforms() + { + } + + ///-------------------------------------------------------------------------- + ///-------------------------------------------------------------------------- + PlatformSystem::PlatformSystem (PlatformSystem&& parOther) { + m_platforms.swap(parOther.m_platforms); + } + + ///-------------------------------------------------------------------------- + ///-------------------------------------------------------------------------- + PlatformSystem::~PlatformSystem() noexcept { + } + + ///-------------------------------------------------------------------------- + ///-------------------------------------------------------------------------- + void PlatformSystem::SpawnPlatforms() { + } + + ///-------------------------------------------------------------------------- + ///-------------------------------------------------------------------------- + void PlatformSystem::GarbageCollect() { + } +} //namespace cloonel diff --git a/src/platformsystem.hpp b/src/platformsystem.hpp new file mode 100644 index 0000000..8b5df3d --- /dev/null +++ b/src/platformsystem.hpp @@ -0,0 +1,43 @@ +/* + Copyright 2014 Michele "King_DuckZ" Santullo + + This file is part of CloonelJump. + + CloonelJump is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + CloonelJump is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with CloonelJump. If not, see . +*/ + +#ifndef id17908979556C47F8A978688BBE4A9D22 + +#include + +namespace cloonel { + class Platform; + + class PlatformSystem { + public: + PlatformSystem ( void ); + PlatformSystem ( const PlatformSystem& ) = delete; + PlatformSystem ( PlatformSystem&& parOther ); + ~PlatformSystem ( void ) noexcept; + PlatformSystem& operator= ( const PlatformSystem& ) = delete; + + void SpawnPlatforms ( void ); + void GarbageCollect ( void ); + + private: + std::vector m_platforms; + }; +} //namespace cloonel + +#endif