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

Pages: 1 2 [3] 4
31
Feature requests / Unloadable Resources
« on: April 17, 2011, 03:02:17 am »
Quote from: "Tank"
Quote from: "Laurent"
I wouldn't call them "uninitialized" or "invalid", but "empty".

Then sf::Image::Unload() or sf::Image::Clear() would just be fine. To be honest I can't really think of situations where it's really needed, but for consistency I'd say it's okay.

I don't like the word "consistency", because if a function is not needed you should not implement it in my opinion. The very simple reason is, that it is easy to use it in a wrong way. You would be able to clear an image, but you also would be able, to "use" this empty image again. And so of course an image can be empty, but it isn't supposed to.

I rather would prefer not to offer any default constructor. So that the user had to initialise the image immediately after creating it.
If you cant initialise it immediately(see Laurent's example) I would use pointers(I would use them even with a default constructor, because it is very simple to check, weather a pointer is NULL or not and so you can prevent missuse of an uninitialised image).
So the code would look like:
Code: [Select]

class Game
{
public:
    Game()
        : tileset()
    {
    }

    ~Game()
    {
         if( tileset )
             delete tileset;
    }

    void LoadMap(const std::string& tileset)
    {
        if( !tileset )
            tileset = new sf::Image( "myImage.jpg" );
    }

private:
    sf::Image* tileset;
};

32
Graphics / Access Violation Problem
« on: April 16, 2011, 01:22:19 am »
What SFML version are you using? I don't have any problems with your code ;). I tested it with 1.6.

33
Feature requests / Unloadable Resources
« on: April 14, 2011, 08:55:59 pm »
The possibility of having empty objects, means not, that empty objects are good.
A sf:Image is supposed to contain image information. So you should load your image as soon as possible(to prevent errors). And if you don't need the image anymore, you should destroy the variable(e.g. removing it from a list) and not just remove the image information.
In my opinion it is a design problem. You should not create variables and if you don't need them anymore just reset them(and risk to use them although you mustn't).

But if you need it, just use pointers. These will do exactly what you want to. So why not?

And of course it would be pretty easy to add such a function, but - in my opinion - the user is not supposed to do that. And you shouldn't implement functions which are not recommendable to use ;)

34
Feature requests / Unloadable Resources
« on: April 14, 2011, 06:08:21 pm »
SFML hasn't got any resource manager. Hence a resource could not be destroyed or unloaded.
I would probably hate the SFML, if there were functions like:
Code: [Select]
image.Destroy()
The image would exist further on, but there would not be any valid image information. So have fun with runtime errors ;).
If you want to unload an image, you have to use an image manager which loads and unloads images. In this manner you make sure that an image is deleted from memory and not usable anymore.

35
Graphics / [Sprite Movement] Question
« on: April 14, 2011, 05:58:22 pm »
Is it not supposed to look like this?
Code: [Select]

float maxwidth = App.GetWidth() - Sprite.GetSize().x;
if( Sprite.GetPosition().x >= maxwidth )
    Sprite.SetPosition( maxwidth, Sprite.GetPosition().y );


Or did I misunderstand what you wanted to do?

36
General / Getting an object from another file
« on: April 14, 2011, 11:48:25 am »
Quote from: "jw6282000"
I haven't known C++ for long. I am learning by making a game with SFML.

I would rather not recommend that. C++ is a very complex programming language. So you should learn to programm C++ first before programming with SFML. There are languages you can learn while programming a little game, but C++ is definitely none of those. So it would also be better for you if you spend some time in learing C++.

I read in another forum about unnamed namespaces a few days ago, and I am supprised at the creativity of some programmers who don't want to use global variables(because everyone says that they are evil). So they are using singletons(but now everyone says singletons are evil, too) and obviously unnamed namespaces(I would say: evil ;)).
Just learn C++(use a good book and not bad source code^^) and you will know about classes, object oriented design and other good stuff and your programms will be much better :).

37
Graphics / View problems
« on: April 13, 2011, 01:14:43 am »
For that reason I created this green sprite. It is exactly 80 pixels high. And so this gap is not 95 pixels but really 80 pixels high.
It seems to be 95 pixels, but this may be caused(I don't know it for sure) by the view-size. The view-size has not the same ratio as the window size and so all objects will be streched.

38
General / SFML 1.6 and VS2010
« on: April 12, 2011, 03:06:21 pm »
But if you want to use SFML 2 dll files, but your application tells you that it is looking for SFML 1.6 dlls, you're obviously mixing up some libs ;).
By the way: I would recommend to you not to copy your librarys into your projects directory. Just set your directorys in VC2010 to the appropriate SFML folders(These paths would be interesting for us)

I uploaded my own SFML 2 binarys. So you can test it with these files. They are working fine for me, so they should work for you, too ;).
http://dl.dropbox.com/u/2541480/SFML2-VC2010.rar

39
Graphics / View problems
« on: April 12, 2011, 01:29:20 pm »
I don't know, what your problem is. I have just tested your application and it worked exactly as I would wish it to.
With this formula you should have some space of 80px below your "moving-area"
Code: [Select]
else if (y > yscreensize - View.GetSize().y / 2  + 80)
   sety = yscreensize - View.GetSize().y / 2 + 80;


For testing I added a sprite(height: 80px) at the bottom of the moving area. This is, what it looks like:


So what exactly is the problem?

40
General / SFML 1.6 and VS2010
« on: April 11, 2011, 10:07:17 pm »
The SVN version is SFML 2. For that reason there is a -2 as extension.

If you're getting errors that the dll files were not found, you have to copy the SFML dll files into the correct directory. For example into your project directory.

41
General / SFML 1.6 and VS2010
« on: April 11, 2011, 05:45:24 pm »
»-s.lib« is a static release library. ».lib« is a dynamic release library. »-s-d.lib is a static debug library and »-d.lib« is a dynamic debug library.

42
General / SFML 1.6 and VS2010
« on: April 11, 2011, 05:28:22 pm »
Quote from: "vicer1234"
I am getting the correct .lib files from the VS 2010...but dont know what to do next :( !!!!!!!

Well, I am afraid, you're not ;).
If you recompile the SFML libs the new files are usually created in ./lib/vc2008. So if you want to use the new libs you have to you use this new directory(even if it doesn't sound new^^).

43
General discussions / In need of a tutorial
« on: April 09, 2011, 11:03:00 am »
I recommend the SFML documentation to you.
http://www.sfml-dev.org/documentation/
You will find all the features and many examples how to use them. A tutorial, which explains everything, you'll probably not find.

44
General / Startup Error
« on: April 08, 2011, 11:29:08 pm »
Did you - if you're linking dynamically - copy the new compiled dlls to your game-project? Are you sure, that you're linking the new libs?

45
Graphics / RenderImage : unexpected segfault...
« on: April 08, 2011, 05:32:53 pm »
Your code works fine for me with Visual Studio. So I don't think, that it is a SFML-Bug. Probably there is something wrong with your libs(or Code Blocks doesn't like your code ;) - but I rather don't think so) or build-options. Unfortunately I have not enough experience with Code Blocks, to give you any advice. But I definitely don't think, that there is something wrong with SFML.

Pages: 1 2 [3] 4