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

Pages: [1]
1
Graphics / Possible bug in sf::Text
« on: September 26, 2012, 04:42:32 pm »
Hi Laurent,

I am experiencing some unexpected behavior with sf::Text. The easiest way to explain is with an example:
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
        sf::RenderWindow window( sf::VideoMode( 800, 600 ), "SFML" );
        window.setVerticalSyncEnabled( true );

        sf::Font font;
        font.loadFromFile( "arial.ttf" );

        sf::Text text( "M", font );
        std::cout << "text width: " << text.getLocalBounds().width << std::endl;

        text.setString( sf::String( "" ) );
        std::cout << "text width: " << text.getLocalBounds().width << std::endl;

        while( window.isOpen() )
        {
                sf::Event event;
                while( window.pollEvent( event ) )
                        if( event.type == sf::Event::Closed )
                                window.close();

                window.clear();
                window.display();
        }
}
 

Here is what the program outputs in my case:
text width: 23
text width: 23
 

This is the output I was expecting:
text width: 23
text width: 0
 

It seems that the bounding box data isn't always updated when the string is changed.

I hope this is clear enough!

2
General / boost and SFML
« on: August 28, 2012, 12:10:53 am »
I am finally going to install boost and play with it.

I am using the BoostPro 1.51.0 Installer (32-bit) on a Windows 7 system with Visual studio 2010, and the installer gives several options for versions to install:
  • Multithreaded DLL
  • Multithreaded
  • Multithreaded, static runtime
  • Single threaded, static runtime
Is there a preferred version to use with SFML?

I am installing it now because I need a portable way of handling files, and boost::filesystem looks nice.
Are there other boost libraries you would recommend I install?
I only do small games and graphical applications, so nothing too complicated or sciencey  :D

3
Feature requests / setOutlineThickness negative values
« on: July 15, 2012, 01:19:48 pm »
Hi Laurent,

In SFML 1.x you could give negative values for outline thickness. This was really practical for outlining without changing the size of the shape. This is not possible with SFML 2, where negative values for setOutlineThickness aren't allowed.

I hereby request that the feature be added to SFML 2.

4
Audio / Sound listener relativity bool inverted
« on: July 04, 2012, 01:26:22 am »
Hello Laurent,

When I was playing around with listener rotation back in May, I noticed that sf::Sound::setRelativeToListener seemed to be inverted. I didn't mention it back then because I had my head in the rotation thing, and I wanted to test it properly and provide minimal code to show the problem, if there was one.

Now I finally did, and there seems to indeed be a problem. Here is the code to show it:
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>


int main()
{
        sf::RenderWindow window( sf::VideoMode( 800, 600 ), "Relative to listener oddity" );
        window.setVerticalSyncEnabled( true );

        // Setup listener
        sf::Listener::setPosition( 0.f, 0.f, -1.f );
        sf::Listener::setDirection( 1.f, 0.f, 0.f );
       
        // Setup sound
        sf::SoundBuffer soundResource;
        soundResource.loadFromFile( "pling.wav" );
       
        sf::Sound soundEmitter( soundResource );
        soundEmitter.setPosition( 0.f, 0.f, 0.f );
        soundEmitter.setLoop( true );
        soundEmitter.play();

        // Listener orientation clock
        sf::Clock listenerOrientationClock;

        // Instruction text
        sf::Text instructionText( sf::String( "Press space to change listener relativity" ) );
        instructionText.setPosition( 0.f, 50.f );


        while( window.isOpen() )
        {
                // Handle events
                sf::Event event;
                while( window.pollEvent( event ) )
                {
                        if( event.type == sf::Event::Closed )
                                window.close();
                        else if( event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Space )
                                soundEmitter.setRelativeToListener( !soundEmitter.isRelativeToListener() );
                }

                if( listenerOrientationClock.getElapsedTime().asSeconds() > 1.f )
                {
                        sf::Listener::setDirection( -sf::Listener::getDirection().x, 0.f, 0.f );
                        listenerOrientationClock.restart();
                }

                // Draw scene
                window.clear();

                if( soundEmitter.isRelativeToListener() )
                        window.draw( sf::Text( sf::String( "Emitter is relative to listener" ) ) );
                else
                        window.draw( sf::Text( sf::String( "Emitter is not relative to listener" ) ) );

                window.draw( instructionText );

                window.display();
        }

        return EXIT_SUCCESS;
}
 

As you will notice, the sound will be affected by the listener's rotation when setRelativeToListener( false ), and vice versa.

5
Audio / Listener rotation
« on: May 21, 2012, 11:38:51 pm »
Hi Laurent,

I am in the process of testing SFML 2 RC and its many features, (re)making a little game.
So far it is loads of fun and pretty simple to use, but I do have a question about the Listener class:

How would one go about rotating the listener around the z-axis, like sf::View does with setRotation?

Thank you in advance!

6
SFML website / SFML 2 Threads tutorial typo
« on: May 17, 2012, 01:50:00 pm »
I see you have started uploading tutorials for SFML 2. Great!

Here is your first bug report:

From Threads tutorial:
// with lambdas
sf::Thread thread([](){
    std::cout << "I am in thread!" << std::endl;
});

I suppose you meant to be using the same coding style throughout. :)

7
General discussions / And for my birthday I wish...
« on: February 14, 2012, 03:09:18 am »
Today, the 14th, is my birthday. That means I am allowed wishes, don't you know?

So here is my wish:

That Laurent will work on SFML today.
Implementing the new naming convention would be my preference, and a big step for SFML, but anything would be great, really.

Here is for hoping :)

8
Graphics / SFML2 - Error in comment
« on: March 19, 2011, 09:55:52 pm »
Hi Laurent,

I was looking through the source code of SFML 2 when I stumbled onto this, right at the top of Matrix3.inl:
Quote
// SFGE - Simple and Fast Multimedia Library


Was SFML called "Simple Fast Graphics Engine" at one point?

9
Hello Laurent,

I am in the process of writing a library, specifically for use with SFML. For that purpose, I need to include slightly modified parts of the SFML source.
One example of this is Input.cpp, where I have only changed a few lines.

However, I still want the changes to be copyrighted and licensed under the zlib license. This is only to ensure that it will always remain free for any purpose, and I don't actually care who owns the copyright.

So what should I put at the top of the file? Would the following be OK?
Code: [Select]
////////////////////////////////////////////////////////////
//
// SXGUI Input - Syncronized real-time input for SXGUI
//
// A slight variation on Input.cpp from SFML - Simple and Fast Multimedia Library,
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
//
// The modifications are Copyright (c) 2010 Rasmus F. Rasmussen
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
//    you must not claim that you wrote the original software.
//    If you use this software in a product, an acknowledgment
//    in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
//    and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
////////////////////////////////////////////////////////////

10
Window / SFML 1.6: Bug with key up event and LALT?
« on: November 24, 2010, 04:56:16 am »
Hi Laurent,

I believe I may have fount another bug with the keyboard events:

The first time I press and release LALT, I get no key up event.
The second time, I get 2 key up events: 1 when I press LALT, and 1 when I release it.

It doesn't happen with other keys.

Can you confirm that?

I could write you a minimal example, but it really is as simple as checking for
Code: [Select]
if( event.Type == sf::Event::KeyReleased && event.Key.Code == sf::Key::LAlt )in the event loop. ;)

Thanks!

11
Window / Switching between windowed mode and fullscreen
« on: February 27, 2010, 05:09:07 am »
Hi,

Is it possible to switch between windowed mode and full screen mode, while a program is running?
I can't find a setting for this in SFML 1.5...

I use a sf::RenderWindow, if that is of consequence.

12
Window / SFML 1.5: Bug in window.GetInput().IsKeyDown() ?
« on: February 10, 2010, 08:49:16 am »
I am having a weird problem with GetInput() in combination with window.GetEvent() and sf::Event::MouseMoved.

Here is the offending code:
Code: [Select]
sf::Event event;

while(window.GetEvent(event))
{
...snip...
else if(event.Type == sf::Event::MouseMoved)
{
sf::Vector2f canvasMouseCoord = window.ConvertCoords(event.MouseMove.X, event.MouseMove.Y, &canvasCam);
// If we're in drag-mode (the left mouse button is down)
if(dragging)
{
// If a vertex is selected, drag it to the mouse position
if(selectedVertice != -1)
{
sf::Vector2f newPosition(canvasMouseCoord.x/meter_to_pixel, canvasMouseCoord.y/meter_to_pixel);

// If left shift and left control is held down, snap to 1cm
if(window.GetInput().IsKeyDown(sf::Key::LShift) && window.GetInput().IsKeyDown(sf::Key::LControl))
{
newPosition.x = floor((newPosition.x * 100.f) + .5f)/100.f;
newPosition.y = floor((newPosition.y * 100.f) + .5f)/100.f;
}
// If left control is held down, snap to 10cm grid
else if(window.GetInput().IsKeyDown(sf::Key::LControl))
{
newPosition.x = floor((newPosition.x * 10.f) + .5f)/10.f;
newPosition.y = floor((newPosition.y * 10.f) + .5f)/10.f;
}
shape.point[selectedVertice] = newPosition;
}
}
}
}
Everything works well when I only use left control, but if I use left control plus left shift, and move the mouse around real quick, then GetInput() doesn't seem to register when I let go of left shift - window.GetInput().IsKeyDown(sf::Key::LShift) simply keeps evaluating true.

If I hold the mouse still and press shift again, then the problem goes away.
This is the only place in the code where I do anything with keyboard events, at all.

Is this a bug, or am I using it wrong?

I am using Visual C++ 2008 Express on Windows XP.

13
General / Problems building "Using CEGUI In SFML" tutorial c
« on: December 12, 2008, 10:49:03 am »
First, I wasn't sure where to put this, so I hope here is OK.

I am trying to build the "Using CEGUI In SFML" tutorial code from the wiki, but I can't get it to work. I get 69 linker errors. :?

Here is a sample:
Code: [Select]
1>App.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class CEGUI::Window * __thiscall CEGUI::System::setGUISheet(class CEGUI::Window *)" (__imp_?setGUISheet@System@CEGUI@@QAEPAVWindow@2@PAV32@@Z)
1>App.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class CEGUI::String const CEGUI::FrameWindow::EventCloseClicked" (__imp_?EventCloseClicked@FrameWindow@CEGUI@@2VString@2@B)
1>App.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall CEGUI::UVector2::UVector2(class CEGUI::UDim const &,class CEGUI::UDim const &)" (__imp_??0UVector2@CEGUI@@QAE@ABVUDim@1@0@Z)
1>GUIManager.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class CEGUI::SchemeManager & __cdecl CEGUI::Singleton<class CEGUI::SchemeManager>::getSingleton(void)" (__imp_?getSingleton@?$Singleton@VSchemeManager@CEGUI@@@CEGUI@@SAAAVSchemeManager@2@XZ)
1>GUIManager.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual class CEGUI::Rect __thiscall CEGUI::OpenGLRenderer::getRect(void)const " (__imp_?getRect@OpenGLRenderer@CEGUI@@UBE?AVRect@2@XZ)
1>GUIManager.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall CEGUI::System::injectKeyUp(unsigned int)" (__imp_?injectKeyUp@System@CEGUI@@QAE_NI@Z)
If you want to see the rest, please let me know ;) They are all LNK2001

The included sample project is in Visual Studio 2008 format, but I am using the 2005 version, which can't read the project file. Therefore I am starting from scratch.

Here is what I have done:

1) I downloaded CEGUI 0.6.2b Binary Downloads for Microsoft Visual C++ 8 (2005) - With SP1 SDK and installed it.

2) I added these lines to the VC++ directories:

Library files:
...\CEGUI-SDK-0.6.2-vc8\dependencies\lib
...\CEGUI-SDK-0.6.2-vc8\lib

Include files:
...\CEGUI-SDK-0.6.2-vc8\include
...\CEGUI-SDK-0.6.2-vc8\RendererModules\OpenGLGUIRenderer

The last one, \RendererModules\OpenGLGUIRenderer, wasn't in the tutorial, but the program was looking for it when I first tried to compile it (in a later step), so I added it.

3) I started a new empty Win32 project (not a console project), copied the source and header files from the tutorial project to the new project folder, and added them to the project.

4) I set the project to compile in release mode (as that was what was done in the tutorial), and added these to Linker/Input/Additional Dependencies, in the project properties:
Code: [Select]
sfml-graphics.lib sfml-main.lib sfml-system.lib sfml-window.lib glu32.lib pcre.lib CEGUIBase_Static.lib CEGUIExpatParser_Static.lib expat.lib CEGUISILLYImageCodec_Static.lib SILLY.lib OpenGLGUIRenderer_Static.lib CEGUIFalagardWRBase_Static.lib

5) Tried compiling, and got the errors above.  :?

I am not overly experienced, so it is probably (hopefully) something something painfully obvious and simple.

I really hope someone can help, as I would like to get started on learning this crazy GUI thing.


Thank you in advance!

14
SFML website / Bug in the menu
« on: December 10, 2008, 11:16:35 am »
Hi,

I found a bug on the web page: On all pages under http://www.sfml-dev.org/documentation/1.3/ the roadmap link in the side menu still leads to http://www.sfml-dev.org/roadmap.php, which is no longer there.

Have a nice day! :)

15
Graphics / Screen capture crash, and some linker warnings
« on: May 04, 2008, 12:16:53 am »
Hi, I'm new.

First, I'd like to say thank you for making this wonderful software!
I am pretty sure I will be ditching SDL for this.

I am at the "Using render windows" tutorial (http://www.sfml-dev.org/tutorials/graphics-window.php), and the screenshot part is giving me trouble.
That is, when I try to take one, the program crashes with an unhandled exception. I have narrowed it down to the App.Capture() method.

I am using Visual Studio 2005 standard on Windows XP pro.

Here is what I am linking against, compiling in debug mode:
sfml-system-d.lib
sfml-window-d.lib
sfml-graphics-d.lib
In that order.

I also get 64 linker warnings. Example:
Quote
sfml-system-d.lib(Platform.obj) : warning LNK4099: PDB 'vc80.pdb' was not found with 'C:\Program Files\Microsoft Visual Studio 8\VC\lib\sfml-system-d.lib' or at 'c:\C++\Mine test\SFML test\debug\vc80.pdb'; linking object as if no debug info
The other 63 warnings are similar (all LNK4099).
When linking a release build against the non-debug .lib files, I get no warnings.

I hope someone can help. Thank you in advance!

Pages: [1]
anything