Search found 8 matches
- November 15th, 2017, 5:18 am
- Forum: Everything
- Topic: sfml engine thing I'm working on
- Replies: 12
- Views: 5279
Re: sfml engine thing I'm working on
Hi everyone! I haven't posted an update in a while but here are some of the things I've added since then. Notable features: - Tile selection based on mouse coordinates (even works correctly when zoomed in!) Right now all it's used for is spawning entities at that tile, but this will be used for tile...
- November 6th, 2017, 2:59 am
- Forum: Everything
- Topic: sfml engine thing I'm working on
- Replies: 12
- Views: 5279
Re: sfml engine thing I'm working on
Yeah, you will find that stuff at the entity level like that costs a lot less than you might originally thing. This is why I constantly scold people for premature optimization at that level. It often just isn't worth it, and it's better to write clean, scalable, idiomatic code at that that level, a...
- November 6th, 2017, 1:11 am
- Forum: Everything
- Topic: sfml engine thing I'm working on
- Replies: 12
- Views: 5279
Re: sfml engine thing I'm working on
I have just implemented entity sorting and the game still performs surprisingly well, even with over 1000 entities loaded.
- November 6th, 2017, 12:44 am
- Forum: Everything
- Topic: sfml engine thing I'm working on
- Replies: 12
- Views: 5279
Re: sfml engine thing I'm working on
MrGodin's stuff doesn't account for zoom level, but the process should be the same. You don't want your viewport to go outside the bounds of your level. Update position of camera, check that the viewport rectangle is not overlapping the level rectangle, add or subtract the amount, if any, overlap t...
- November 6th, 2017, 12:42 am
- Forum: Everything
- Topic: sfml engine thing I'm working on
- Replies: 12
- Views: 5279
Re: sfml engine thing I'm working on
This is what i do to focus a camera on a position void Camera::UpdatePosition(Vec2f& in_pos) { m_pos = in_pos - m_center ; m_pos.x = __max(m_pos.x, m_mapFrame.left); m_pos.y = __max(m_pos.y, m_mapFrame.top); m_pos.x = __min(m_pos.x, m_mapFrame.right - m_screen_width); m_pos.y = __min(m_pos.y, m_map...
- November 4th, 2017, 6:13 pm
- Forum: Everything
- Topic: sfml engine thing I'm working on
- Replies: 12
- Views: 5279
Re: sfml engine thing I'm working on
I just recently implemented all the code to make the camera stop at the edge of the map, which also works when it is zoomed in. You can see it in action here: https://i.imgur.com/c9QLVFd.png Not really a huge improvement, but it took a while to figure out. //I will never touch this code again so lon...
- November 3rd, 2017, 4:13 pm
- Forum: Everything
- Topic: sfml engine thing I'm working on
- Replies: 12
- Views: 5279
Re: sfml engine thing I'm working on
Just browsing through the code i found this in Engine.hpp : const bool collision = true; This means you cannot change this value to false . I haven't ran it but from what i've seen in the code it looks a reasonable start. Ah, I haven't implemented collision yet. I was just laying out all the variab...
- November 3rd, 2017, 4:30 am
- Forum: Everything
- Topic: sfml engine thing I'm working on
- Replies: 12
- Views: 5279
sfml engine thing I'm working on
Hi, I'm new here. Here is the game thing I'm working on using the SFML library, feel free to give feedback currently it has a text class, map manager, texture manager, and entity system I am planning on adding a menu system with buttons and other gui things, and dialogue boxes. Oh and collision cont...