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

Pages: [1] 2 3 ... 57
Graphics / Re: segfault displaying dynamic array rectangle
« on: July 10, 2024, 03:01:13 pm »
You're using C++ classes like C structs, which might work or might crash and burn horrible (in undefined behavior as you're experiencing here).

In short, C++ classes should always be constructed with "new", unless you can't do so and you know what you're doing. If you use the "new" operator, memory is allocated and the class's constructor is called.

Your example snippet does not call the constructor, so you have the memory and copy some values, but something might be uninitialized or off (the actual vertex data).

Your second example that works actually does call the constructor, so there's no issue.

If you want to use SFML in a C fashion (.e.g with mallic), you should use CSFML instead.

General discussions / Re: PhysicsFS vs an SFML virutal filesystem
« on: February 20, 2019, 10:54:10 am »
Probably worth noting that integration of PhysFS into SFML isn't that hard. Haven't used this code in ages, but I'd assume it should still work out of the box, integrating neatly: https://github.com/SFML/SFML/wiki/Source%3A-SFML-PhysFS

SFML projects / Re: A-Maze Batz
« on: September 10, 2018, 10:11:56 am »
I just realized that Fullscreen flag shouldn't be or'd with any other flag.


Who reads documentation? :D But seriously: Never noticed SFML receiving Alt+F4 without "sf::Style::Closed", which is rather interesting, because I don't think other GUI frameworks (like Windows Forms) work like that. Just from memory right now though.

SFML projects / Re: A-Maze Batz
« on: September 06, 2018, 10:26:24 am »
Yeah, it's certainly not a complete game (yet), but I felt like it wouldn't be good to just throw in some more levels which would be almost identical either. Right now thinking about expanding it with more obstacles (enemies, waterfalls, or similar) and potentially some kind of built-in edtior with a chance for a mobile port.

SFML projects / Re: A-Maze Batz
« on: September 05, 2018, 12:42:19 am »
I checked it out. It's a bit short...
Yep, but also worked like maybe 12 hours on it or so. And in the end I didn't really have the motivation for tons of levels, esp. risking the submission deadline just for that. ;)

or you don't trust Windows executables  from strangers
I hope I don't have a virus now. :P
Nope, but some malware distributor would say the same. :D

Did some hearing based indie game inspire you (there are a few I know of but don't remember any names now)?
Not really. I thought it would be neat to listen to actual accurate echoes, but that would have required far more time than available.

You could have used https://en.cppreference.com/w/cpp/error/runtime_error not your own Exception too.
Hm, yep.

I also see you const cast and set smooth false on Font's Texture, maybe it should be in the API (or maybe I missed why it's not or where it is).
It's been discussed somewhere, I just don't remember where it was.

SFML projects / A-Maze Batz
« on: September 04, 2018, 08:44:20 pm »
A small casual game entry for the Game Maker's Toolkit Game Jam 2018.

Source code (Windows/Linux/Mac): GitHub
Precompiled (Windows): itch.io

You're helping Batz on his way through dark and deep caverns on the look for the one thing that really matters: Batsie. This must be true bat love in some way, although Batsie seems to leave our hero from time to time and he'll have to find her once again.

There's no real end: Once the last level has been beaten, the game will simply restart from the first one. You can even create your own levels and challenge your friends to find Batsie as fast as possible.

You can't really lose the game. There are no lives, there's no timer. Some kind of time attack mode was planned, but I was lacking time so far. In its current form, consider this a prototype and proof of concept.


The game controls are pretty straight forward:

  • Cursor Keys and W/A/S/D: Steer Batz through the dark caves.
  • Space: Use Batz's sonar to identify caverns, tunnels, and openings. Batsie will also answer your call, if she can hear you.

Compiling the Game from Source

If you're not running Windows, but still want to try the game (or you don't trust Windows executables  from strangers), you can download the full source code for the game  from GitHub and build it yourself. You'll need a working environment to compile and link C/C++ programs for this, including CMake and SFML.

This project originated in a game jam weekend in a total of less than 24 hours. This code isn't clean and it's clearly not built around best practices and optimization only. If you're curious, have a look, but always keep this in mind.

Modding and Level Editing

The game's levels are stored in a very simple and easy to edit way. Open the sub directory `assets/levels`, where you'll find one PNG image per level.

You can edit existing levels or create new ones, simply creating a new file following the existing numbering pattern. If the last level is `level5.png`, save your own level as `level6.png` to extend the game. There's no need to recompile or rebuild the game in order to test new levels.

There are a few tiny things to keep in mind here:

Your PNG file has to be saved as an 24-bit or 32-bit color PNG image. 8-bit PNGs are not supported.
Fully black parts (RGB: 0/0/0) are considered solid. You don't have to fill shapes. Even 1 pixel thin lines should count, although sonar pings might pass through thin diagonal lines.
Make sure that tunnels and choke points are at least 10-12 pixels wide.
Green pixels (RGB: 0/255/0) are potential starting positions. If there's more than one position available, the actual starting position will be picked at random.
Red pixels (RGB: 255/0/0) are potential goal positions, i.e. where Batsie may be found.
Blue pixels (RGB: 0/0/255) create random water drops that will be visible.

General / Re: Inheriting from sf::Drawable.
« on: July 30, 2018, 08:24:23 pm »
Just delay the construction of the SFML resources past the actual constructor? You can't really create stuff like OpenGL contexts at compile time anyway.

General discussions / Re: Android and iOS ports available for testing
« on: July 28, 2018, 06:40:57 pm »
Just to mention it here for everyone subbed to the thread: SFML's current master branch on GitHub should once again build and run Android properly for everyone, even if you're using the audio module and/or use the shared C++ runtime. Apps will still fail to regain a working context once you switch out of them, though.

General / Re: waitEvent is not working as i expected
« on: July 28, 2018, 06:38:48 pm »
wuoldn't it be a lot more intuitive to let waitEvent work with the same code of pollEvent by just replacing it?

nevermind i just realized it'd be stupid

It somewhat makes sense (I also made that mistake in the SFML example app). But considering the function's behavior this simply doesn't make any sense (since it should always return true).

However, you can essentially emulate that behavior by using (waitEvent(event), true).

General / Re: waitEvent is not working as i expected
« on: July 28, 2018, 11:07:54 am »
Hm, never noticed that. :O

General / Re: waitEvent is not working as i expected
« on: July 28, 2018, 08:50:10 am »
There has to be some other issue. What you want is exactly what should happen with that code in place.

@G.: It shouldn't make a difference. Only difference would be whether you'd want to process one or multiple events at once (the latter typically being the better choice).

Graphics / Re: SF::Font - somehow a glyph getting corrupted.
« on: July 28, 2018, 08:46:24 am »
What really confuses me is the fact that not only your glyphs are somehow mangled, they're also not using the correct dimensions/alignment. As such I still think it's some weird issue in Freetype rather than SFML. Not 100% sure though.

General / Re: switch console mode-window mode
« on: July 27, 2018, 09:25:35 pm »
Since the console windows are platform specific, no, there's no way to do so, unless you create two separated programs and run one or the other.

Delete your whole build directory and start over. Also don't use the toolchain file (I thought I deleted it).

Graphics / Re: SF::Font - somehow a glyph getting corrupted.
« on: July 27, 2018, 02:56:20 pm »
See my addition above: Comparing both textures, the glyphs are arranged differently. Any chance the issue appearing/disappearing is related to the order of glyphs being used?

Pages: [1] 2 3 ... 57