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

Pages: [1]
1
Graphics / Unhandled exception at cleanupUnsharedResources [SOLVED]
« on: March 15, 2023, 07:50:43 pm »
I'm using a sfml compiled from master branch.
And i get Access violation reading location exeption at program end:
//main.cpp
#include <SFML/Graphics.hpp>
#include <memory>

std::unique_ptr<sf::RenderWindow> w;

int main(int argc, char const* argv[])
{
    sf::Texture t;
    t.loadFromFile("texture.png");

    w = std::make_unique<sf::RenderWindow>(sf::VideoMode(sf::Vector2u(320, 240)), "12",
                         sf::Style::Default);

    return 0;
}

Callsatack:
vtm.exe!std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<void (*const)(void *),void *>>>>::operator*() Line 148 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\list:148)
vtm.exe!std::_List_iterator<std::_List_val<std::_List_simple_types<std::pair<void (*const)(void *),void *>>>>::operator*() Line 239 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\list:239)
vtm.exe!sf::priv::GlContext::cleanupUnsharedResources() Line 753 (***\sfml\src\SFML\Window\GlContext.cpp:753)
vtm.exe!sf::priv::WglContext::~WglContext() Line 152 (***\sfml\src\SFML\Window\Win32\WglContext.cpp:152)
vtm.exe!sf::priv::WglContext::~WglContext() Line 150 (***\sfml\src\SFML\Window\Win32\WglContext.cpp:150)
vtm.exe!std::default_delete<sf::priv::WglContext>::operator()(sf::priv::WglContext * _Ptr) Line 3142 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\memory:3142)
vtm.exe!std::unique_ptr<sf::priv::WglContext,std::default_delete<sf::priv::WglContext>>::~unique_ptr() Line 3254 (c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\memory:3254)
vtm.exe!`anonymous namespace&#39;::GlContextImpl::`dynamic atexit destructor for &#39;sharedContext&#39;() Line 182 (***\sfml\src\SFML\Window\GlContext.cpp:182)
ucrtbased.dll!00007fff5a124957() (Unknown Source:0)
ucrtbased.dll!00007fff5a124365() (Unknown Source:0)
ucrtbased.dll!00007fff5a12449a() (Unknown Source:0)
ucrtbased.dll!00007fff5a124b01() (Unknown Source:0)
ucrtbased.dll!00007fff5a123cd1() (Unknown Source:0)
ucrtbased.dll!00007fff5a123b7d() (Unknown Source:0)
ucrtbased.dll!00007fff5a123bea() (Unknown Source:0)
ucrtbased.dll!00007fff5a123e64() (Unknown Source:0)
ucrtbased.dll!00007fff5a1241f6() (Unknown Source:0)
vtm.exe!__scrt_common_main_seh() Line 297 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:297)
vtm.exe!__scrt_common_main() Line 331 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331)
vtm.exe!mainCRTStartup(void * __formal) Line 17 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp:17)

Am i doing something stupid?

ADD: should i post an issue on github instead this forum?

2
General / Working from sources. Add custom module to SFML
« on: March 05, 2018, 01:17:55 pm »
Hi all.

I am working with SFML for quite some time now, and really enjoy it.

Last couple of months im writing my own simple game library, 100% based on manually builded SFML from master branch.
And i wondering how can i add 'custom' module to SFML? Like sfml-editor.lib for example.
Currently i have typical SFML project where my 'editor' module is. It contains scene, graph, nodes and all that stuff, with ability to save and load it from disk.

So the answer is that i need to build .lib file from my project and then link it alongside core SFML?
What is correct way to create custom module, that will behave like SFML module?

3
General / returned value / temporary lifetime ?
« on: October 23, 2017, 01:49:01 pm »
I'm trying to figure why:

// m_vector is a std::vector<IntRect>
const IntRect& Animation::getFrame() const
{
return getEmpty() ? IntRect() : m_vector.at( *valid index in range from 0 to m_vector.size() - 1* );
}

// Assuming that Animation.getEmpty() returns false ...
//
// 1 this is working
Animation* animation = some_object.getAnimation();
IntRect f = animation->getFrame();
some_object.setTextureRect(f); // valid IntRect passed
//
// 2 but this is not
some_object.setTextureRect(some_object.getAnimation()->getFrame()); // invalid IntRect passed

Ive read about lvalues and rvalues but at this moment cant apply that knowlege to this particular problem.

So i hope someone can breefly explain me what difference is in provided examples and what i did wrong



4
General / Tilemap implementation
« on: October 18, 2017, 03:11:53 pm »
Hello everyone!

Ive been working with sfml (and with C++ in general) for a few month now, and have some questions.

Im trying to implement Tilemap with chunks, and things goes pretty fine, but as it is my first attempt to make something like this, i wonder if im doing it right.

So can someone review my sources and point me to what i did wrong and what my common mistakes are.

https://github.com/joe5513/fragment

In short:

Grid is the class that represents a whole tilemap;
Chunk is the class that represents a part of tilemap, and contains Cells data and vertices;
Cell is the value struct that representing its type;

Grid is allocating Chunks and stores them in std::vector<Chunk*>;
Chunk is allocating Cells (aka tiles) and store them in Cell* pointer;
Grid object have some functionality to set and get Cells, to map them into  'world' coordinates and vice versa, and to draw Chunks;

Pages: [1]
anything