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

Pages: [1]
1
General / Zooming quality - especially primtives
« on: June 26, 2013, 01:25:21 am »
I've noticed that with SFML there seems to be a clear degradation of the quality of the image when zooming out, is there a way to circumvent this?

Will I need to look into actually rendering the 2D view in real 3D?

I'm in the process of making a 2D RTS which will use the zooming in and out feature of supreme commander.

2
General / Trying to make separate timer and rendering loops
« on: March 08, 2012, 02:32:45 am »
Well, as explained in the title I'm trying to do this abiding by the rules of the clock and sf::sleep, atm I have the following code.

Code: [Select]
/*
 * main.cpp
 *
 *  Created on: 5 Mar 2012
 *      Author: Lee
 */

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <iostream>
#include <vector>
#include "InGameHandle/inGame.hpp"
#include "InGameHandle/gameStateBase.hpp"


class EngineMain{
private:
  sf::VideoMode myVideoMode;
  sf::RenderWindow myWindow;
  sf::Clock gameClock;

  sf::Clock fpsClock;
  sf::Clock lpsClock;

  GameStateBase* applicationIsInPointer;


  float constantFPS;
  float constantLPS;

  float lastTime;

  bool draw;
public:

void init(float _fps, float _lps)
{
  constantFPS = _fps;
  constantLPS = _lps;

  draw = false;

  myVideoMode.Width = 1024;
  myVideoMode.Height = 768;
  myVideoMode.BitsPerPixel = 16;
  myWindow.Create(myVideoMode, "hello");
  applicationIsInPointer = new InGameHandler;

  appRunning();
}

void appRunning()
{
  //Game init
  applicationIsInPointer->init();

  while (myWindow.IsOpen())
    {
      sf::Event event;
        while(myWindow.PollEvent(event))
          {
            switch(event.Type)
            {
            case sf::Event::Closed:
              myWindow.Close();
              break;
            default:
              break;
            }
          }

        if(lpsClock.GetElapsedTime().AsMilliseconds() > constantLPS)
          {
            applicationIsInPointer->logic();
            //Update the logic of the game
            lastTime = lpsClock.GetElapsedTime().AsMilliseconds();
            lpsClock.Restart();
          }

        if(fpsClock.GetElapsedTime().AsMilliseconds() > constantFPS)
          {
            myWindow.Clear();
           //Return EVERYTHING that needs to be drawn from the game here
            applicationIsInPointer->draw();
            //Then for loop through it and draw it
            myWindow.Display();
            fpsClock.Restart();
          }
        sf::Sleep(sf::Milliseconds(lastTime));

    }

}


};

int main()
{
  EngineMain engine;
  engine.init(60,60);
}






I know I'm doing a lot wrong here, but can someone help me out with this and explain the logical steps so I can learn?

You may be wondering why I'm not using "Set frame limit", this is because it doesn't appear to set the frame limit correctly or reliably on my PC.

Pages: [1]
anything