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

Pages: 1 [2] 3 4 ... 124
16
Feature requests / Re: Image saving
« on: July 02, 2019, 05:39:32 pm »
Well, SFML uses void now because everywhere the buffer size is known and 'big enough'.

This can't happen with std::vector so a different API would have to be made to allow user to alloc a buffer and handle failure nicely, something like:
bool sf::Image::saveToMemory(void * buff, std::size_t size, std::size_t& outsize);

Where return bool would say if there was enough space to write it all out or not and outsize would always contain how much bytes would be written if there was enough space. Some C, POSIX and WinAPI functions do it that or similar way (like some signed size type as return and -1 there as error), even allowing calling with NULL ptr and 0 size to get just the output size but that's starting to get too un-SFML-like (and kind of cumbersome to use, I always wrap these myself to just do right thing with dynamic allocation in C and C++ when I need them or make sure the buffer is way bigger than required so they can't fail).

With std::vector (which I don't mind since it solves the size problem and SFML already uses STL a lot and isn't some tight no-lib-side-mem-alloc-ever low-level hardcore library) either char or uchar are fine. Either choice will have someone preferring the other one, since both have decent reasons for being used (char is 'default' byte type to use, and uchar has the nice property of being unsigned so no sign and sign extensions shenanigans take place).

Alternatively a callback function or class could be used and use a const void ptr there but that still leaves a sort of gap in API where reading can be done from 3 source (stream, file, memory) and writing to 2 (file, stream) with memory missing/part of stream (while for reading there is memory input stream but also outright loadFromMemory call that takes just const void ptr and size).

17
Feature requests / Re: Image saving
« on: July 02, 2019, 05:11:32 pm »
That part is there in C++98 and I've never heard of any 'padding' in chars (that'd then not be there for signed/unsigned chars). char, unsigned char and void ptrs get used to mean 'binary data' all the time in APIs.

18
Feature requests / Re: Image saving
« on: July 02, 2019, 04:42:58 pm »
What is that padding in char that you speak of? Char is often signed and that's the 'problem' but char, signed char and unsigned char are three same sized and distinct types (even though char is 100% like one of the other two).

19
Feature requests / Re: Image saving
« on: July 02, 2019, 02:42:03 am »
Audios yes but why fonts? There's a ton of ways to make an image and a few ways (stitch or mix two buffers, record, create samples programmatically) to make audio but there isn't any font editing/mixing/making in SFML. If you want to 'save' a font to a file in memory just take the file you're using and load it all into memory somehow and that's it there.

20
Audio / Re: Audio module, linker errors while static linking.
« on: June 30, 2019, 01:44:55 pm »
The missing functions are OpenAL ones. In first post you say you linked OpenAL but in your list in the second post it's missing. Can you double check that?

21
Network / Re: Build SFML for Steam on Windows
« on: June 29, 2019, 11:28:38 pm »
I'm assuming they meant that nothing special needs to be done on Windows where you just bring all the dlls or statically link all the libs you need?

22
DotNet / Re: Layer lighting help
« on: June 14, 2019, 07:01:17 pm »
Lights (of whatever colors) should be drawn with additive blending to the black texture (the order doesn't matter either), than that texture should be multiplied with the world (that is "100% lit" if drawing the lighting texture is off).

Here's an example: https://en.sfml-dev.org/forums/index.php?topic=22180.msg156718#msg156718

23
Remove the () from this line: sf::RenderWindow window(); //Creates a window

You also don't need sf::Event as a member, using namespace is not too good of a practice (especially std one), and you can call sf::VideoMode's static functions like: sf::VideoMode::getDesktopMode() instead of the way you do it now (instancing an object just to call a static method).

24
Graphics / Re: Drawing onto an externally-created context
« on: June 12, 2019, 06:56:27 pm »
Quote
SFML always creates its own OpenGL context, even if you embed it into an existing window.
This (yes, I see it's old 2018 post) is no longer true in code on GH btw if you don't want SFML's context: https://github.com/SFML/SFML/pull/1484

Quote
I don't think there's a way to make it use an external context.
Still true AFAIK.

25
Window / Re: Event::KeyPressed not working now?
« on: June 04, 2019, 06:39:39 am »
         if (event.type = Event::Closed)

This line is an assignment, not a comparison, and Event::Closed is (usually?) 0 so it'll not close the Window and it prevents handling any other event type because event.type is always Event::Closed.

26
General / Re: I can't get custom shapes to work
« on: June 02, 2019, 09:29:35 pm »
Do you still have a problem with this and if yes then can you create a minimal complete example of it?

27
Graphics / Re: Why I can't setTexture?
« on: May 31, 2019, 11:52:05 pm »
Not sure if [FIXED] means you guessed but the proper way is &pencilIcon.

28
General / Re: What Is Wrong With This Line Algorithm?
« on: May 17, 2019, 10:20:27 am »
You forgot: line.setPosition(ax, ay);

30
General discussions / Re: Goodbye
« on: May 01, 2019, 10:46:33 pm »
I still remember when it was just you two. This is so sad. :'(

Pages: 1 [2] 3 4 ... 124
anything