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

Pages: 1 [2] 3 4
16
General discussions / Re: SFML Game Development -- A book on SFML
« on: October 23, 2014, 05:08:16 pm »
Out of interest, have you encountered this problem in a specific situation, where the text was wrongly positioned?

It is subtle, but I have been noticing it everywhere I use text. You can see it in the book's project. The text is a bit lower than it should be in the screenshot.

17
General discussions / Re: SFML Game Development -- A book on SFML
« on: October 22, 2014, 01:31:17 pm »
I ran into a bug with the following function from utility.cpp.

void centerOrigin(sf::Text& text)
{
        sf::FloatRect bounds = text.getLocalBounds();
        text.setOrigin(std::floor(bounds.width / 2.f), std::floor(bounds.height / 2.f));
}
 

The left and top coordinates for sf::Text are not guaranteed to be zero. Corrected code:

void centerOrigin(sf::Text& text)
{
        sf::FloatRect bounds = text.getLocalBounds();
        text.setOrigin(std::floor(bounds.left + bounds.width / 2.f), std::floor(bounds.top + bounds.height / 2.f));
}
 

18
Graphics / Re: Assertion when passing string across a .dll boundary
« on: October 14, 2014, 12:55:52 pm »
Quote
You don't have by chance any other SFML DLLs in PATH?
That was the problem.

Thanks for the responses.

19
Graphics / Re: Assertion when passing string across a .dll boundary
« on: October 14, 2014, 12:23:26 pm »
Quote
What was the value of the SFML_USE_STATIC_STD_LIBS CMake option when you rebuilt SFML?
I left it unchecked.

Quote
Are you sure that you use the debug libraries in debug mode?
Yes, they are set to sfml-audio-d.lib, sfml-graphics-d.lib, sfml-system-d.lib, and sfml-window-d.lib.

20
Graphics / Assertion when passing string across a .dll boundary
« on: October 14, 2014, 11:58:14 am »
I am having an assertion when using sf::Text::getString().  I have attached an image of the message.

mText.setString("Hello");
std::string text = mTextLine.getString();  // Assertion!

Besides calling sf::Text::getString() everything is working fine when I use sf::Text. 

Searching around I found a similar issues on stackoverflow. http://stackoverflow.com/questions/18882760/debug-assertion-failed-expression-pfirstblock-phead I am having the same problem, "it blows up at the precise point where I pass a string back across a .dll boundary."

I have verified I have Multi-threaded Debug DLL (/MDd) set.  I have rebuilt SFML-2.1 with Visual Studio 2013.  Still the problem persists.

I am out of ideas.  Anyone have experience with this?

21
General / Re: Building SFML 2.1 for VS 2013
« on: October 14, 2014, 11:14:50 am »
Great!  Looks like I got it built, thanks.

22
General / Re: Building SFML 2.1 for VS 2013
« on: October 14, 2014, 11:03:56 am »
My VS install is up-to-date. 

I used NMake to create the libs, but I have a question in regards to this.  The reason I rebuilt my libs is they were built with VS2012.  During the entire process I never specified I wanted to build the libs with VS2013.  I have both VS2012 and VS2013 installed.  I assume it just defaulted to one of them.  How would I specify VS2013?

23
General / Building SFML 2.1 for VS 2013
« on: October 13, 2014, 10:12:26 pm »
I am attempting to build SFML 2.1 for VS 2013.  I am using the latest version of cMake 3.0.2.  When cMake prompts me I select Visual Studio 12 2013 and Use default native compilers.  Here are the options I use.

BUILD_SHARED_LIBS - No
CMAKE_BUILD_TYPE - Release
CMAKE_CONFIGURATION_TYPES - Debug;Release;MinSizeRel;RelWithDebInfo
CMAKE_INSTALL_PREFIX - C:/Program Files (x86)/SFML
GLEW_INCLUDE_PATH - C:/Users/My Name/Desktop/SFML-2.1/extlibs/headers
GLEW_LIBRARY - C:/Users/My Name/Desktop/SFML-2.1/extlibs/libs-msvc/x86/glew.lib
SFML_BUILD_DOC - No
SFML_BUILD_EXAMPLES - No
SFML_USE_STATTIC_STD_LIBS - No

I then open SFML.sln receive the message that "One or more projects in the solution were not loaded correctly. Please see the Output Window for details."  When I try to compile the project I get errors of the following nature, "Error 1 error MSB4025: The project file could not be loaded. And error occurred while parsing EntityName."

This issue is similar to this thread from four years ago.  http://en.sfml-dev.org/forums/index.php?topic=3519.0

Any help would be appreciated.

24
Graphics / Re: Windowed to Fullscreen (change resolution)
« on: August 09, 2014, 05:56:58 pm »
Thanks for the response.  I have a follow-up question.  In what circumstance would I want the resolution to be different than the size of the view?  Or is this achieving the same effect as calling zoom on the view?

mWindow.create(sf::VideoMode(800, 600), "MyApp", sf::Style::Fullscreen);
sf::View(sf::FloatRect(0, 0, 400, 300));
 

25
Graphics / Windowed to Fullscreen (change resolution)
« on: August 09, 2014, 12:37:41 pm »
I've been working on letting the user switch between windowed and fullscreen.  When I switch from 800x600 windowed mode to fullscreen I want to use the desktop's resolution.  I can fetch the desktop's resolution using VideoMode::GetDesktopMode() function.  However, I am not sure how to apply the new resolution.




26
General / Re: Tiled Background & Performance (Q and Benchmarks)
« on: July 24, 2014, 03:08:08 pm »
Good advice.  Thanks!

27
General / Tiled Background & Performance (Q and Benchmarks)
« on: July 24, 2014, 02:09:08 pm »
I recently added a tiled background to my project.  It was a straightforward implementation.  I parse the information from a tmx file (Tiled Editor) and then loop through each layer and tile.  I have two layers and my map is 50 tiles by 50 tiles.  So to draw the background I loop 5,000 times (2 layers x 50 tiles wide x 50 height).

Looking at the debug and release build before implementing this I was running at 680 FPS.  If I loop through the logic, but don't call the draw method my release's performance holds at  680 FPS, but my debug's performance plunges to 40 FPS!  Next, if I loop through all the logic, and call the draw method my debug FPS drops to 15 and my release FPS drops to 330.

First, I thought it was really strange the performance hit looping through the logic takes in debug mode.  That's a 17x performance decrease.  It seems very quickly my game would become unplayable in debug mode. 

Next, my release mode is running at 330 FPS with a character and a background.  That seems fast enough, but I wish I had something to compare it to.  Does this seem like a reasonable place to begin building a simple 2D game on?

Finally, I can think of a number of optimizations.  The simplest being to not redraw the character and background every single frame.  I mention the character and background together, because I center the camera on the character.  They are linked.  Is there a "recommended" number of times to redraw per second?


28
Static libraries must not be linked from other static libraries -- they are all linked from the final executable.

You get access to SFML simply by including it. The symbols will be resolved when you link the executable.

Now I understand, thanks.

29
You seem to be thinking including a header would link a library; thats wrong. A header normally does only contain declarations that the compiler can use.
Library building and linking is a separate concept that depends on how you use the library archiver or linker program and only uses object files and library files.

I linked SFML to my static library just as I would link my game project to SFML.  The only difference being the librarian.  I thought that was what I needed to do.  I got the warnings and realized I was doing something wrong. 


Now I am trying to figure out how to get access to SFML from my static library.

30
I was linking a static library to SFML.  I am trying to move some generic game systems into a static library for reuse on other projects.  However, I ran into this problem. 

As my second post says I stopped linking my my static library and used forward declares (linking to SFML in my game).  However, I just ran into the situation where I am inheriting a SFML class and a forward declare will not work (incomplete type is not allowed) in my static library.

...instead link all the static libraries in the final application.

I may just not understand, but I don't see how this solves the problem.  If my static library needs definitions from SFML how does linking my static library and SFML in my game fix this?

Pages: 1 [2] 3 4