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

Pages: [1]
1
General / Choosing a File
« on: September 25, 2013, 09:00:09 pm »
Hello,

Currently developing a game in SFML where levels are saved as XML file, I would like to add to my GUI a button that displays a window to let the user choose the file level.xml he wants to chose.
Is it possible to do so ? Like letting the user browse a repertory to select the level he wants to load.

Please let me know if you have any idea on how to implement this properly ;)

Thanks !

2
Window / SFML : trying to open a WxFrame
« on: July 10, 2013, 06:00:10 pm »
Hello community,

For some reasons ( I need to display curves that I have generated ), I need to merge WxWidget and SFML.
I don't want to put SFML in a wxFrame, I just want to be able to create a new window ( a wxFrame ) from SFML.

To be precise, I got my all GUI made with SFML (super easy to use this library, this is awesome :D), and I got a button on this GUI called "create Curve". When the user clicks on this button, I would like to open a WxFrame (using wxMathPlot) to display some curves generated.
Any one has an idea how to do this ? I've been able to draw a wxFrame + my SFML GUI but the wxFrame is "dead".
I do not know if it is possible tho, but I feel that it is ;) .
Any ideas are welcome ;)

3
Window / Minimizing window - bug or me ?
« on: June 24, 2013, 10:17:17 pm »
Hello!

I think I have found a bug due to Windows7 use (not sure if it's me or a bug, but i'm pretty sure this is a bug or something just different from windows 'minimize' function).
Here is my code :
    while (windowMain.isOpen())
        {
                sf::Event event;
                while (windowMain.pollEvent(event))
                {
                        switch (event.type)
                        {
                                case sf::Event::Closed: // closing using the cross button of the window
                                        windowMain.close(); // close the main window and gets out of this loop
                                        break;
                                       
                                case sf::Event::GainedFocus :
                                        if (minimized) // just to draw the window only when needed
                                        {
                                                windowMain.clear(COLOR_BACKGROUND_WINDOW);
                                                mGUInterface.drawIn(windowMain,mFont);
                                                windowMain.display();
                                        }
                                        minimized = false;
                                        break;
                                       
                                case sf::Event::LostFocus :
                                        if (windowMain.getSize().y == 0)
                                        {
                                                minimized = true;
                                        }
            }
        }
    }

The bug is : clicking on the minimize button then on the window to have it displayed works well, but using the little button in Windows7 called 'Show Desktop' that minimizes all the windows, doesn't.
I have no idea if this is a bug or just maybe something done different with the 'minimize button' of windows7 desktop, but I wanted to share this with you if you haven't seen this already ;)
I hope it can help/improve something (i don't know if I'm mistaking saying this is a bug, but it apparently looks like one).

EDIT : Also, clicking on the program task bar to minimize the program will minimize it, but restauring it will not display the window again. Is this because the size of the window is 0,0 when clicking on the minimize button & not 0,0 when reducing from the menu taskbar ?

Edit-EDIT : yes it's correct ! The size is not 0,0 when minimizing from Windows taskbar.
However, do you know how to get this event ?

Thanks if you have the solution for this ;)

4
Window / [SOLVED] sf::Event::LostFocus
« on: June 21, 2013, 09:01:42 pm »
Hello community =)

I have a question about the event : sf::Event::LostFocus and sf::Event::GainFocus.
I have 2 sf::RenderWindow opened. Let's call them window1 and window2.
Window1 is permanently opened, and window2 can open itself from interactions with window1 ( if you click on a button from window1, you will see window2 appear, "partially on" window1).
That works well and I get focus on window2 when opening it.

However, if, from here, I click on window1, I do not get an event lost focus from window2. Clicking on an other application exactly the SAME way will give me the event 'lostfocus'.
I do not know if this is a problem in my program or a problem from SFML library. Please help me, I have no idea how to correct this bug,

Thanks in advance,

Gabriel

5
Graphics / [SOLVED] Draw "not standard" char
« on: June 13, 2013, 10:13:52 pm »
Hello,

I want to draw some unusual characters like Ω. I know it is possible because when I do like this :

text.setString(L"Ω");

It works.
however, I want to do something much more like this :

string newText="blablaΩΩΩ";
text.setString(newText);

( Sorry for not putting the 'code part' not in between good tag but you can see just above that I had some issues displaying Ω in [ code ] tag. )
This displays '?' instead of 'Ω' . Is that possible to cast a string as a "L string" ? If so, how shall I do this ?

Thanks,

Gabriel

6
Window / [SOLVED] Put Window in foreground
« on: June 12, 2013, 05:19:29 pm »
Hello,

I was wondering if there was a way to put a window on the foreground.
To be precise, let's imagine you have 2 different windows, window1 and window2. Both are visible and displayed. When you are on window1, I would like to set window2 on the foreground when i click on a button from window1 without having to re-create window2 (it works to recreate window2, but I don't want to have to re-load all elements from window2 which are already displayed), I just want to make window2 go on foreground.

If this is possible, please tell me how.

Thanks in advance,

Gabriel

7
General / Get the key pressed on keyboard
« on: June 05, 2013, 05:45:10 pm »
Hello,

After reading the tutorial on event/keyboard, I was wondering if we had to make all tests like that :
Code: [Select]
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) {}
Or if it was possible to get the char/stream entered on the keyboard, thus doing the test much more like that :
Code: [Select]
if (event.type == sf::Event::KeyPressed)  // in the "while (window.pollEvent(event))" loop
{
  // getKeyPressed
  // use the input on keyboard
}
Is this possible ? and if so, how can we catch this (into a sf::Text) as an example ?
If this is not possible, can I get help on how to do it manually ?

Thanks !

8
General / SFML in a Qt Window using Visual Studio
« on: June 04, 2013, 10:47:13 pm »
Hey,

I am trying to integrate SFML 2.0 in a QT larger Window, and I'm using Visual Studio 2010.
Any one got an idea on how to link these elements ? (SFML works well on Visual Studio, but I have no idea how to add Qt to it).

Thanks a lot,

Gabriel.

9
Window / [SOLVED] Remove Resize Function
« on: June 04, 2013, 05:08:19 pm »
Hello,

I am confused about how to do this : I just want the user not to be able to re-size the window. Is this possible ?
Also, is this normal that the scale of the objects in the scene doesn't move while we change the window size ?

Thanks by advance!

EDIT : sorry, I don't know how the search function works. However, I've just seen that there was a post answering the question.

10
Window / [SOLVED] MouseClic / MousePressed
« on: May 31, 2013, 09:02:40 pm »
Hello guys !
I have a little question about mouse event : I do not want to be in the polling loop (that's cool because actually, the mouse can be handled separatly). However, when I clic on the window, the meter counting the number of clics don't increase by 1 but increase depending on how long I let the mouse button pressed.
Question : is it possible to get only once in the loop ( thus triggering the event on the clic and not on the pressed action ) ?
Here is the code :

if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
{
        sf::Vector2i localPosition = sf::Mouse::getPosition(window);
        if ((myElectrode->getShape()).isPositionInside((sf::Vector2f) localPosition)) // the function always return true at the moment
        {
                count++;
                string windowTitle = to_string((long double) count);
                window.setTitle(windowTitle);
        }
}
 

Thanks in advance,

Gabriel.

11
Graphics / event on a clic on a Shape
« on: May 31, 2013, 03:03:30 pm »
Hello guys !

I am new to SFML ( how come I didn't know about it before :P ), and looking at the documentation + some topics on the forum, I didn't find function that permits to get an event if the user clicks on a ConvexShape.
If you have any idea/solution, I would like to have advices.
( I've seen the function getGlobalBounds, But I'd rather have the shape itself and not a rectangle containing the shape ).

Thanks in advance,

Gabriel.

Pages: [1]
anything