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 ... 123
SFML projects / Re: [Release][GUI] ImGui-SFML
« on: September 19, 2023, 09:26:10 pm »
I am doing it right now in my own game and yes, it's simple (for basic cases, maybe it'll break later and require more code):
static bool isMouseEvent(const sf::Event& eve)
    case sf::Event::MouseButtonPressed:
    case sf::Event::MouseButtonReleased:
    case sf::Event::MouseMoved:
        return true;
        return false;
    return false;

static bool isKeyboardEvent(const sf::Event& eve)
    case sf::Event::TextEntered:
    case sf::Event::KeyPressed:
    case sf::Event::KeyReleased:
        return true;
        return false;
    return false;

bool Game::handleEventGui(const sf::Event& eve)
    ImGui::SFML::ProcessEvent(m_win, eve);

    if(ImGui::GetIO().WantCaptureMouse && isMouseEvent(eve))
        return true;

    if(ImGui::GetIO().WantTextInput && isKeyboardEvent(eve))
        return true;

    return false;

SFML projects / Re: [Release][GUI] ImGui-SFML
« on: September 10, 2023, 11:20:52 pm »
Imgui (not Imgui-SFML) has a few globals for that called WantCaptureMouse, WantCaptureKeyboard, WantTextInput, etc.: https://github.com/ocornut/imgui/blob/master/imgui.h#L2081C17-L2081C33

I remember using those plus SFML event type (so if WantCaptureKeyboard is true then don't handle keyboard SFML event myself, etc.) and it was quite fine, I think.. I don't have the code anymore, but I'm sure it was using those.

SFML projects / Re: Screenshot Thread
« on: May 30, 2023, 06:09:42 pm »

Inspired by some games I'm heavily considering making my own "RPG Maker Mystery/Horror Game" style game, in C++, SFML, with Lua for scripting events, and few other libraries.

General discussions / Re: Taking On the Role As BDFL
« on: May 15, 2023, 02:28:37 am »
It's been years since I was last active on this forum so I'm not sure if you remember me. I was thinking of dabbling in C++ gamedev recently, so I looked towards SFML (of course...  :P ), but then noticed Laurent is not active on the forums and GH, but then also noticed that website and GH repo are updated, and then this thread and I had to reply.

Anyway: this choice of eXpl0it3r for BDFL is a very good one.

General / Re: Apparently random error in Config.hpp
« on: August 21, 2022, 05:55:45 pm »
From the error I am guessing you have, just before the include:
1. a class with no ; after the closing } (but that'd be a different error in modern GCC),
2. something like 'const int x = 10' without a semicolon after it (that gives that error message exactly).

Graphics / Re: Font LoadFromMemory issue.
« on: August 08, 2022, 07:16:49 pm »
Hello, when your osb::AssetPacker::LoadFontFromBin function returns, the std::vector<char> buffer; is destroyed. For Fonts this is wrong, as documentation can tell you: https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1Font.php#abf2f8d6de31eb4e1db02e061c323e346

This is unique to Font and Music objects, IIRC, you are right that other resources like Texture and Image don't have this problem (they don't need buffer to be alive).

You should make that buffer part of same class/object as the font, so they have same lifetime. Your code to load data from file could use some improvement too (load more than 1 byte at a time).

General / Re: Exception thrown when attempting to run an SFML project
« on: April 17, 2020, 02:49:22 am »
It's due to that sf::Texture being global, it tries to access things that aren't ready yet when it's being constructed.

Although I can't now quickly find what code would fail (it might be loadExtensions at https://github.com/SFML/SFML/blob/master/src/SFML/Window/GlContext.cpp#L235 , it gets called eventually due to sf::Texture constructor being called, and it accesses globals, so there's the order conflict potential) or why and can't reproduce it but writing location 0x00000004 looks like attempt to write via pointer that's null.

Here's someone else's thread of similar issue years ago and answer is (and still is, I think) to not use globals because they might mess init order of SFML's own globals: https://en.sfml-dev.org/forums/index.php?topic=5654.0

SFML website / Links in Tutorials lead to outdated DoxyGen docs
« on: August 04, 2019, 11:32:51 pm »
Minor nitpick I just ran into.

They now lead to "Documentation of SFML 2.5.0" which has the "Warning:  this page refers to an old version of SFML. Click here to switch to the latest version." instead of "Documentation of SFML 2.5.1" which is now the latest one.

To be clear: ffmpeg can do jpeg and others to png. It can't do svg to png. ImageMagick can.

ImageMagick can do it too if you have it installed or are willing to install it.

I once had a bunch of bmp files and wrote a similar tool to go from bmp, jpg, etc. to png ( https://github.com/FRex/topng/ ) because I didn't have ImageMagick and didn't want to install it just for this, but I later also found out ffmpeg also can do such conversions (and ffmpeg I do have installed) but mine is at least simple to invoke in find command or something.

General / Re: Link executable to work with all 2.x SFML libs
« on: July 21, 2019, 06:49:43 am »
I've seen app before bundle all needed files and use 'LD_LIBRARY_PATH' (see .wrapper script in these trial Linux versions): https://www.iforce2d.net/rube/#

There's also things like FlatPack and AppImage but I only ever heard of them as solution to this Linux distribution problem.

And SFML in repos is often out of date. :/

Graphics / Re: Array of rectangles
« on: July 08, 2019, 03:56:19 am »
std::vector has in it a copy of your original, this is how C++ works and it's different to Java and such.

Also: this isn't C question, you shouldn't use goto in C++, & is binary and - % is modulo.

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).

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.

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).

Pages: [1] 2 3 ... 123