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

Pages: [1]
Feature requests / sf Image resize
« on: December 31, 2018, 03:57:49 am »
Hi, I feel that resizing an image is a concept that's very common. It would be nice if sf Image, and sf Texture could have functions to actually resize its pixel dimensions.

I've seen threads that recommend pasting things into a rendertexture, window, etc. through a sprite, but this feels way too cumbersome for a concept that should just be simple.

With SFML's first S being 'simple', I feel this would be not only a very useful, but fitting small extension.

Audio / Getting audio amplitude
« on: January 30, 2017, 02:36:36 am »
Hi, I'm trying to implement a function that opens / closes the character's mouth (graphic) depending on the volume (amplitude) of the voice file currently being played.

I'm trying to read in whether the audio is above a certain amplitude (then thus switch to the open mouth graphic), or not (then thus switch to the closed mouth graphic).

I wasn't sure how to do this with SFML - any ideas?

Graphics / Text outline cuts into bold
« on: August 31, 2016, 04:56:29 am »
Hi, I'm still testing out the outline capabilities in the 2.4 update. I've noticed that the outline cuts into the size of the bold text, this seems like a bug that needs to be fixed.

I've attached an image with the bold text's outline set in ver 2.4 (left), and an image where I just print the text again in 8 directions around the bold text (right). It's quite apparent that the outline is cutting into the width of the bold, resulting in what looks like visually 'burnt' text.

Graphics / Text set outline results in uneven outlines
« on: August 30, 2016, 02:26:16 pm »
Hi, I've been testing out the outline feature shipped with sfml 2.4, but I'm noticing uneven outlines.
I've set my outline colour to black (0,0,0,255) and an outline thickness of 1.5, but as you can see in the screenshot, the outline thicknesses are uneven (even within the same letter)

General / sf::Font::getGlyph getting the code point
« on: August 05, 2016, 07:02:07 am »
Hi, I'm trying to get glyph information for certain characters within a string. sf::Font::getGlyph however seems to take a codepoint int as it's argument though, which I'm finding difficulty in finding. How can find the codepoint of a given character?

It would be nice if this was a default override of sf::Font::getGlyph if not already implemented.

General / Multithreading texture loading and drawing
« on: July 16, 2016, 04:13:47 am »
Hi, I was wondering if it would be possible to load a texture in one thread, while another thread continues to draw. I'm noticing that if I try to load textures above 1mb, this can start causing lag up to roughly 200ms causing fps drops in drawing, and was wondering if this could be mitigated by using multiple threads.

System / sf::err output to wofstream
« on: November 02, 2015, 08:35:02 pm »
Hi, I'm currently using a wofstream to output to my debug file with wide characters.
I was wondering if sf::err() could somehow take in a wofstream instead of an ofstream.

Does anyone have any ideas?

Graphics / Question on setColor
« on: October 01, 2015, 02:42:15 am »
Hi, it currently seems that setColor on a sprite works so that the colour argument is multiplied against the original colour of the sprite texture.

Would it somehow be possible to make this additive instead?
(In which case setColour would need to take in rgb arguments of the range -255~255 to cover all colours possible)

Window / Question on Views
« on: April 06, 2015, 01:48:28 am »

 I was just wondering if for example I have 2 views, 1 overlapped over the other, then if the up-most view draws a sprite with a transparent background, then will the result come up as the bottom layer + the sprite on a transparent background (hence the lower layer contents showing in the background of the sprite), or will I get the sprite on a black background?

General / Implementing InputStreams
« on: February 04, 2015, 03:42:26 am »
Hi, I'm trying to implement a custom InputStream but I'm having trouble doing so.
I seem to be opening the zip file just fine, and the library I'm using (https://bitbucket.org/wbenny/ziplib/wiki/Home) automatically gives me an istream* to the

Yet I keep failing when I try to load the texture with the stream through:

Any ideas as to what I'm doing incorrectly?

P.S. I'm currently trying to develop this to be able to open password protected zip files.
This is code for a game engine I'm currently building and my users seem to want the
added security - hence I can't just use physfs or some other pre-existing library.

Here's my implementation:

Code: [Select]
#include <ZipFile.h>

namespace lvn
class NStream : public sf::InputStream
ZipArchiveEntry::Ptr m_entry;
std::shared_ptr<std::istream> m_File = nullptr;
std::string m_filename;
//bool m_file_is_open = false;

static bool ReadTxtFile( std::string filepath, tstring& textbuffer );

NStream( std::string pathName="" );

virtual ~NStream();

bool isOpen() const;

bool open( std::string pathName );

void close();

virtual sf::Int64 read( void* data, sf::Int64 size );

virtual sf::Int64 seek( sf::Int64 position );

virtual sf::Int64 tell();

virtual sf::Int64 getSize();


Code: [Select]
#include <ZipFile.h>
#include "NStream.h"

namespace lvn
NStream::NStream( std::string pathName )
//: m_File( 0x00 )
using namespace std;
open( pathName );

NStream::~NStream( )
close( );

bool NStream::isOpen( ) const
//return (m_File != 0x0);
return ( m_File != nullptr );

//Ex. Images//albert.png
bool NStream::open( std::string pathName )
using namespace std;
close( );
auto archive_name = pathName.substr( 0, pathName.find( "/" ) ) + (".vndat"); //need to add the archive extension to the name

ZipArchive::Ptr archive = ZipFile::Open( archive_name );
m_entry = archive->GetEntry( pathName );
if ( m_entry == nullptr )
return false;

m_File = make_shared<istream>( nullptr );
m_File->rdbuf( m_entry->GetDecompressionStream()->rdbuf() );
m_filename = pathName;

return isOpen( );

void NStream::close( )
m_File.reset( );

sf::Int64 NStream::read( void* data, sf::Int64 size )
if ( !isOpen( ) )
return -1;

auto posPrev = tell();
m_File->read( static_cast<char *>( data ), size );
auto cur = tell();

return tell() - posPrev;

sf::Int64 NStream::seek( sf::Int64 position )
if ( !isOpen( ) )
return -1;

m_File->seekg( position );
return tell( );

sf::Int64 NStream::tell( )
if ( !isOpen( ) )
return -1;

// istream returns the offset in bytes or -1 on error just like SFML wants.
return m_File->tellg( );

sf::Int64 NStream::getSize( )
if ( !isOpen( ) )
return -1;

//get length of file (by seeking to end), then restore original offset
const auto originalIdx = tell( );
m_File->seekg( 0, m_File->end );
const sf::Int64 length = tell( );
seek( originalIdx );

// tell returns length of file or -1 on error just like SFML wants.
return length;

General / Zip file solution for Streams
« on: January 17, 2015, 08:25:49 pm »
Hi, I was wondering if anyone new of any zip file InputStream implementations (that also work with password encryption) for SFML.

Feature requests / sf::Text and line spacing
« on: November 07, 2014, 04:40:12 am »
Hi, I'm seeing that SFML currently doesn't have an option to
specifically set the spacing between lines in pixels for text.

This would be great for making small adjustments to text
to make it display better on screen.
(Instead of perhaps the lines too far apart, or too cramped up
top-bottom to each other)

Audio / Playing sound at volume above 100
« on: October 04, 2014, 07:59:53 pm »
The current implementation of sounds seems to limit
the volume at 100(%). It would be nice if sounds could
be played at higher volumes than they're original file volumes.

(ex. 250%, 500%, etc.)

Graphics / SFML Context Management
« on: June 26, 2014, 02:00:23 pm »
Hi, I'm currently working on a small game engine using sfml.

I've recently had users with intel graphics cards building reporting that they were getting corrupt images when loading image files. Sadly, I couldn't reproduce the problems with my graphics card.

In the end, I had to place a

pRenderWindow->setActive( true );

before each and every texture and view manipulation function
and a glFlush() right afterwards.

Users have been telling me since that they aren't getting the problems,
but I feel like this is a terrible ad-hoc hack just waiting to hit me in the face again any time.

Are there any plans to improve context management in sfml,
or is this the only way to prevent these weird bugs?

The attached image is a screenshot sent to me by one of my users -
there's this weird mixing of textures going on despite having loaded single image files.

I am not running the executable in a multithreaded fashion and all images loaded are done through
the normal .loadFromFile() function.

Graphics / Simple method to rotate sprite about it's centre point
« on: June 20, 2014, 06:43:10 am »
Hi, I was wondering if there was a simple way to rotate a sprite around it's centre point.

The rotate() function rotates about the sprite's top left corner,
which means I need to change the origin to the sprite's centre point.
However changing the origin then requires readjusting the position, and the scale.

Is there a simple way of going about this, or is this the only way?

I personally feel that rotation about the centre point is more instinctive and widely used than rotation about the top left corner (same with scaling). It would be great to have a function that easily gets this done if currently not implemented.


On second thought, perhaps a function on the lines of .setOriginAndReadjust() might be nice; where it not only changes the origin but also readjusts internal position, etc. to maintain the same visual appearance.

Pages: [1]