16
Graphics / sf::Texture.. "colliding" with sf::Text ?
« on: November 10, 2011, 11:54:23 am »
*Mind blown*
Oh, wow.
Thanks, Laurent!
Oh, wow.
Thanks, Laurent!
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.
int main () {
sf::RenderWindow App(sf::VideoMode(X_RATIO, Y_RATIO, 32), WINDOW_TITLE);
App.SetFramerateLimit(32);
while (true) {
App.Display();
}
return 0;
}
//X_RATIO and Y_RATIO are 640 and 480 respectively
int main () {
//Set up the system
sf::RenderWindow App(sf::VideoMode(X_RATIO, Y_RATIO, 32), WINDOW_TITLE);
App.SetFramerateLimit(FPS);
sf::Vector2f center (X_RATIO/2, Y_RATIO/2);
sf::Vector2f half (X_RATIO, Y_RATIO);
sf::View View(center, half);
App.SetView(View);
//Other stuff
sf::Texture Texture;
if (! Texture.LoadFromFile("swapped.jpg")) {
App.Close();
}
sf::Sprite Sprite;
Sprite.SetTexture(Texture);
Sprite.Scale(X_RATIO/Texture.GetWidth(), Y_RATIO/Texture.GetHeight());
//Font/String Stuff
sf::Font Font;
if (! Font.LoadFromFile("04B_30_.TTF")) {
App.Close();
}
sf::Text Text("Hello, world!", Font);
//Main Loop
while (App.IsOpened()) {
if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Escape)) {
App.Close();
}
App.Clear(sf::Color(0, 0, 0));
App.Draw(Sprite);
App.Draw(Text);
App.Display();
}
return 0;
}
Windows has triggered a breakpoint in ItBotB.exe.
This may be due to a corruption of the heap, which indicates a bug in ItBotB.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while ItBotB.exe has focus.
The output window may have more diagnostic information.
> sfml-graphics-d-2.dll!_free_dbg_nolock(void * pUserData, int nBlockUse) Line 1322 + 0x9 bytes C++
sfml-graphics-d-2.dll!_free_dbg(void * pUserData, int nBlockUse) Line 1265 + 0xd bytes C++
sfml-graphics-d-2.dll!operator delete(void * pUserData) Line 54 + 0x10 bytes C++
sfml-graphics-d-2.dll!std::allocator<unsigned int>::deallocate(unsigned int * _Ptr, unsigned int __formal) Line 182 + 0x9 bytes C++
sfml-graphics-d-2.dll!std::basic_string<unsigned int,std::char_traits<unsigned int>,std::allocator<unsigned int> >::_Tidy(bool _Built, unsigned int _Newsize) Line 1998 C++
sfml-graphics-d-2.dll!std::basic_string<unsigned int,std::char_traits<unsigned int>,std::allocator<unsigned int> >::~basic_string<unsigned int,std::char_traits<unsigned int>,std::allocator<unsigned int> >() Line 755 C++
sfml-graphics-d-2.dll!sf::String::~String() + 0x16 bytes C++
sfml-graphics-d-2.dll!sf::Text::~Text() + 0x54 bytes C++
ItBotB.exe!main() Line 59 + 0x1c bytes C++
ItBotB.exe!__tmainCRTStartup() Line 555 + 0x19 bytes C
ItBotB.exe!mainCRTStartup() Line 371 C
sf::Font Font;
Font.LoadFromFile("04B_30_.TTF");
sf::Text Text("Hello, world!", Font);
while (true) {
Window.Draw(Text);
}
/*
* If this ASSERT fails, a bad pointer has been passed in. It may be
* totally bogus, or it may have been allocated from another heap.
* The pointer MUST come from the 'local' heap.
*/
_ASSERTE(_CrtIsValidHeapPointer(pUserData));