Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Resethel

Pages: [1]
1
Audio / [Mac] SFML using deprecated Carbon Component Manager ?
« on: November 04, 2015, 11:38:20 pm »
Hi there!
I just recently passed to OSX 10.11.1 and noticed a warning on exit when using the SFML audio module. It says

2015-11-04 23:17:10.816 Breakout-Clone
[8530:1171230] 23:17:10.816 WARNING:  140: This application, or a library it uses, is using the
deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed
in a future release. Also, this makes the host incompatible with version 3 audio units. Please
transition to the API's in AudioComponent.h.

And here is the minimal code that trigger it!

#include "ResourcePath.hpp"
#include <SFML/Audio.hpp>

int main(int, char const**)
{
    sf::SoundBuffer Buffer;
   
    Buffer.loadFromFile(resourcePath() + "Sound.ogg");
   
    sf::Sound newSound;
    newSound.setBuffer(Buffer);
   
    newSound.play();
   
}

The warning is triggered on exit ( since it's a deprecation issue ) and is also triggered while using sf::Music

I hardly used SFML for sounds purpose, so I didn't noticed this until now !
I'm currently using SFML 2.3.2 alongside Xcode 7.0.1 and since i found no issue request about this, I wanted to ask if the problem comes from me ( which would be quite astonishing ) or if there is a fix already planned?

Thanks you for listening

2
General / Advices needed for a HUD/GUI
« on: July 24, 2015, 08:51:15 pm »
Hello everyone,

I've reached, in a recent project, the point where I must develop a HUD/GUI.
So I was wondering, how to correctly implement it?

Right now the solution I'm trying to build is:

  • Creating a base class from which each widget like buttons, sliders (and so on) will inherit
  • Creating a HUD/GUI class which will contain all the widget currently displayed, create them and draw them
  • The HUD/GUI class could handle the widgets' informations, I mean when I click on a button, the information will be sent to the HUD/GUI container class which will perform an action according to the message received

But I guess there are plenty of flaws by this method. So I thought that the HUD could be build as a single class with a vertex array, but I have no clue how to handle the "widgets" this way...

So I was wondering, is my first idea good and how can I improve it?Is the second method better? or should I process in a totally other way?

Anyway, thanks a lot for hearing my request :)

3
Graphics / Tiles: Questions about Layers[SOLVED]
« on: July 07, 2015, 04:02:24 pm »
Hello everyone


I'm currently working on a hexagonal tile based game and I got a little problem when it comes to layers.

Since in the game, all Layers are not forced to be drown at the same time I use only one vertexArray to stock the Layers of the map. When I have to draw all of them, I will just call my drawing function for layer-0,-1,-2,...,layer-N.

Given that each layer has a different texture, a specific texture is set for every single one of them.

The problem I got is that even with a color mask for each texture, while drown, tiles of inferior layers with no Tiles above them ( so they're theorically visible ) are not shown.

Here are my drawing functions:

bool MapManager::displayGlobalMap(sf::RenderWindow &window, int Layer)
{
    if (m_mapLoaded and Layer < m_Layers)
    {
        int tileType;
        int textureX,textureY;
       
        m_CurrentTileSet = Layer;
       
        Vector2f Center(0,0);
       
        m_vertices.setPrimitiveType(Quads);
        m_vertices.resize(m_TileNumber * 4);
       
       
        for (int j(0); j < m_MapSize.y; ++j)
        {
            for (int i(0); i < m_MapSize.x; ++i)
            {
           
                tileType = m_Map[i][j][Layer]; // le numéro de tuiles dans le set
           
           
                textureX = tileType % (LayersTilesets[Layer].getSize().x / m_TileSize.x);
                textureY = tileType / (LayersTilesets[Layer].getSize().x / m_TileSize.x);
           
           
                Vertex* quad = &m_vertices[(i + j * m_MapSize.x) * 4]; // on récupere 4 vertex(quads) que l'on va modifié
           
                Center = Vector2f(m_TileSize.x * ( (0.5*(j%2) + i) ), 0.75 * m_TileSize.y * j );
               
                // Position des vertex par rapport au centre
                quad[0].position = Center + Vector2f(+m_TileSize.x/2 , -m_TileSize.y/2);
                quad[1].position = Center + Vector2f(-m_TileSize.x/2 , -m_TileSize.y/2);
                quad[2].position = Center + Vector2f(-m_TileSize.x/2 , +m_TileSize.y/2);
                quad[3].position = Center + Vector2f(+m_TileSize.x/2 , +m_TileSize.y/2);
           
                // Texturage de la tuile
                quad[0].texCoords = sf::Vector2f(textureX * m_TileSize.x, textureY * m_TileSize.y);
                quad[1].texCoords = sf::Vector2f((textureX + 1) * m_TileSize.x, textureY * m_TileSize.y);
                quad[2].texCoords = sf::Vector2f((textureX + 1) * m_TileSize.x, (textureY + 1) * m_TileSize.y);
                quad[3].texCoords = sf::Vector2f(textureX * m_TileSize.x, (textureY + 1) * m_TileSize.y);
            }
        }
    }
   
    window.draw(*this);
    return m_mapLoaded;
}



bool MapManager::displayGlobalMap(sf::RenderWindow &window)
{
    for (int i(0); i < m_Layers; ++i)
    {
        displayGlobalMap(window, i);
    }
}


 

So i guessed it was a bad idea to stock them all in a single VertexArray/ As I understand it, while re-calling the draw function i just redefine the previous vertex, and I just erase from screen the previous layers?


In your opinion, how should I process to display them correctly? Like making multiple vertexArray but then, how do I draw them separately????

Thank you for taking the time to read my lounge post and my bad english :D

Pages: [1]