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

Pages: [1]
General discussions / Free C++ Game Dev Book using SFML only Today!
« on: April 20, 2017, 08:47:15 am »
Hey guys,

Packtpub gives away a free C++ Game Dev Book using SFML: https://www.packtpub.com/game-development/procedural-content-generation-c-game-development

You can get the free eBook here https://www.packtpub.com/packt/offers/free-learning and only today 20.04.2017, so go get a copy. I already own the book as it was on sale at x-mas last year for 5$, and I can say it is worth it. It is not totally about SFML, but rather focuses on procedural generation of content, but makes good use of SFML to get things on screen.


General discussions / SFML in german magazine C'T
« on: April 20, 2016, 01:33:28 pm »
Hi Folks,

as a german member of the SFML community and a fellow reader of german computer tech magazine C'T, I wanted to inform you that in their newest special issue about programming, there is an article series about making a Breakout clone with Box2D and SFML. If you understand german and are interested, the issue can be purchased here (with no shipping costs this month) https://shop.heise.de/katalog/ct-programmieren-2016

The source code of the project can be found here https://github.com/ola-ct/impac-t

Also interesting for you SFML dev's is the summary of SFML in the article: "[SFML] honors its name, is simple and fast".


Graphics / [Solved] Problem with calculating global bounds
« on: October 28, 2015, 11:29:26 am »
Hi all,

I'm currently developing a class which represents a text menu for applications (like a main menu for a game). While doing so, I oriented myself at the sf::Text - class, which is used internally for displaying individual meny entries. It works as intended but when calculation the global bounds of the complete menu, the top-left coordinate of the menu is 0.f, 0.f. Width and height should be the same like the local bounds, which is correct (209, 150 in my example below). The local bounds are correctly calculated and stored as a member inside the class.

I used the same method for calculating the global bounds like sf::Text or sf::Sprite do:
sf::FloatRect TextMenu::getGlobalBounds() const
  return getTransform().transformRect( getLocalBounds() );  

... which should return the global coordinates of the menu with all transformations applied.

I have no idea why the global bounds are not correct.   :-\
The complete code with minimal example can be found here: https://github.com/SeriousITGuy/SFML-TextMenu

It is not a deal-breaker as the rest works like intended and is ready to use in my other projects, just wondering why this happens  ;)
I plan on posting this class in the wiki once it's completed and therefor it would be good to get rid of this minor issue.

Hi Folks,

I have a pretty weird problem with contructing a sf::Vector2f from a sf::FloatRect, the x and y values of the vector are wrong. I create a sf::FloatRect for my game world, and want to create a sf::Vector2f for the spawn point of my character, which should spawn in the middle of the game world. I calculate the spawn position like this:

GameWorld::GameWorld( sf::RenderWindow& window)
  : _window( window )
[ ... ]
  , _worldBounds( 0.f, 0.f, 1600.f, 1200.f )
  //, _spawnPosition( 800.f, 600.f )
  , _spawnPosition( _worldBounds.width / 2.f, _worldBounds.height / 2.f )

The result should be 800, 600, but in reality is
_spawnPosition.x = -53687088.000000
_spawnPosition.y = -53687088.000000

Code architecture is based on the SFML Book code base.
Code Example
(click to show/hide)

Visual Studio 2013.4 with SFML 2.2 stable

I can't track down the source of the problem. Any thoughts?
Every suggestion welcome, I go crazy about this.


Feature requests / Can sf::Transformable have a alignOrigin function?
« on: July 04, 2014, 10:17:17 am »
Hi there,

in my recent projects experimenting with 2D Game Engines, I always end up writing utility-functions for aligning the origin of sfml objects like sf::Text, sf::Shape and sf::Sprite relatively to the sprite size, like e.g set the origin to the center, or Top-Right, Bottom-Left etc.

Here's my reference code

Centering the origin relatively to the entity size is very often used, and I use the other relative alignments for displaying GUI-Objects. It would come in really handy if sf::Transformable would have an abstract function alignOrigin( Alignment align) which then gets implemented by the child classes like shape, text etc., and if one designs his own entities with sf::Transformable, he could implement it for his own classes.

So accompanying sf::Transformable::setOrigin for setting the absolut origin, a alignOrigin for setting the relative origin would be a valuable addition in my opinion.

Thanks in advance!

Pages: [1]