techhub.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
A hub primarily for passionate technologists, but everyone is welcome

Administered by:

Server stats:

4.9K
active users

#cpp

34 posts21 participants1 post today

SFML, текстуры и пазлы
Проект: #dungeon_archeology

Решил дальше разбираться с UI. На этот раз поработал над текстурами. В SFML есть стандартный класс для отрисовки изображений - Sprite. Но для UI часто используются текстуры, состоящие из "9 кусочков". В ассетах, что я решил использовать для этого проекта, как раз такие используются, поэтому надо как-то их обрабатывать.

Изначально я думал при вызове getTexture из менеджера ресурсов отрисовывать из кусочков то, что мне нужно. Написал и понял, что хорошим данный код точно не назвать, поэтому полез в исходники SFML изучать устройство класса Sprite.

После беглого взгляда на оригинальный код, я создал свой класс SliceSprite, который по функционалу похож на обычный Sprite, но работает с необходимыми мне "кусочками" целой текстуры.
Если кому-то интересен код: github.com/Befrimon/DungeonArc

И вот я получаю удобный класс для работы и два новых метода своего парсера. Думаю, отличный результат для моей ночной практики :)

Continued thread

Tried out JUCE tonight following the simple window tutorial. I did this without Projucer, so it kinda sucked that they did not tell you what headers to include. Using JUCE with CMake is super simple and their CMake API documentation is really good too. It's just kinda weird that there's no single place where all this information is there so you have to jump around class documentation.

Парсер для SFML: Начало
Проект: #dungeon_archeology

Когда я первый раз писал проект на SFML, я плевался ядом на то, что настройки объектов я не могу вынести в отдельный файл (я тогда после Java приложений на Android это делал, где все в uml'ках хранится).
Ну а сейчас у меня куча времени и чуть больше опыта, поэтому решил написать свой парсер)

Сами конфиги я храню в toml'ах. Пока что прописываю только основные настройки (по типу размера, местоположения т.п.). В самом классе парсера перегружаю статический метод для всех (двух) классов из SFML. Voilà, у меня в классе сцены не будет 100500 строчек в конструкторе, которые описывают интерфейс.
Ну и еще делаю setOrigin по центру (тоже бесячая для меня штука, почему нельзя сделать что-то вроде set Origin(CENTER) )

Сейчас я прописал только 2 класса (Text и RectangleShape) и для них по 5 настроек, но естессно буду дополнять и, возможно, сделаю отдельную либу, чтобы потом не мучаться)

Replied in thread

@michalfita One at a time. Its syntax and core mechanics is not easy to adapt to. There are coding platforms that deal with issue RUST wants to fix less directly and no less robust. I know RUST brings lots of good memory control but also reverts a lot of default coding mechanics that some other platforms sorted already in less direct and/or semantically complicated way. Due to, some #rust coders bring a lot of pathology through unnecessary complexity that beats #cpp already.

Sane C++ Libraries June 2025:

✅ Async FS Ops
- {copy|remove|rename}{file|folder}
- {open|close|read|write}file
✅ AsyncUDP {SendTo | ReceiveFrom}
✅ FileSystem {Iterator | Watcher} / Memory dependencies cleanup

Blog
pagghiu.github.io/site/blog/20

Github
github.com/Pagghiu/SaneCppLibr
#cpp #cplusplus #programming

pagghiu.github.ioSane Coding Blog - ☀️ Sane C++ June 25Sane Coding Blog

C++ has the most bloated yet anemic standard library, the whole <chrono> library is an over-engineered mess but lacks even the most basic functionality that's useful in the real world such as "format this timestamp as a ISO 8601 time" or "parse this ISO 8601 time to a timestamp", it's infuriating #cpp #cplusplus #programming

dev.to/hanzla-baig/why-rust-is - opinion very #rust #rustlang enthusiastic, but it's not mentioning about issues that rust introduces, not tries to solve as well to keep it fair, and first of all.. Rust is not easy to learn for people who have grown up on C and #CPP. It's syntax is extremely weird and it's tooling not exactly always intuitive and rust coder's DNA is growing to combine all the pathology of C++ and Java communities both in attitude and implementation. I find Rust just fashionable and OK.

DEV Community🚀 🌟 Why Rust is the Next Big Thing in Programming 🔥🚀 Why Rust is the Next Big Thing in Programming 🔥 Rust is redefining what modern...

I really miss #rust like organization of unit tests. You can just write the unit test in the same file (and tests have access to privates as they should!)

e.g.

```rust
struct Foo {
....
}
impl Foo {
fn bar() {
...
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_foo() {
...;
}
}
```

Compare this with ceremonies required in other languages like #CPP and #php and even in #python (I don't like doc-tests that much).