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

Pages: [1]
1
SFML projects / Check out my Engine!
« on: July 25, 2013, 09:36:32 am »
Hey Guys,

I've decided to scrap what I have on my current project and start again. I'm making the new project open source to hopefully force myself to think about other developers and keep my code neat and readable.

Here is a link to the GitHub project: https://github.com/AndrewBerry/R9/
First commit of the engine working: https://github.com/AndrewBerry/R9/tree/cd4a3547cec9e1312b9c35db66a7ba3838ed6850

Any feedback is greatly appreciated, I've looked over this code a million times -- it would really help to get a second pair of eyes on it.

Thanks, Andrew

2
General / sf::Window::setFramerateLimit vs sf::Clock
« on: February 05, 2013, 01:19:02 am »
Is there any difference in precision using sf::Window::setFrameLimit compared to using my own sf::clock to limit the frame rate?

Thanks, Andrew.

3
Graphics / Jittering/Shaking sprites when moving with 'forces'
« on: February 02, 2013, 10:49:55 am »
Hello everyone,

As I'm working on a basic platformer to hone my programming skills I've noticed that my player sprite jitters or shakes as I'm moving.

The current method of moving the sprite is as follows (minimal code example):
// player.hpp
class player : public sf::Spite
{
public:
   player();

   void update();

   sf::Vector2f forces;
};

// player.cpp
player::player()
{
   forces = sf::Vector2f(0.f, 0.f);
}

player::update()
{
   if (sf::Keyboard::isKeyDown(sf::Keyboard::Left)
   {
      forces.x += 0.1f;
   }
   if (sf::Keyboard::isKeyDown(sf::Keyboard::Right)
   {
      forces.x -= 0.1f;
   }

   // friction
   forces.x *= 0.9f;

   move(forces);
}
 

player.update() is called every frame.

It's not just when it's accelerating/decelerating, it seems like it's every second.

Is it because the forces is stored as a float and the precision of the float is causing it to move weirdly on some specific cases?

Thanks for any help, If you know of a better way of controlling sprite movement please let me know.

4
General / [SOLVED] Linker problem (only occurring with release)
« on: December 13, 2012, 05:27:46 am »
Hello everyone I am having the following linker problems:
(I have double checked the linker options in my project properties)

1>colorManager.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Color::Color(void)" (__imp_??0Color@sf@@QAE@XZ)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: virtual bool __thiscall sf::RenderWindow::activate(bool)" (__imp_?activate@RenderWindow@sf@@EAE_N_N@Z)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) protected: virtual void __thiscall sf::RenderWindow::onResize(void)" (__imp_?onResize@RenderWindow@sf@@MAEXXZ)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) protected: virtual void __thiscall sf::RenderWindow::onCreate(void)" (__imp_?onCreate@RenderWindow@sf@@MAEXXZ)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual class sf::Vector2<unsigned int> __thiscall sf::RenderWindow::getSize(void)const " (__imp_?getSize@RenderWindow@sf@@UBE?AV?$Vector2@I@2@XZ)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IABUContextSettings@1@@Z)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::setFramerateLimit(unsigned int)" (__imp_?setFramerateLimit@Window@sf@@QAEXI@Z)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::close(void)" (__imp_?close@Window@sf@@QAEXXZ)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Texture::~Texture(void)" (__imp_??1Texture@sf@@QAE@XZ)
1>engine.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (__imp_?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Window::isOpen(void)const " (__imp_?isOpen@Window@sf@@QBE_NXZ)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Transformable::setPosition(float,float)" (__imp_?setPosition@Transformable@sf@@QAEXMM@Z)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::display(void)" (__imp_?display@Window@sf@@QAEXXZ)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::RenderStates const sf::RenderStates::Default" (__imp_?Default@RenderStates@sf@@2V12@B)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: virtual void __thiscall sf::Sprite::draw(class sf::RenderTarget &,class sf::RenderStates)const " (__imp_?draw@Sprite@sf@@EBEXAAVRenderTarget@2@VRenderStates@2@@Z)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Sprite::setTexture(class sf::Texture const &,bool)" (__imp_?setTexture@Sprite@sf@@QAEXABVTexture@2@_N@Z)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Sprite::Sprite(void)" (__imp_??0Sprite@sf@@QAE@XZ)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::RenderTarget::draw(class sf::Drawable const &,class sf::RenderStates const &)" (__imp_?draw@RenderTarget@sf@@QAEXABVDrawable@2@ABVRenderStates@2@@Z)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::RenderTarget::clear(class sf::Color const &)" (__imp_?clear@RenderTarget@sf@@QAEXABVColor@2@@Z)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (__imp_??0Color@sf@@QAE@EEEE@Z)
1>splashState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Sprite::~Sprite(void)" (__imp_??1Sprite@sf@@UAE@XZ)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) private: virtual void __thiscall sf::Shape::draw(class sf::RenderTarget &,class sf::RenderStates)const " (__imp_?draw@Shape@sf@@EBEXAAVRenderTarget@2@VRenderStates@2@@Z)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Shape::setFillColor(class sf::Color const &)" (__imp_?setFillColor@Shape@sf@@QAEXABVColor@2@@Z)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class sf::Color const sf::Color::Green" (__imp_?Green@Color@sf@@2V12@B)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Transformable::setPosition(class sf::Vector2<float> const &)" (__imp_?setPosition@Transformable@sf@@QAEXABV?$Vector2@M@2@@Z)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual class sf::Vector2<float> __thiscall sf::CircleShape::getPoint(unsigned int)const " (__imp_?getPoint@CircleShape@sf@@UBE?AV?$Vector2@M@2@I@Z)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual unsigned int __thiscall sf::CircleShape::getPointCount(void)const " (__imp_?getPointCount@CircleShape@sf@@UBEIXZ)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::CircleShape::CircleShape(float,unsigned int)" (__imp_??0CircleShape@sf@@QAE@MI@Z)
1>testState.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::CircleShape::~CircleShape(void)" (__imp_??1CircleShape@sf@@UAE@XZ)
1>textureManager.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Texture::loadFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class sf::Rect<int> const &)" (__imp_?loadFromFile@Texture@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$Rect@H@2@@Z)
1>textureManager.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Texture::Texture(void)" (__imp_??0Texture@sf@@QAE@XZ)
1>textureManager.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Texture::Texture(class sf::Texture const &)" (__imp_??0Texture@sf@@QAE@ABV01@@Z)
1>D:\Projects\Gentlemen_Wanderer\Release\Gentlemen_Wanderer.exe : fatal error LNK1120: 34 unresolved externals

This happens when I try and build my project in release mode, when I build in debug it works fine.
Is there something wrong with my release lib files?

5
Graphics / Slicing/extracting tiles from a grid of tiles
« on: August 11, 2012, 11:22:40 am »
Hey everyone,

I'm trying to copy a 25x25 pixel area from a master textures file and when I try and run my game this error appears in the output:


This is the code that I'm using:
  sf::Image tiles;
  tiles.loadFromFile("Resources/tiles.tga");

  sf::Image img;
  img.copy(tiles, 0, 0, sf::IntRect(0, 0, 25, 25)); // extracts the first 25x25 tile from "tiles"
 
  sf::Texture tex;
  tex.loadFromImage(img); // loads the texture from "img" which is just the first 25x25 tile

Is there any reason that I'm not seeing that is causing this?

Thanks,
Andrew

6
Hi everyone,

I'm using VC++ 2008 with the SFML 2.0 release candidate.

I have just started using the SFML SDK today and I'm slowly familiarizing myself with the smaller components of the graphics library first.

The problem I'm running into is when I try to debug my program (source below) it can't seem to locate local files on my hard drive. When I run the .exe created in the debug directory however, it is able to load the texture file perfectly fine.

Example of debugging:


When I run the compiled exe directly:


And my source code:
#include <vector>

#include <SFML/Graphics.hpp>

const sf::Color kvoid_color(40, 40, 40, 255);

int main() {
  sf::RenderWindow window(sf::VideoMode(800, 600), "Profound Seeker");
  window.setVerticalSyncEnabled(true);

  sf::Texture grass_texture;
  grass_texture.loadFromFile("Resources/grass_tile.bmp");
 
  sf::Sprite grass_sprite;
  grass_sprite.setTexture(grass_texture);
  grass_sprite.setTextureRect(sf::IntRect(0, 0, 40, 40));
  grass_sprite.move(100, 100);
  //grass_sprite.rotate(23.f);

  while (window.isOpen()) {
    sf::Event event;
    while (window.pollEvent(event)) {
      if (event.type == sf::Event::Closed)
        window.close();
    }; // while window.pollEvent(event)

    window.clear(kvoid_color);
    window.draw(grass_sprite);
    window.display();
  }; // while while window.isOpen()

  return 0;
}; // int main

Thanks to all who can help!

7
General / [SOLVED] Linker problems setting up SFML2 rc with VC++ 2008
« on: August 06, 2012, 07:33:03 am »
Hello everyone,

I have just tried to setup the release candidate of SFML 2.0 with VC++ 2008 on my windows 7 machine and I've encountered a linker problem.

This is the output from the test program that is shown in the setup tutorial found here (http://www.sfml-dev.org/tutorials/2.0/start-vc.php).


Here are some screenshots showing my project properties and some details of my file system showing that the files do exist in C:\SFML-2.0-rc. I tried to follow the setup tutorial to the letter.







As you can see the files do exist on my hard drive and I have followed all of the instructions in the setup tutorial.

Is there anything that I missed?

Thanks for any help you can provide.

Pages: [1]