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

Pages: 1 ... 30 31 [32] 33 34
466
Graphics / renderWindow.GetFrameTime?
« on: January 24, 2012, 04:59:00 pm »
GetFrameTime was removed. There is another recent topic about this: http://www.sfml-dev.org/forum/viewtopic.php?t=6831.

467
Graphics / How to create a Rect, the same size/location as a Shape
« on: January 24, 2012, 03:34:37 pm »
Obviously these lines are completely wrong. You need the right and bottom position, not the scale.
Code: [Select]
ghostRect.Right = Player.GetScale().x;
ghostRect.Bottom = Player.GetScale().y;

But I wouldn't know how to get the right and bottom position either.

You should use SFML 2, I know that it is possible there with sf::RectangleShape (but you will have to adjust your code because SFML2 is a little different).

468
General / Distributing SFML games on other websites.
« on: January 23, 2012, 03:59:27 pm »
Quote
Where did all the dlls, assets go??

I still think that it is better not to worry about all those problems, but if you distribute the game for windows only then you can do some things:
- link statically (if possible), then there will be no dll files.
- You can add your images as a resource in your exe. This is probably what they did with the 2D game you were talking about.
Do note that there are ways to extract the resources from the exe. I wouldn't be surprised that you would find the images inside that exe file of the 2D game.

If you really care about it then do what I said before: encrypt your files in some way and change the extension. Nobody will ever understand how to open these file unless they start disassembling your exe file.

469
General / Distributing SFML games on other websites.
« on: January 22, 2012, 08:58:32 pm »
Quote
Its just that if they MODIFY them and then they play the game, they get to play the game with watever thing they make.
If they would modify the models, then on your computer your player will look a little different, but you only changed your own models so all other players would still see you with your old clothes.
The clothes might look different to u, but its not like you get a better defense or something like that.

Quote
So for example, in a 3D game you might have to pay money in order to get some items or clothing. Some clothing is only for looks. So lets say you modify the game and then you get to get the clothing for free because you modified it YOURSELF.
They can't just add new clothes, your game decides what models are loaded.
If you decide that certain models are only loaded after they pay then it doesn't matter if they add the models to the files or not.

There isn't that much for people to change. I wouldn't bother about it.

Quote
So do i have to make my own formats to protect my assets
You can always make your own encryption and decode all files when the game starts, but then the loading would take longer.

470
Graphics / Is it possible to draw FloatRects to the screen?
« on: January 22, 2012, 08:35:26 pm »
Quote
but RectangleShape doesn't have the methods like Intersect and Contains though.

Just use your FloatRect for collision detection and create a RectangleShape from it when drawing:

Code: [Select]
sf::RectangleShape shape(sf::Vector2f(rect.Width, rect.Height));
shape.SetPosition(rect.Left, rect.Top);
window.Draw(shape);

471
Graphics / SetBlendMode in SFML2.0?
« on: January 22, 2012, 07:45:28 pm »
Take a look at the RenderStates.
This can be passed as the second parameter to your Draw function.

472
General / Just a few questions about sf::Sprite
« on: January 18, 2012, 07:07:41 pm »
I think you are right with option B: one texture with one sprite. Don't create multiple sprites just to give them all a different position.

I wouldn't go for multiple textures with one sprite, I would keep one sprite per texture.
In some situations even multiple sprites with the same texture: If you have e.g. a button class then each button object will contain a sprite while all the buttons will use the same texture.

This is of course just my opinion, I haven't been working with SFML very long.

473
Graphics / sf::Sprite -> Move and SetPosition
« on: January 18, 2012, 04:15:51 pm »
SetPosition will change the position to the passed value, so SetPosition(20, 20) will put the sprite on position (20, 20).
Move will do exactly what the name suggests, move the sprite. If before the position was set to e.g. (60, 60) and you would call Move(20, 20) then the new position will be (80, 80).

So usually you will be using SetPosition and to change the position later when e.g. moving an object on the screen you can use Move.
So Move(x, y) is just to make this line more simple: SetPosition( GetPosition().x + x, GetPosition().y + y)

474
Graphics / Loading an image with OS X
« on: January 15, 2012, 04:09:15 pm »
I don't know anything about XCODE, but does it work when you pass the complete pathname?

475
Graphics / Loading an image with OS X
« on: January 15, 2012, 03:50:41 pm »
It doesn't matter where the main.cpp file is located, but where the project is located.
So if your project was above the playground folder then you should load "playground/assets/sprite.png".

476
Graphics / Problems with Tile displaying
« on: January 11, 2012, 06:14:57 pm »
First of all I must say that I didn't understand much of the problem, nor did I ever work with tiles or the SetSubRect function.
But I notice one thing: if I look at the code I think that you want to draw squares.
This are the values that u pass to the rectangle:
Code: [Select]
sf::IntRect Rect(0, 60, 60, 120);The last number is not the bottom position, but the height. If you were drawing squares then this should be 60.
Also if you wanted the top left piece of your image then the second number should be 0.

But if this is not the problem, then could you please try to explain the problem a little bit better?

477
Graphics / Animating a sprite between 2 points
« on: January 10, 2012, 05:17:32 pm »
You must first calculate the distance between the points. For x this will be 500-100 = 400 and the y will be -90.

The ratio of these numbers is −4.444, so for every y value you decrement, the  x value must be added with 4,444.
Or for every x value you increment, the y value must be decreased by 0,225.

I hope you will be able to put that into a code, I don't have time for it now.

478
Graphics / sf::Sprite has no member named GetSize
« on: January 08, 2012, 08:15:45 pm »
You are probably calling Sprite.GetSize() somewhere, but this function doesn't exist.
You probably found the function in the sfml 1.6 tutorial, but it seems to be removed in sfml2.

After a quick look in Sprite.hpp I think you will need GetTextureRect.
This function is a little bit different (it returns a rect instead of the size), but I think it will give you the same result.

Otherwise you can call Texture.GetWidth() and Texture.GetHeight() to find out what the size of the texture is.

479
General / Problem with compiling AniSprite
« on: January 08, 2012, 08:04:06 pm »
Quote
I put #include "AniSprite.cpp" at the top

A cpp file is a source file and shouldn't be included like a header file.
If it works for you then its good, but it is not the correct way to do it.

You should add it just like the main.cpp file or any other source file.

480
General / Problem with compiling AniSprite
« on: January 08, 2012, 07:02:05 pm »
Have you included AniSprite.cpp in your project?
Putting it in the same folder isn't enough.

Pages: 1 ... 30 31 [32] 33 34
anything