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

Pages: [1]
1
SFML projects / Re: Capture the flag AI Sandbox
« on: February 20, 2016, 10:00:34 am »
Is this Open Source?

I was hoping on doing the same thing and I thought I might help you with the project. It sounds really cool.

Regards,
Daniel

2
Graphics / Re: SFML 2.1 Bus error
« on: February 27, 2014, 09:47:26 pm »
Ok . Got the source code from github and I just modified the folders in order to keep the order how i wanted :D And it works ... I must have been doing something wrong . Thank you !

PS: Great job with the book.

3
Graphics / Re: SFML 2.1 Bus error
« on: February 27, 2014, 08:46:43 pm »
@Nexus ... OMG ... Thanks for this awesome book .
I'm trying to understand exactly what happens and debug as much as I can by myself thus improving my debugging skills and getting a better grasping of these concept.
It doesn't . Earlier when there was only the plane I had no problem. I know it's because of me ... but not sure why. I think it's something too subtle for my skills

4
Graphics / Re: SFML 2.1 Bus error
« on: February 27, 2014, 08:20:11 pm »
Ok . Here it is all the code I think it's needed

template <typename Resource, typename Identifier>
void ResourceHolder<Resource, Identifier>::load(Identifier id, const std::string &filename)
{
  std::unique_ptr<Resource> resource(new Resource());
  if(!resource->loadFromFile(filename)) //it breaks inside the loadFromFile function
  {
    throw std::runtime_error("ResourceHolder::load couldn't load " + filename);
  }

  auto inserted = mResourceMap.insert(std::make_pair(id, std::move(resource)));
  assert(inserted.second);
}
 

void World::loadTextures()
{

        std::cout << "world::loadtextures\n";
        mTextures.load(Textures::Eagle, "Media/Gfx/Eagle.png"); //the above function is called here
        std::cout << "eagle done\n";
        mTextures.load(Textures::Raptor, "Media/Gfx/Raptor.png");
        std::cout << "raptor done\n";
        mTextures.load(Textures::Desert, "Media/Gfx/Desert.png");
        std::cout << "desert done\n";
}
 

I made sure the files are there (even if they weren't it shouldn't give a bus error.


The World constructor
World::World(sf::RenderWindow& window)
: mWindow(window)
, mWorldView(window.getDefaultView())
, mTextures()  //constructor of mTextures here !!!
, mSceneGraph()
, mSceneLayers()
, mWorldBounds(0.f, 0.f, mWorldView.getSize().x, 2000.f)
, mSpawnPosition(mWorldView.getSize().x / 2.f, mWorldBounds.height - mWorldView.getSize().y / 2.f)
, mScrollSpeed(-50.f)
, mPlayerAircraft(nullptr)
{
        std::cout << "constr world::world\n";
        loadTextures();
        buildScene();

        mWorldView.setCenter(mSpawnPosition);
        std::cout << "exit world::world\n";
}
 

Also, the code compiles under g++ with c++0x standard.

5
Graphics / Re: SFML 2.1 Bus error
« on: February 27, 2014, 06:14:35 pm »
Sorry for that . Didn't realise ... If anyone could move this topic to the correct section I'd be grateful.

It's not the source code from github exactly .. I just made the code how I saw in the book and only used the code from github to correct some stuff

Here is the code where the "magic" happens
template<typename Resource, typename Identifier>
template<typename Parameter>
void ResourceHolder<Resource, Identifier>::load(Identifier id, const std::string &filename, Parameter& secondParam)
{
  std::unique_ptr<Resource> resource(new Resource());
  if(!resource->loadFromFile(filename, secondParam))
    throw std::runtime_error("ResourceHolder::load couldn't load " + filename);
  auto inserted = mResourceMap.insert(std::make_pair(id, std::move(resource)));
  assert(inserted.second);
}
 

6
Graphics / SFML 2.1 Bus error
« on: February 27, 2014, 04:57:48 pm »
I am using SFML 2.1 on Ubuntu 12.04 .
Anybody got this before ?



It seems like its from the SFML library rather than my game. Also the source code is from a SFML game dev book so it shouldn't have big bugs ... (though i didn't copy paste it)

7
Graphics / Re: SFML 2 RenderWindow::capture
« on: July 30, 2012, 12:03:54 pm »
saveToFile will return false, and since I save it as ("screenshot.jpg") there shouldn't be a problem with the folder , right ?

8
Graphics / SFML 2 RenderWindow::capture
« on: July 27, 2012, 04:32:50 pm »
Hey everyone !
So ... I got this code :
sf::Image Screenshot ;
Screenshot = Window.capture() ;
Screenshot.saveToFile ("screenshot.jpg") ;

and for some reason it won't save my image . Can you point me in the right direction please?

Note : I'm using SFML 2 amd Code::Blocks

Pages: [1]