Skip to content

Commit

Permalink
Merge branch 'development' into serial-experiments-lain
Browse files Browse the repository at this point in the history
  • Loading branch information
FergusonAJ authored Dec 5, 2023
2 parents 18851a1 + d5abd3b commit 448771e
Show file tree
Hide file tree
Showing 24 changed files with 881 additions and 404 deletions.
Binary file added assets/walls/portal1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/walls/portal2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/walls/portal3,png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/walls/portal4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/walls/teleport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/weapons/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/weapons/15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/weapons/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/weapons/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/weapons/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 3 additions & 4 deletions source/Interfaces/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ void i_2D::Button::setMFont(const sf::Font &font) {
*/
void i_2D::Button::setPosition(sf::Vector2f pos) {
button.setPosition(pos);

float xPos = (pos.x + button.getGlobalBounds().width / 2) - (text->getLocalBounds().width/2);
float yPos = (pos.y + button.getGlobalBounds().height / 2) - (text->getLocalBounds().height/2);
text->setPosition({xPos, yPos});
Expand All @@ -51,10 +50,10 @@ bool i_2D::Button::isMouseOver(sf::RenderWindow &window) {
float btnPosX = button.getPosition().x;
float btnPosY = button.getPosition().y;

float btnxPosWidth = button.getPosition().x + button.getLocalBounds().width;
float btnyPosHeight = button.getPosition().y + button.getLocalBounds().height;
float btnXPosWidth = button.getPosition().x + button.getLocalBounds().width;
float btnYPosHeight = button.getPosition().y + button.getLocalBounds().height;

if(mouseX < btnxPosWidth && mouseX > btnPosX && mouseY < btnyPosHeight && mouseY > btnPosY){
if(mouseX < btnXPosWidth && mouseX > btnPosX && mouseY < btnYPosHeight && mouseY > btnPosY){
return true;
}
return false;
Expand Down
3 changes: 1 addition & 2 deletions source/Interfaces/Component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

namespace i_2D
{
class Component : public sf::Drawable
, public sf::Transformable
class Component : public sf::Drawable, public sf::Transformable
{
public:
typedef std::shared_ptr<Component> Ptr;
Expand Down
40 changes: 40 additions & 0 deletions source/Interfaces/Group3_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,44 @@ The function ensures that the user's interactions with the maze application are
<details> <summary>Functionalities:</summary>

### <span style="color: orange;"> Button Constructor
</details>










# <span style="color: green;">TextureHolder Class</span>


## <span style="color: aqua;">Description

The `TextureHolder` class is responsible for creating and storing references to sf::Texture objects. It is given a file, generates an sf::Texture, and readily gives a reference to the generated texture when asked.
<details> <summary> Functionalities </summary>

### <span style="color: orange;">LoadTexture Function

The `LoadTexture` function is a part of the `TextureHolder` class and is responsible for generating sf::Textures from a given file path.

The `LoadTexture` function consists of the following main functionalities:
- Attempt to generate sf::Texture using given file path
- Store the generated sf::Texture in a map using the id as a key

The function allows new sf::Textures to be instantiated and stored to the class for future reference calling by id.


### <span style="color: orange;">GetTexture Function

The `GetTexture` function is a part of the `TextureHolder` class and is responsible for getting a reference to the initialized sf::Texture with the matching id.

The `GetTexture` function performs the following key tasks:
- Determine if there is a loaded texture with the given id
- Return the dereferenced sf::Texture that matches the id

The function allows for easy reference to any of the loaded sf::Textures without having to instantiate new ones for each use.

</details>
4 changes: 4 additions & 0 deletions source/Interfaces/Inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ void i_2D::Inventory::ConstructInventory(sf::Font &font) {
mInventoryWindow->setSize({mWorldSize.x,mWorldSize.y/2});
mInventoryWindow->setFillColor(sf::Color::Black);
mInventoryWindow->setPosition(sf::Vector2f{0.f,50.f});

// Set row & col sizes
if(mWorldSize.x > 1800){
mCol = 5;
}else mCol = 3;
if(mWorldSize.y > 900){
mRow = 4;
}else mRow = 3;

// Create 2d vector of buttons
for(int i = 0; i < mRow; i++) {
std::vector<std::unique_ptr<Button>> v1;
for (int j = 0; j < mCol; j++) {
Expand Down
Loading

0 comments on commit 448771e

Please sign in to comment.