[Added] Enemy player detection and shooting, [Moved] Lots of entity code to cpp files to avoid circular dependencies
This commit is contained in:
@@ -8,44 +8,43 @@
|
||||
#include "services/AssetService.h"
|
||||
#include "services/StateService.h"
|
||||
|
||||
class Background {
|
||||
public:
|
||||
Background() {
|
||||
|
||||
class Background
|
||||
{
|
||||
public:
|
||||
Background()
|
||||
{
|
||||
}
|
||||
Background(EBackground background){
|
||||
// Texture2D texture = AssetService::getInstance().getBackground(background);
|
||||
TextureWrapper wrapper = TextureWrapper(AssetService::getInstance().getBackground(background), StateService::getInstance().getScreenSize(), {0,0});
|
||||
wrapper.setSourceRect({0,0,wrapper.getSize().x, wrapper.getSize().y});
|
||||
textures.push_back(wrapper);
|
||||
Background(EBackground background)
|
||||
{
|
||||
TextureWrapper wrapper = TextureWrapper(AssetService::getInstance().getBackground(background), StateService::getInstance().getScreenSize(), {0, 0});
|
||||
wrapper.setSourceRect({0, 0, wrapper.getSize().x, wrapper.getSize().y});
|
||||
textures.push_back(wrapper);
|
||||
}
|
||||
Background(std::vector<TextureWrapper> backgrounds)
|
||||
{
|
||||
for (int i = 0; i < backgrounds.size(); i++)
|
||||
{
|
||||
this->textures.push_back(backgrounds[i]);
|
||||
}
|
||||
Background(std::vector<TextureWrapper> backgrounds){
|
||||
for(int i = 0; i < backgrounds.size(); i++) {
|
||||
this->textures.push_back(backgrounds[i]);
|
||||
}
|
||||
}
|
||||
~Background(){}
|
||||
// Vector2 getPosition();
|
||||
// void updatePosition(Vector2 deltaPos);
|
||||
// void setPosition(Vector2 position);
|
||||
void draw(){
|
||||
for(int i = 0; i < textures.size(); i++) {
|
||||
TextureWrapper texture = textures[i];
|
||||
// Rectangle sourceRect = {0, 0, texture.getSize().x, texture.getSize().y};
|
||||
DrawTextureRec(texture.getTexture(), texture.getSourceRect(), texture.getPosition(),WHITE);
|
||||
}
|
||||
}
|
||||
~Background() {}
|
||||
void draw()
|
||||
{
|
||||
for (int i = 0; i < textures.size(); i++)
|
||||
{
|
||||
TextureWrapper texture = textures[i];
|
||||
DrawTextureRec(texture.getTexture(), texture.getSourceRect(), texture.getPosition(), WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 getBackgroundSize() {
|
||||
TextureWrapper lastbg = this->textures[this->textures.size()-1];
|
||||
return {lastbg.getPosition().x + lastbg.getSize().x, lastbg.getPosition().y + lastbg.getSize().y};
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<TextureWrapper> textures;
|
||||
// Vector2 position;
|
||||
// Vector2 size;
|
||||
Vector2 getBackgroundSize()
|
||||
{
|
||||
TextureWrapper lastbg = this->textures[this->textures.size() - 1];
|
||||
return {lastbg.getPosition().x + lastbg.getSize().x, lastbg.getPosition().y + lastbg.getSize().y};
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<TextureWrapper> textures;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user