Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [SOLVED]Drawing problem  (Read 1365 times)

0 Members and 1 Guest are viewing this topic.

Nanobyte7

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
[SOLVED]Drawing problem
« on: November 29, 2014, 08:06:07 pm »
Whenever i launch my game i get the error message :

  Problem Event Name:   APPCRASH
  Application Name:     Game.exe
  Application Version:  0.0.0.0
  Application Timestamp:        547a11b0
  Fault Module Name:    sfml-graphics-2.dll
  Fault Module Version: 0.0.0.0
  Fault Module Timestamp:       51f0bb92
  Exception Code:       c0000005
  Exception Offset:     0001641f
  OS Version:   6.3.9600.2.0.0.768.101
  Locale ID:    1033
  Additional Information 1:     5861
  Additional Information 2:     5861822e1919d7c014bbb064c64908b2
  Additional Information 3:     d1d9
  Additional Information 4:     d1d94a13d3609d6b740644c12508f581

My code:
State_MainMenu.cpp
//(class State_MainMenu : public State)
#include <SFML/Graphics.hpp>

State_MainMenu::State_MainMenu():
    mmPlayer()
{
    mmPlayer.setPosition(111.f,55.f);
    mmPlayer.setFillColor(sf::Color::Blue);
    mmPlayer.setRadius(30);
}

void State_MainMenu::displayTextures()
{
    this->application->mWindow.draw(mmPlayer);
}
 

State.h
#include "Application.h"

virtual void displayTextures() = 0;
Application* application;

 

Application.h
#include <SFML/Graphics.hpp>
public:
    sf::RenderWindow mWindow;

 

Any feedback is appreciated!
« Last Edit: November 30, 2014, 01:13:54 am by Nanobyte7 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10825
    • View Profile
    • development blog
    • Email
AW: Drawing problem
« Reply #1 on: November 29, 2014, 08:10:01 pm »
Build a debug version and run it through a debugger.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

dabbertorres

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • website/blog
Re: Drawing problem
« Reply #2 on: November 29, 2014, 08:17:58 pm »
In the code you've shown, I don't see you creating a window anywhere. Only declaring one.

Nanobyte7

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Drawing problem
« Reply #3 on: November 30, 2014, 12:11:45 am »
The window is initialized in the constructor,

Application.cpp
Application::Application():
    mWindow(sf::VideoMode(1920,1080),"Game Name",sf::Style::Close)

I can normally draw things into the window in application, but i cant access the window from a pointer. I am fairly new to C++, and was wondering if this was a decent way of handling the drawing of objects? Also, my debuggers information:

Starting debugger: C:\Program Files (x86)\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname  -quiet  -args C:/C__~1/Code/1QUEST~1/bin/Debug/Game.exe
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.5
Child process PID: 4188
Program received signal SIGSEGV, Segmentation fault.
In sf::RenderTarget::draw(sf::Vertex const*, unsigned int, sf::PrimitiveType, sf::RenderStates const&) () (C:\C__~1\Code\1QUEST~1\sfml-graphics-2.dll)
Debugger finished with status 0
 

Nanobyte7

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Drawing problem
« Reply #4 on: November 30, 2014, 01:13:31 am »
I decided just to pass the window through the parameters, so i solved the problem. Thanks for telling me about the debugger! I never used it until now.