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

Pages: 1 [2]
Feature requests / sf::Rect extension
« on: August 28, 2014, 03:04:53 pm »
I think it will be useful functions to get position, size and (position + size) of the rectangle class instead of using everywhere in the code sf::Vector2(rect.left, rect.top) use simple rect.getPosition().

I don't want to make a pull request, 'cause some my things (like doxygen comments and formatting) may differ of what supposed to be. So here's a simple patch. And I don't know, how to name function returning (position + size) :D

diff --git a/include/SFML/Graphics/Rect.hpp b/include/SFML/Graphics/Rect.hpp
index 2880722..d565b5e 100644
--- a/include/SFML/Graphics/Rect.hpp
+++ b/include/SFML/Graphics/Rect.hpp
@@ -146,6 +146,36 @@ public :
     bool intersects(const Rect<T>& rectangle, Rect<T>& intersection) const;
+    /// \brief Get the position of the rectangle
+    ///
+    /// This returns the position of the rectangle
+    ///
+    /// \return Rectangle position
+    ///
+    ////////////////////////////////////////////////////////////
+    Vector2<T> getPosition();
+    ////////////////////////////////////////////////////////////
+    /// \brief Get the size of the rectangle
+    ///
+    /// This returns the size of the rectangle
+    ///
+    /// \return Rectangle size
+    ///
+    ////////////////////////////////////////////////////////////
+    Vector2<T> getSize();
+    ////////////////////////////////////////////////////////////
+    /// \brief Get the position of the far point of the rectangle
+    ///
+    /// This returns the position of the far point of the rectangle
+    ///
+    /// \return Rectangle position of the far point
+    ///
+    ////////////////////////////////////////////////////////////
+    Vector2<T> getPositionFar();
+    ////////////////////////////////////////////////////////////
     // Member data
     T left;   ///< Left coordinate of the rectangle
diff --git a/include/SFML/Graphics/Rect.inl b/include/SFML/Graphics/Rect.inl
index 4a92397..779c904 100644
--- a/include/SFML/Graphics/Rect.inl
+++ b/include/SFML/Graphics/Rect.inl
@@ -157,3 +157,27 @@ inline bool operator !=(const Rect<T>& left, const Rect<T>& right)
     return !(left == right);
+template <typename T>
+Vector2<T> Rect<T>::getPosition()
+    return Vector2<T>(left, top);
+template <typename T>
+Vector2<T> Rect<T>::getSize()
+    return Vector2<T>(width, height);
+template <typename T>
+Vector2<T> Rect<T>::getPositionFar()
+    return Vector2<T>(static_cast<T>(left + width), static_cast<T>(top + height));

SFML wiki / SFML dynamic color tile-based lighting
« on: August 27, 2014, 11:12:48 am »
Some time ago i've posted info about the project I'm working on (F.I.R.E.D. http://en.sfml-dev.org/forums/index.php?topic=16025.0)

And now I've decided to make a simple demo and write an article about my lighting system.

Sources: https://github.com/achpile/sfml-lighting
Article: https://github.com/SFML/SFML/wiki/Tutorial:-Dynamic-colorful-tile-based-lighting

So, if you'll find something wrong or untold in the article - feel free to post your requests ;)

PS: to compile demo you have to install sfgui.

SFML projects / F.I.R.E.D. v0.99.pre-alpha
« on: August 10, 2014, 08:28:44 pm »
Good day! Let me introduce a game I developed for 13-14 months. But it's still just an engine. It is a platformer with rpg elements (You can wear different armors, equip different weapon and different ammo). You gain XP after killing enemies, increasing your level and basic skills (Strength, Constitution, Dexterity and Intelligence) and your main characteristics depend on it (Shooting accuracy, speed, acceleration, jump, HP, aim range and XP bonus).

Official website: http://achpile.tk/
Github repo: https://github.com/achpile/fired
Screenshots : http://achpile.tk/projects/fired/screenshots
Contacts: http://achpile.tk/contacts.php

For now only Linux and Windows binaries are available (http://fired.tk/downloads/1/)

Main features:
  • Dynamic light
  • Tiled map with borders calculation
  • Weather system
  • 3 armor sets
  • Bone animation based on model type
  • 3 model types (humanoid, animal, spider)
  • 13 weapons
  • 5 weapon types (Automatic guns, Pistols, Shotguns, Explosive and Melee)
  • 14 creatures (5 critters, 3 bosses (with big loot) and 6 common enemies)
  • 2 demo game modes (common and 'I Hate Critters'). I don't want to talk about it. Just try it out  :)
  • ...and more stuff I can't remember  :D

  • A - move left
  • D - move right 
  • SPACE - jump
  • S - jumpdown 
  • LEFT MOUSE - shot 
  • Q - switch weapon
  • E - interact 
  • C - character window 
  • I - inventory window 
  • ESC - main menu

The game have no conception yet. Only in my mind. And I want to talk about it. As I told, for now it's a simple 'game engine'. So, it would be great to hear your suggestions for project's future.

For me it is:
2 basic locations (Home and City). At home you can store your stuff and there will live some private NPC (appears after some conditions). In City there will be public location for all players on the server. They can create parties to go to dungeons or quest locations or go there alone, interact with common NPC (traders, quest, etc.). When party/player will go to dungeon/quest location the new map will be randomly generated. Also there will be several biomes, contains own style and world generators. And maybe there will be arenas, or something similar (PvP) game modes.

If you have own suggestion, found a bug, or there is something else you wanna tell me - post it here, or in forums at http://fired.tk/forum/

Thanks for attention!  ;)

Graphics / Scale sprites with repeating instead of stretching
« on: July 19, 2013, 09:30:16 am »
Hi. I'm new in SFML, but have experience in OpenGL.
Well... Is there a way to fill background with some sprite in SFML v1.6?

For example sprite size is 512x512, screen size is 1024x768.

If I resize it to screen size, the texture coordinates will still be the (0, 0) - (1, 1) and the sprite streches.
How can I resize sprite with changing texture coordinates to (0, 0) - (2, 1.5) to fill all the background without "for" statements etc.?

I've read about sf::RenderTexture and method setRepeated(bool), but it is in SFML v2.0

Pages: 1 [2]