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.


Messages - Nanobyte7

Pages: [1]
1
Graphics / Re: Drawing problem
« 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.

2
Graphics / Re: Drawing problem
« 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
 

3
Graphics / [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!

4
Graphics / Re: This concept dosent make sense for me
« on: July 02, 2014, 12:28:12 am »
Thank you for the explanation! Ill just use .setVerticalSyncEnabled and .setFramerateLimit to not kill my CPU :D

5
Graphics / [SOLVED] This concept dosent make sense for me
« on: July 01, 2014, 02:37:17 am »
In the SFML 2.0 development book code, I saw this:
Quote
const sf::Time Game::TimePerFrame = sf::seconds(1.f/60.f);

    [...]

    sf::Clock clock;
    sf::Time timeSinceLastUpdate = sf::Time::Zero;
    while (mWindow.isOpen())
    {
        sf::Time elapsedTime = clock.restart();
        timeSinceLastUpdate += elapsedTime;
        while (timeSinceLastUpdate > TimePerFrame)
        {
            timeSinceLastUpdate -= TimePerFrame;

            processEvents();
            update(TimePerFrame);

        }

        updateStatistics(elapsedTime);
        render();
    }

Why would there be a fixed time-step but unlimited fps? When execute my program using this same concept my computer starts making a noise from buffering or displaying everything too fast. Wouldn't it make more sense to just put render in the while loop after update?

Pages: [1]
anything