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.


Messages - sc

Pages: [1]
1
Graphics / Re: problem using texture [solved]
« on: March 20, 2016, 02:30:34 pm »
Ah ... OK.
Thank you very much for the tips !

2
Graphics / Re: problem using texture
« on: March 20, 2016, 01:26:51 pm »
You were absolutely right !

Coming from Java, it is a bit of a strange concept that a getter also returns a copy ...

3
Graphics / problem using texture [solved]
« on: March 20, 2016, 10:56:12 am »
Hi guys !

I have been playing around with the tilemap class ( http://www.sfml-dev.org/tutorials/2.3/graphics-vertex-array.php#example-tile-map ), and everything is working fine : I can display 2 'test' layers in one of the viewports I set up.

I next wanted to display the tileset texture that was loaded inside the tilemap class in a second viewport. But here, I ran into trouble and I don't understand why ...

class TileMap : public sf::Drawable, public sf::Transformable {
   public:
        bool load() {
           if (!texTileSet.loadFromFile("maps/newTileSet.png")) {
                return false;
           }
           //...
        }

        sf::Texture getTileSet() { //THIS IS NOT WORKING
           return texTileSet;
        }

        //...

   private:
        sf::Texture texTileSet;
        //...
}


Main.cpp
int main() {
   //...
   TileMap tileMap;
   if (!tileMap.load()) {
        return -1;
   }

   sf::Sprite sprite;
   sprite.setTexture(tileMap.getTileSet());

   window.draw(sprite);
   //...
}
 

The result of this code : "not_ok.png" (no errors or crashes).

On the other hand, if I reload the texture inside main, all is fine.
Main.cpp
int main() {
   //...
   TileMap tileMap;
   if (!tileMap.load()) {
        return -1;
   }

   sf::Texture texTileSet;
   if (!texTileSet.loadFromFile("maps/newTileSet.png")) { //THIS IS OK
           return false;
   }

   sf::Sprite sprite;
   sprite.setTexture(tileMap.getTileSet());

   window.draw(sprite);
   //...
}
 

The result of this code : "ok.png".

What am I doing wrong here ?   :-[
Thanks !

4
General / Re: creating a sidebar menu
« on: March 09, 2016, 08:42:21 am »
Thank you both for your help !  :)

So, just to make sure I understand ... You are talking about something like this, right ?!
window.clear();
window.setView(view_menu);
window.draw(rect1); //draw menu elements here
window.setView(view_map);
window.draw(rect2); //draw map stuff here
window.display();
 

5
General / creating a sidebar menu
« on: March 08, 2016, 02:34:28 pm »
Hi guys,

I wondered if someone more experienced could point me in the right direction for this ? I have been searching the forum and tutorials, but so far I haven't really found what I'm looking for.

I would like to create an application with a sidebar menu, that contains clickable icons and input fields. See for example "Pioneers" http://img.photobucket.com/albums/v315/joshua_skelton/pioneers_climbing_small_zps65302f50.png.

I understand one can use GUI libraries and such, but my question is about the creation of the sidebar itself. Is that a second window, or a second layer, or ... ?

Thanks for the help !!!

6
Ah ...
So, I take it by 'optimized' you mean 'compiled with an /O option' ?


7
Hi guys,

Could someone explain to this C++/SFML noob what the difference is between the release and debug versions of the libraries ?

Thanks !

Pages: [1]