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

Pages: [1] 2 3
1
SFML projects / Dais
« on: January 31, 2026, 05:16:50 am »
Hi!

I was working on a platformer-style game idea for a bit a while back.
I call it Dais.



It has gone through many internal modifications, including changing the way it draws its map (from Selba Ward's Console Screen to using Cheese Map) and, now, fully updated to use SFML 3.

It's allowed me to experiment with some different things at once:
menus,
states,
controllers and control customisation,
platformer game internals,
manual character animation,
implementing player/enemy animation,
considering preparing for multiple language support,
resource packing,
and more...

I've learnt a lot from experimenting with it and there isn't much of a game, to be fair, but there is a simple level created for testing some features.

I'm still considering whether or not to continue with it as a game. I think I would like to...

Therefore, I'd be very interesting in some feedback on things like how it "feels" to play and the user experience overall.

So, here is a downloadable zip file:
https://www.dropbox.com/scl/fi/5twjfm5grc7ziup47dor2/Dais-early-alpha-tests-0.0.1.zip?rlkey=xqb1k2t5mqqmiuw1fmc80fa2j&st=80axyuz6&dl=0
(click on the download icon at top-right)
It's for 64-bit Windows only, unfortunately.
Remember to extract the zip file before running.

Included in the zip is Dais.exe (the main program), DaisDev.exe (the DEV mode version with ability to modify the map live and other stuff) and a resources folder.

If you don't have the latest Visual C++ Redistributable (required for this to run), I believe you can download it directly from Microsoft here:
https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#latest-supported-redistributable-version

I look forward to your feedback :)

p.s. If you want to use a controller, make sure it is connected before starting Dais.



EDIT: added screenshot.

2
SFML projects / Grambol
« on: November 15, 2025, 03:22:25 am »


Introducing Grambol, a system for programmable symbols for use with SFML. That is, they become "vector" graphics similar to "clip-art".

Grambol is an entirely header-based library. The base classes (Symbol, PlainSymbol and FullSymbol) as well as all Provided Symbol Groups are all each contained within a single file.

The base class/classes gives similar features and interface to SFML's own Shape class. However, it expands the idea to allow derived classes to have more flexibility and control. For example, they can specify which primitive type is used as well as allowing multiple colours within one symbol.

Each symbol is set up in a similar way to a rectangle; it has a width and height. All point calculations in Grambol are ratios - in the range of 0 to 1. That is the x co-ordinate 0-1 expands to 0-width and the y co-ordinate 0-1 expands to 0-height. This "rectangle" is the foundational two-dimensional space in which the symbol is contained. The points can use this information however they choose - including expanding outside of this rectangle.

The main base class, Symbol, is all that is required. It provides all the of the base code to use. However, two other "base" classes are provided: PlainSymbol and FullSymbol. These are derived from Symbol but include some specific features. PlainSymbol simply adds setting and getting of the symbol's (single) colour. This is perfect for single colour symbols. FullSymbol adds ability to set a palette of multiple colours, allowing each point to use any one of these colours. This allows a single symbol to be multi-coloured.

The base classes available:
  • Symbol
    This main, base class is all that is required to create Grambol symbols
  • PlainSymbol
    This is a Symbol with specialisation to allow setting a single colour
  • FullSymbol
    This is a Symbol with specialisation to allow setting a palette of multiple colours

In addition to the main functionality of Grambol, some Provided Symbol Groups "PSG" are also included with some commonly-used and flexible symbols.

Currently available PSGs:
  • Basic
    some basic symbols
  • BasicGradient
    the same basic symbols in Basic with added gradient
  • Arrow
    multiple different types of customisable arrows
  • CardSuit
    symbols representing the suits of standard playing cards
  • Icon
    some common symbols often used as icons

The logo (above) was entirely created using Grambol symbols except the curve of the G and the lines in the M (those were Selba Ward's Spline with only some minimal image post processing. All of the symbols are a part of Provided Symbol Groups that are either already provided or are still to come; they will all be available.

G: standard arrow [Arrow]
R: 2 x pin [Icon] + heart [CardSuit]
A: impossible triangle [Misc - not yet available]
M: die face (value of 5) [Dots - not yet available]
B: Bluetooth logo [Icon]
O: radiation warning [Warning - not yet available] + ellipse [Basic] + cog [Icon]
L: Braille (character is technically a 'V') [Dots - not yet available]

In each of the Provided Symbol Group's wiki page, there is a simple example that demonstrates some of the ways they can be used. Here are screenshots of those simple example (with added anti-alias):

Basic


BasicGradient


Arrow


CardSuit (frames not included in Simple Example - added later from Basic group)


Icon


Wiki: https://github.com/Hapaxia/Grambol/wiki
Repo: https://github.com/Hapaxia/Grambol

3
SFML wiki / Image Expander
« on: October 21, 2025, 01:22:06 am »
Image Expander: expands the outside pixels of rectangular portions of an image.

A common issue people have with tilemaps is that there are sometimes noticeable gaps, especially when scaling or using some other transformation.
This is generally due to Open GL picking the 'wrong' pixel, where it chooses to use the pixel directly outside of the given rectangle.

That's where this may come in handy!

As long as all of your tiles are at least 2 pixels apart, all you need to do is load the image as normal, use this Image Expander on each tile by specifying its rectangle within the image you should notice a significant decrease in these unwanted artifacts (it should fix it entirely).

Here is an example image (the example used to create it is shown on the wiki page):

The original tileset (tiles are spaced 2 pixels apart) is on the left, the processed image (using Image Expander) is on the right.

Here is that processed image at double size:


Here is the wiki page for the code (function and example) and more information:
https://github.com/SFML/SFML/wiki/Source:-Image-Expander

4
SFML wiki / Tutorial - Understanding Text Bounds
« on: April 23, 2025, 09:31:55 pm »
Hello all.

I have written a small tutorial to explain how text bounds work for the wiki:
https://github.com/SFML/SFML/wiki/Tutorial%3A-Understanding-Text-Bounds

Hopefully, this can help to reduce the common confusion to how they work.

Feel free to refer to it when people ask about this topic! :)

5
Graphics / Native Windows
« on: February 19, 2025, 10:14:35 pm »
Is there an example of successfully integrating SFML within a native window in Windows that does not fire off OpenGL warnings?

What I'm talking about here is not a complicated request: just a single native window from which SFML can create a render window.

Since the upgrade from SFML 2 to SFML 3, I've found this to be impossible.

For example, this code:
#include <SFML/Graphics.hpp>
#include <Windows.h>

#include <iostream>

LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

int main()
{
        HINSTANCE hInstance{ GetModuleHandle(NULL) };



        // main window
        const wchar_t mainClassName[] = L"Main Window Class";
        WNDCLASS wc = { };
        wc.lpfnWndProc = WindowProcedure;
        wc.hInstance = hInstance;
        wc.lpszClassName = mainClassName;
        RegisterClass(&wc);

        HWND hWnd = CreateWindowEx(
                0, mainClassName, L"SFML in native window test", WS_OVERLAPPEDWINDOW,
                CW_USEDEFAULT, CW_USEDEFAULT, // position
                1000, 1000, // size
                NULL, NULL, hInstance, NULL
        );
        if (!hWnd)
                return EXIT_FAILURE;

        ShowWindow(hWnd, SW_SHOWNORMAL);



        sf::RenderWindow sfmlWindow(hWnd);



        sfmlWindow.clear(sf::Color(255u, 160u, 64u)); // fill the SFML window with a solid colour
        sfmlWindow.display();



        MSG msg{};
        while (GetMessage(&msg, NULL, 0, 0) > 0)
        {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
        }
}

LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
        switch (msg)
        {
        case WM_DESTROY:
                PostQuitMessage(0);
                return 0;
        default:
                return DefWindowProc(hWnd, msg, wParam, lParam);
        }
}

as well as this official example:
https://github.com/SFML/SFML/blob/master/examples/win32/Win32.cpp

cause this error since SFML 3:

(that failed call is from here: https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/RenderWindow.cpp#L113)

The error is always thrown on window.create() and is thrown repeatedly and locks the progress of the program. Only in debug mode, however. In release mode, it's fine and the graphics module works as expected.

6
SFML development / Font/Text Direction
« on: December 30, 2023, 05:59:46 pm »
Spending a bit of time around the SFML text rendering recently, I have noticed that it's locked in to a horizontal direction.
After checking, it looks like FreeType does provide a 2-dimensional (vector) advance but SFML only uses the x component - even in Font/Glyph i.e. it's not just Text ignoring it, it's not available from Font so even a custom text renderer would not be able to use it. This makes Font useless for any non-horizontal direction text renderer.

My suggestion is - at least at first - expose the 2D advance in Font/Glyph allowing separate renderers to use all of the font.
(by simply changing advance to Vector2f instead of float)



Following that, Text could be expanded to also be able to handle it properly. This isn't required but is an option. However, exposing the 2D advance is required before that can even be considered. Of course, exposing it means that Text would need to adjusted to focus on just the one component but it's (obviously) as simple as making a reference, for example. Later, the 2D vector could be used, likely without much disruption to the legibility of the code.
e.g.
position += advance (both floats representing xs)
position += advance (both representing Vector2fs)

7
SFML wiki / Extract Triangles
« on: November 24, 2023, 06:11:46 pm »
The different (solid) primitive types are useful for individual objects but, sometimes, we need independent triangles, especially if we want to have multiple (separate) shapes in a single vertex array.

Presenting to you, Extract Triangles!
(updated to use SFML 3!)

Extract Triangles does exactly that; it extracts individual triangles from the other primitive types.

Basically, it's this:
sf::VertexArray triangleFan(sf::PrimitiveType::TriangleFan);
// set up vertices for triangle fan
sf::VertexArray independentTriangles{ extractTriangles::vertexArrayFrom(triangleFan) };

Simple, huh? 8)

It can also work with just vertices (i.e. std::vector<sf::Vertex>) as well as convert between the two types and - for some reason - can also create vertex buffers from either of those!

For more information as well as the code, visit the SFML wiki and/or the GitHub repository listed below.

Wiki page:
https://github.com/SFML/SFML/wiki/Source:-Triangles-Extractor

GitHub repository (it's a part of SfmlSnippets):
https://github.com/Hapaxia/SfmlSnippets/tree/master/TrianglesExtractor

There is also an example showing it in action included in the repository and also on the wiki page.

Feel free to ask any questions or make any comments.

8
SFML wiki / Simple Sprite Batcher
« on: November 22, 2023, 12:04:04 am »
Updated to use SFML 3!

Multiple sprites drawn mean multiple draw calls. These draw calls can have a detrimental affect to performance so, if possible, they should be reduced. One way to do this is to draw many of those sprites batched together!

This is a "simple" sprite batcher. That is, it's very easy and simple to use and will bring you performance improvements. However, a more dedicated batcher may be able to bring more improvements albeit at the cost of simplicity.

The batcher is a very small class. You simply create it and pass it the texture. Then, you can pass it the sprites to be batched and draw it as often as required.

Basically, it'll look like this:
sf::Texture texture{};
// .. set up the texture for the sprites

std::vector<sf::Sprite> sprites{};
// .. set up the sprites

SimpleSpriteBatcher batcher{};
batcher.texture = &texture;

while (window.isOpen())
{
    // .. event handling

    // .. updates where you would modify vector sprites however you want

    batcher.batchSprites(sprites);

    window.clear();
    window.draw(batcher);
    window.display();
}

You can also batch using a vector of pointers to sprites too so you can easily still use this if your sprites are not in a vector or if you need to order them first! There is an example of how to do this on the wiki page.

Here's a video that shows it in action:
https://www.youtube.com/watch?v=2P13hhMgeFs
Note that the YouTube compression struggles with the video but it still shows the difference between with and without the batcher.

Wiki page:
https://github.com/SFML/SFML/wiki/Source:-Simple-Sprite-Batcher

GitHub repository (it's a part of SfmlSnippets):
https://github.com/Hapaxia/SfmlSnippets/tree/master/SimpleSpriteBatcher

Example used to create the clips in the above video is included in the repository and also on the wiki page.

Feel free to ask any questions or make any comments.

9
SFML development / DPI-Scaling on Windows
« on: November 20, 2023, 10:46:46 pm »
I'm not sure if this is a help request, a feature request or actually providing help to others so it might be better in a different category...

Before we start, you should know that this is not intended to be just complaints. I'd really like to help improve this. First, though, we need to understand what the problems actually are and why they are problems.

One of the main things that has irritated me with using SFML is trying to get it to place nicely with already created windows. Note that my points here will about about Microsoft Windows only.

Creating a window with SFML is simple; it's great!
However, it lacks some features that require the ability to control the window yourself (adding a 'proper' window menu, for example). This can be ignored a lot of the time for most games but falls flat for other (more serious/professional) application types, forcing windows to be created without SFML.

So, instead we can create a window manually (this isn't really much of an issue but it's nicer when SFML does the work for you!). Then, we can pass the window's handle to an SFML window and it can take over control for that window. This is also a nice feature.

However, this starts to create some issues when faced with DPI-scaling. Newer operating systems use scaling and often start with a scale of not 100%. For example, I'm using Windows 11 and the default scale was 150%.

The issue is that things should be scaled by this value so that the user experiences scaled things automatically. If they don't, they are ignoring the user's request; this is an accessibility issue. When you create a window manually, it "cares" about the user's decision and it is scaled. The app itself doesn't see the scale and the accessibility is applied automatically.

If you pass control of a window already created (and scaled properly) to SFML, SFML removes scaling so that its size matches its expected number of pixels. This is understandable for when you are working with exact pixels. This means that window "shrinks" (assuming a larger scale in my examples) to fit SFML's preferences.
Firstly, I'd say that this in itself is a bit of an issue since the reason we create a window without SFML is access to window features that SFML doesn't provide and this removes the ability to do this.

If you've programmed directly in Windows already, you'll understand that you can create (child) windows within other windows (almost everything is a window!). So, creating a window as a child of the actual window as a destination for SFML graphics to be displayed is actually a good idea. This allows you to place SFML graphics in specified rectangles around the window.

Unfortunately, when you pass this child window to SFML, SFML will remove scaling - for everything! That includes its parent window! This means that you cannot create and control one window and give a child window to SFML to play with as it affects the parent window as well.

In addition to this, SFML's removal of the scaling actually affects all windows by the instance so all windows will be "unscaled" by SFML even if not at all related to the window used SFML. This is quite a disturbing situation.

It's worth noting too, that when the window is "unscaled" by SFML, the title bar is also "unscaled" and I've seen the window title disappearing as it's too small!

I should mention that I've looked around for previous info about this and a few things popped up that might interest someone experiencing issues with scaling:
https://en.sfml-dev.org/forums/index.php?topic=17092.0
https://en.sfml-dev.org/forums/index.php?topic=19617.msg141246#msg141246
https://en.sfml-dev.org/forums/index.php?topic=28770.msg178734#msg178734
https://github.com/SFML/SFML/pull/2268
All are many years old.

There doesn't seem to be anything in SFML 3's list of task related to this, unfortunately.

I will also provide a "simple" sample code you can use to see it in action:
#include <SFML/Graphics.hpp>
#include <Windows.h>

LRESULT CALLBACK MainWindowProcedure(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK ChildWindowProcedure(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK Main2WindowProcedure(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

int main()
{
        HINSTANCE hInstance{ GetModuleHandle(NULL) };



        // main window
        const wchar_t mainClassName[] = L"Main Window Class";
        WNDCLASS wc = { };
        wc.lpfnWndProc = MainWindowProcedure;
        wc.hInstance = hInstance;
        wc.lpszClassName = mainClassName;
        RegisterClass(&wc);

        HWND hWnd = CreateWindowEx(
                0, mainClassName, L"SFML in child window test", WS_OVERLAPPEDWINDOW,
                CW_USEDEFAULT, CW_USEDEFAULT, // position
                1000, 1000, // size
                NULL, NULL, hInstance, NULL
        );
        if (!hWnd)
                return EXIT_FAILURE;

        ShowWindow(hWnd, SW_SHOWNORMAL);



        // reference window (window 2: identical to - but independent from - main window)
        const wchar_t main2ClassName[] = L"Main 2 Window Class";
        WNDCLASS wc2 = { };
        wc2.lpfnWndProc = Main2WindowProcedure;
        wc2.hInstance = hInstance;
        wc2.lpszClassName = main2ClassName;
        RegisterClass(&wc2);

        HWND hWnd2 = CreateWindowEx(
                0, main2ClassName, L"SFML in child window test 2 (for reference size)", WS_OVERLAPPEDWINDOW,
                CW_USEDEFAULT, CW_USEDEFAULT, // position
                1000, 1000, // size
                NULL, NULL, hInstance, NULL
        );
        if (!hWnd2)
                return EXIT_FAILURE;

        ShowWindow(hWnd2, SW_SHOWNORMAL);



        // child window (child of main window, not window 2)
        const wchar_t childClassName[] = L"Child Window Class";
        WNDCLASS wcChild = { };
        wcChild.lpfnWndProc = ChildWindowProcedure;
        wcChild.hInstance = hInstance;
        wcChild.lpszClassName = childClassName;
        RegisterClass(&wcChild);

        HWND hWndChild = CreateWindowEx(
                0, childClassName, L"Child Window", WS_CHILD | WS_BORDER,
                250, 250, // position
                500, 500, // size
                hWnd, // parent
                NULL, hInstance, NULL
        );
        if (!hWndChild)
                return EXIT_FAILURE;

        ShowWindow(hWndChild, SW_SHOWNORMAL);



       
        sf::RenderWindow sfmlWindow(hWndChild); // sfml window is created from the child window (of main window)



        sfmlWindow.clear(sf::Color(255u, 160u, 64u)); // fill the SFML window (child) with a solid colour
        sfmlWindow.display();



        MSG msg{};
        while (GetMessage(&msg, NULL, 0, 0) > 0)
        {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
        }
}

LRESULT CALLBACK MainWindowProcedure(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
        switch (msg)
        {
        case WM_DESTROY:
                PostQuitMessage(0);
                return 0;
        default:
                return DefWindowProc(hWnd, msg, wParam, lParam);
        }
}

LRESULT CALLBACK ChildWindowProcedure(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
        switch (msg)
        {
        case WM_DESTROY:
                PostQuitMessage(0);
                return 0;
        default:
                return DefWindowProc(hWnd, msg, wParam, lParam);
        }
}

LRESULT CALLBACK Main2WindowProcedure(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
        switch (msg)
        {
        case WM_DESTROY:
                PostQuitMessage(0);
                return 0;
        default:
                return DefWindowProc(hWnd, msg, wParam, lParam);
        }
}
This is complete and should compile (you will need to link SFML Graphics as normal). Note that if you are using "Multi-byte Character Set" instead of "Unicode Character Set", you'll need to either change it to the Unicode one or replace the "wide" characters with standard ones.

Note:
this code also outputs an error (that I must admit that I don't understand):
An internal OpenGL call failed in RenderWindow.cpp(125).
Expression:
   glGetIntegerv(GLEXT_GL_FRAMEBUFFER_BINDING, reinterpret_cast<GLint*>(&m_defaultFrameBuffer))
Error description:
   GL_INVALID_OPERATION
   The specified operation is not allowed in the current state.



And finally...
As mentioned at the beginning of this post, I will also be giving some help/advice.

As a work-around, you can fix this issue yourself but it's on a "per exe file" basis.

To do this, you can modify the properties of the executable manually (right-click file and click on Properties).
Then, go to Compatibility tab, click on Change high DPI settings, activate Override high DPI scaling behaviour and choose Application or System from the drop-down menu.
Application lets SFML scale the window but the title bar still works.
System disallows SFML from changing the scaling of the windows.



In conclusion, having to "override" settings per file is a bit of a dirty "hack" and it would be cleaner if we could at minimum let SFML know we don't want it to be in charge of scaling.

10
SFML projects / Cheese Map
« on: August 27, 2023, 08:33:31 pm »




Cheese Map is a drawable layered tile map for SFML, designed to simplify drawing most 2D maps.
Updated to use SFML 3!

It's also fully header-only so no library compilation needed; simply just include it.

You can create multiple grid map (standard grid tile maps) and place them anywhere in space and Cheese Map will draw them all together. You basically give it the view you want it to fill and it draws the map that is needed to fill that view, automatically culling everything out-of-range.

Some example of Grid maps (from the tutorials):


You can also create layers of individual "free" tiles that are tiles that can be placed anywhere in space with no restraint to a grid. These are likely most useful for separate, individual objects that don't conform to a grid and/or need to be layered in front or behind without having to create another entire grid map in front or behind.

Example of Layers of Tiles (from the tutorials):


Whether it be a grid or layer, each one can have a z-order depth and is automatically sorted when drawn so you easily decide on the order things are drawn. Each one can also have a depth that offsets it in the 3rd dimension; it projects away from the screen towards the back and follows the rule of the perspective (the vanishing point of the map can be customised). Each one can also have its own colour, be activated (drawn) and de-activated (ignored), and given any offset/position that moves the entire grid/layer.

Each tile's texture can also be transformed: flipped/mirrored/rotated using flipx, flipy, and rotate (90 degrees).

Cheese Map makes it easy to move around by using the view: you can move, scale and rotate the view however you like and Cheese Map adapts. You can think of it as if the entire map is static and your view is your camera that you can aim at it however you want to. Cheese Map doesn't draw stuff it doesn't need outside of the camera/view.

Cheese Map also includes some features that can aid avoiding the common "tile splitting" issues really simply.

There are now some tutorials to get you started on easily creating tile maps using Cheese Map:
https://github.com/Hapaxia/CheeseMap/wiki/Tutorials


To get started quickly, you can have a look at the Simple Example that - with very little code, shown below in the spoiler - produces this animation:


(click to show/hide)

There are also a couple of videos available that were created of tests during development:
Early Test Demo:
https://www.youtube.com/watch?v=de0OGuVQkGk

Initial Tests:
https://www.youtube.com/watch?v=fxsmWH_VPNQ



EDIT: added new example images (from tutorials), added links to tutorials, and replaced images that were hosted on imgur

11
SFML development / Multi-line Text Alignment
« on: August 13, 2023, 06:02:22 pm »
Would you be interested in having a simple multi-line alignment for sf::Text?

You may or may not have already seen this:
https://github.com/Hapaxia/SfmlTextAline
where I created something similar to sf::Text that also included a multitude of alignment features.

However, I'm proposing a simple "Left/Center/Right/Justify" choice that would simply affect the entire text globally.
Maybe not even justify if you'd prefer not to have that since it would depend on the type of justification you'd want: "word" justification or "character" justification where "word" only stretches spaces and "character" also separates characters. Of course, you could have both as an option.

The left/center/right option is pretty simple to implement so I'd guess you'd prefer that, if this is a consideration at all, of course.

Let me know and I'll start up a draft...

12
SFML projects / Qalm
« on: May 22, 2023, 04:54:59 pm »
(click to show/hide)

Hi! :)

A while ago, I began creating a music editor based around an SFML music player that I created. That is, a functioning music 'performer' that plays back music in a similar way to how MIDI does, using only SFML audio module.

That is QALM!


While I all-but-abandoned the main editor due to frustration over the struggle between SFML and user-created windows, a few mini-apps were also created during that time.
It would be fair to say that those mini-apps were not finished but they are, in general, in a working state.

So... I shall provide you with Windows executables (64-bit only) of a couple so you can tinker and hopefully have some fun.

First,
Qalm Instrument Editor




Here, you can create instruments designed to be used with the Qalm Player engine (the core of all of Qalm).
However, you can 'play' the current instrument in real-time using the computer keyboard!
An instrument can be just a single sample (so it allows you to play a sample back at musical pitches) or multiple samples mapped to different pitches (allowing multi-sampled pianos or drumkits!).
Some instruments are provided for testing.

You can also use the created instruments in the other provided app... the Tracker!

Second,
Qalm Tracker




This is a functioning Tracker - a music creation tool with a specific style using vertical time. It does function but many expected functions have not been added yet.

You can create your own music using your instruments with tracker-style effects.

Major restrictions include:
- it always loads the same song file (test.qts). You can copy it and move them around but it always loads the same filename each time. If you delete it, it will create one (allowing you to start from scratch).
- it always loads the same instruments. This is a pretty tight restriction, unfortunately. It loads them from a file, though, so replacing those instruments with different instruments but give them the same filename will allow you to use other instruments.

Note that it come pre-loaded with something I composed to test some things.

Here's a video clip of the pre-loaded song playing back:
https://www.youtube.com/watch?v=xKBCSw1KVMw



I hope you have some fun with these.
I had fun making them and I hope to get back to working with them some more in the future.
Remember that everything is using SFML sound buffers and sounds! 8)
When I am more happy with the Player engine, I plan to release the code so you can use it to playback your creations in your programs!

Another Qalm mini-app I have created in a converter that allows you to convert MIDI songs to Qalm songs and then the Qalm Player can play them back with the instruments you created!



THE DOWNLOADS
The following downloads are for Windows 64-bit only and are Zip folders.
The are each completely self-contained and can be run from wherever and should not need any admin control.

https://www.mediafire.com/file/a2zb92iv3tegl4g/QalmInstrumentEditor.zip/file
https://www.mediafire.com/file/x40i03ux2nzi5b3/QalmTracker.zip/file

They also contain some basic documentation to help use them.

13
SFML development / RenderStates const ref in draw()
« on: May 10, 2023, 06:05:30 pm »
Regarding SFML master (v3-WIP).

I noticed that render states in the virtual draw method of a drawable is now a const reference (instead of by value) and I wonder what the reason behind this decision was as I can't find any information or discussion yet other than an old post saying that it wouldn't happen ;)

Old post: https://en.sfml-dev.org/forums/index.php?topic=17102.0

To be clear, I'm not at all saying it's a wrong decision (just because I had to modify lots of code ;D) but wondered why the decision was changed. Maybe now it's better to be (possibly) more optimised over simplicity?

14
SFML wiki / Get Character At Coord
« on: November 07, 2022, 09:41:14 pm »
Updated to use SFML 3!

SFML's texts are considered a single drawable object so interaction with them is usually based on their boundary boxes.

Get Character At Coord informs you of which character in a text object is at the given co-ordinate.

Get Character At Coord is a free-function that can be added to any code.



It's very easy to use and is pretty small.

Wiki page:
https://github.com/SFML/SFML/wiki/Source:-Get-Character-At-Coord

GitHub repository (it's a part of SfmlSnippets):
https://github.com/Hapaxia/SfmlSnippets/tree/master/GetCharacterAtCoord

Example used to create the above screenshots is included in the repository and also on the wiki page.

Feel free to ask any questions or make any comments.

15
SFML wiki / Rectangular Boundary Collision
« on: July 11, 2017, 08:08:46 pm »
Rectangular Boundary Collision

Updated to use SFML 3!

SFML's sprites and shapes can provide you with their axis-aligned boundary boxes (getGlobalBounds) and you can easily use these rectangles to test if they intersect. Unfortunately, this only allows axis-aligned collision detection.

Rectangular Boundary Collision allows testing collision based on their original rectangular boundary box (getLocalBounds). It tests to see if an object's rectangular boundary collides with another object's rectangular boundary. This method, however, allows transformations to be taken into account - most notably, rotation.

Rectangular Boundary Collision is a single, templated free-function contained within the "collision" namespace:
const bool spritesAreColliding = collision::areColliding(sprite1, sprite2);

You only need the header, which is approximately 100 lines of code...

The collision is performed in three stages:
  • Level 0 - AABB (axis-aligned boundaries boxes):
    tests the axis-aligned boundaries boxes (equivalent to getGlobalBounds) of the objects to see if they intersect.
  • Level 1 - Corner inside opposite object:
    tests to see if any of either object's corner is inside the other object.
  • Level 2 - SAT (Separating Axis Theorem):
    tests using a simplified version (for rectangles) of SAT to catch other cases.
If, at any time, the result is certain, the following stages are not calculated. This allows easier detections to be done without resorting to the more involved calculations.

The collision level represents after which stage to leave the function, regardless of if a result is certain.


(red = collision, green = no collision)

Wiki page:
https://github.com/SFML/SFML/wiki/Source%3A-Rectangular-Boundary-Collision

GitHub repository (it's a part of SfmlSnippets):
https://github.com/Hapaxia/SfmlSnippets/tree/master/RectangularBoundaryCollision

Example used to create the above screenshots is included in the repository and also on the wiki page.

Pages: [1] 2 3