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

Pages: [1] 2 3 4
1
Graphics / Re: [C++] Moon and Stairs shift ?
« on: April 12, 2013, 11:55:02 pm »
How can i calculate the new Position ?

2
Graphics / Re: [C++] Moon and Stairs shift ?
« on: April 12, 2013, 06:51:21 pm »
Yes parallax scrolling was the term that i am searching for! But can i make it with a view without moving them around ? i have a free world space ? and its to huge for move all stars separately around ?

i dont understand how :(


#include "Background.h"

Background::Background(b2World *g_world, sf::RenderWindow &g_window ){

        int size = 50;


        for(int i = 0; i != size; i++){

                float rand_size = frandom(2.f,6.f);
                float rand_positionX = frandom(-500.f,500.f);
                float rand_positionY = frandom(-500.f,500.f);

                sf::RectangleShape t_shape;

                t_shape.setSize(sf::Vector2f(rand_size, rand_size));
                t_shape.setFillColor(sf::Color::White);
                t_shape.setPosition(sf::Vector2f(rand_positionX, rand_positionY));

                StarsList.push_back(t_shape);

        }

}
void Background::Update(sf::RenderWindow *g_window){
        sf::View cam = g_window->getDefaultView();
        float speed = 0.0000033f;


        std::list<sf::RectangleShape>::iterator I;
        for(I = StarsList.begin(); I != StarsList.end(); ++I){
                (*I).move((*I).getPosition().x * cam.getCenter().x * speed, (*I).getPosition().y * cam.getCenter().y * speed);
        }
}
void Background::Draw(sf::RenderWindow *g_window){
        std::list<sf::RectangleShape>::iterator I;
        for(I = StarsList.begin(); I != StarsList.end(); ++I){
                g_window->draw((*I));
        }
}
 

3
Graphics / [C++] Moon and Stairs shift ?
« on: April 11, 2013, 09:04:19 pm »
Hello :)

How can i shift stars and moons in a scene ?

Example:

The blue thing is the player in two different situations.
Left: there are some stars behind the moon
Right: only the player(the view) moves a bit to the right and i can see more stars


[attachment deleted by admin]

4
Network / Is disconnected
« on: March 20, 2012, 03:11:28 pm »
all is okay ;) i have found my misstake by myself.
i have post waht was wrong ;)

5
Network / Is disconnected
« on: March 20, 2012, 03:03:42 pm »
I done that it work but now i have another problem
if anyone User disconnected the server shuting down but there is nothing like shutdown oô in code


The server Loop
Code: [Select]

void Main::Loop(){
while(Run){
if(Selector.wait()){
if(Selector.isReady(Server)){
sf::TcpSocket* User = new sf::TcpSocket;
if(Server.accept(*User) == sf::Socket::Done){
sUser *theUser = new sUser;

theUser->Client = User;
theUser->State = 0;
theUser->Remove = false;

UserList.push_back(theUser);
Selector.add(*User);
cout << "User connected" << endl;
}
}else{
for(std::list<sUser*>::iterator it = UserList.begin(); it != UserList.end(); ++it){
sUser& User = **it;
if(Selector.isReady(*User.Client)){
sf::Packet Data;
sf::TcpSocket::Status State = User.Client->receive(Data);
if(State == sf::Socket::Done){
HandleData(Data,User);
}else if(State == sf::Socket::Disconnected){
User.Remove = true;
PublicMessage(User.ClientName + " has left the Chat.");
}else if(State == sf::Socket::Error){
cout << "Error" << endl;
}
}
}
UserList.remove_if(CanRemove);
}
}
}
}


OHH ifound it self :)

i have forgett to remove the client from selector
Code: [Select]
Selector.remove(*User.Client);
and add the client RIGHT to the selector
Code: [Select]
Selector.add(*theUser->Client);

 all is okay CLOSED :)

6
Network / Is disconnected
« on: March 20, 2012, 02:13:34 pm »
I do every time this.
in a Thread

Code: [Select]

for(std::list<sUser*>::iterator it = UserList.begin(); it != UserList.end(); ++it){
if(Selector.isReady(*User.Client)){
sf::Packet Data;
if(User.Client->receive(Data) == sf::Socket::Done){
HandleData(Data,User);
}
}

}

7
Network / Is disconnected
« on: March 20, 2012, 01:43:48 pm »
Where can i handle that the TcpClient is disconnected from the TcpSocket i have a complete Chat but i dont know where i can handle that ? or how ?

8
SFML projects / [Released] libMy - Datapackaging library
« on: March 18, 2012, 06:06:29 pm »
Hmm okay thats bad i need something like pkg who i can insert all my data crypted.

9
SFML projects / [Released] libMy - Datapackaging library
« on: March 18, 2012, 03:52:05 pm »
How to Build it oô ? I use msvc2010pro can anyone help me please :S

10
Graphics / Better FPS drawing 10.000 sprite
« on: March 11, 2012, 10:00:39 pm »
Here and example :)

i have an Area 1000x1000.
I create now 100 sf::Images

Code: [Select]

for(int x = 0; x != 100; x++){
    sf::Image *Chunk = new sf::Image;
    Chunk->Create(1000,1000);
}


Then i add all the Objects that are on this area schould be with
Code: [Select]

Chunk->Copy(Exampleimage,X,Y,IntRect(0,0,Exampleimage.GetWidth(),Exampleimage.GetHeight()),true);


then convert to the sprites and add too sprite list
Code: [Select]
Texture *tChunk = new Texture;
tChunk->LoadFromImage(Chunk,IntRect(0,0,1000,1000));
Sprite *sChunk = new sf::Sprite(*tChunk);
sChunk->SetOrigin(0,0);
sChunk->SetPosition(sf::Vector2f((float)xCount,(float)yCount));
BackgroundChunks.push_back(sChunk);


generate new position for the next "chunk"
Code: [Select]
xCount += 1000;
xCounter++;
if(xCount == 5000){
xCount = -5000;
yCount += 1000;
xCounter = 0;
yCounter++;
}


and then Draw the 100 Sprites
Code: [Select]
for(list<sf::Sprite*>::iterator IT = BackgroundChunks.begin(); IT != BackgroundChunks.end(); IT++){
_RenderWindow->Draw(**IT);
}


its very simple ;)

11
Graphics / Better FPS drawing 10.000 sprite
« on: March 11, 2012, 07:47:06 pm »
i draw about 100*random(100,500) Sprites with a little trick and high performance :)

12
General / Rating of "Light Fighter"
« on: March 11, 2012, 12:46:00 pm »
The animation have 14 frames the first flame begin with 1 the second with 7 in hope that its not see like the same. with particels itts a good idea thank you ;)

I had done a gun, here it is :)


13
General / Rating of "Light Fighter"
« on: March 10, 2012, 11:04:14 pm »
I want to know how this animation are(the speed of the animation is not equal the in-game speed).
Please rate and leave a reply. :)
Its made in Photoshop CS5


14
Window / help setting fullscreen resolution with view.
« on: March 08, 2012, 04:53:17 pm »
If view.SetSize(640 ,480 ); everytime equal the window size then the view is correct and you dont have resized images or background or anything else.

15
Graphics / [Search] PartcicleSystem
« on: March 07, 2012, 10:25:27 pm »
Can i use it seperate to sfml2 or musst i use the complete engine oô ?

Pages: [1] 2 3 4
anything