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 - Favor98

Pages: [1]
1
General / Re: Creating custom buttons
« on: May 22, 2014, 07:06:21 pm »
Right so I created 1 texture with 2 images, I managed to use SetTextureRect but I got little issues with mouse settings now. I used

if (event.type == Event::MouseMoved)
         {
            mouse_poz = Mouse::getPosition();

mouse_poz is of Vector2i type. Now how do I get bounds of the texture, I know I got 2 functions for it but what's this FloatRect I just don't know how to store the values in a variable :(

if I set position like if(mouse_poz.x > 0 && mouse_poz.x < 100 && mouse_poz.y > 0 && mouse_poz.y < 100) then it works but only if my window is maximized/positioned in upper left corner....how can I set it up so it works relatively to the window position

2
General / Re: Creating custom buttons
« on: May 22, 2014, 02:31:51 pm »
Nvm I fixed it, seems like sfml only supports 8bit PNGs....only 1 thing I'd like to know....if I want to create an effect that when I mouse over text, should I make it in a way that if the event when mouse is over it to change the image, ofc then I need to create another image just with aditional effects.

3
General / Re: Creating custom buttons
« on: May 22, 2014, 02:25:41 pm »
Ok I managed to save it but now my program exits when I try to load it from file.

Texture NewGame;
      if (!NewGame.loadFromFile("Images/NewGame2.png"))
         return -1;
      S_newgame.setTexture(NewGame);
      window.draw(S_newgame);

4
General / Creating custom buttons
« on: May 22, 2014, 02:05:10 pm »
I'm completely new to sfml and I'd like to know how you guys manage to create and display custom made images for buttons/menus and such.

I've seen this thread: http://en.sfml-dev.org/forums/index.php?topic=3265.0
and I'd like to know how to create, save and load the custom made texture.

I created a simple texture for test in PS, without background, only text and if I save it as .bmp it doesn't display anything when I load it but if I flatten layers then it displays the text with white background. How can I make it to display the text alone.

Pages: [1]