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
General / Distributing SFML games on other websites.
« on: January 28, 2012, 12:49:47 pm »
Quote from: "Viruses"
How do i encrypt my files?

You will probably want a unique encryption so that nobody knows how to decode it.
The problem is that you will have to do this completely by yourself.

Start with writing a simple encryptor program: read the file and add 1 to every byte. Then save the file with a different extension.
Nobody will be able to open it now. Only your game can read it, because it reads the file and decrements every byte before is starts.

For a stronger and more secure encryption you will have to make a better formula (not just adding 1). You do this by adding, subtracting and multiplying bytes with each other.
Eventually you can even use more bytes for your file (original is e.g. 1kb while the encrypted version is 2kb).
But always make sure that the encryption can be reversed by your game.


Although the above will give you a little bit more protection, I completely agree with what the other people already told you: nothing is completely secure.
I wouldn't waste my time in writing a good encryption and I would want my game to be good: not letting it start slower because it first has to decode every file.

467
Graphics / Dragging Sprite outside original position
« on: January 26, 2012, 08:34:43 pm »
Quote
So that if Sprite1 is being dragged over Sprite2, then Sprite2 is also not dragged along with Sprite1.

You should have a variable to store which sprite is being dragged.
It is e.g. 0 when you aren't dragging, 1 when dragging Sprite1, ...
When you start dragging Sprite1 the value will become 1. You then move over Sprite2 and it must check if the variable is 2.
This is not the case so Sprite2 will not be moved.

I hope this makes any sense.

468
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.

469
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).

470
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.

471
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.

472
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);

473
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.

474
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.

475
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)

476
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?

477
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".

478
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?

479
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.

480
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.

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