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.


Topics - pinko64

Pages: [1]
1
SFML projects / Dodge the missile!
« on: September 20, 2014, 12:29:02 am »
Some brief testing with sfml has produced something, well, a quirk.


 
Should be pretty self-explanatory after you get bombed couple times.
And yes. P for pause.


Short instructions: Drag the waterdrops towards the stickmodel and missiles away.

2
Feature requests / Websocket feature
« on: April 13, 2014, 02:59:03 pm »
Websockets seems to be pretty cool way to add full-duplex network connection between an app and a web- browser.
It shouldn't be too hard to implement on using RFC 6455 specification.
sf::TcpSocket::Send and ..::Receive functions could take a sf::WebSocketPacket as an argument etc.

I think there are people that might find it useful.

As for now i'm writing my own implementation... which is a little bit dirty codewise so do not wanna share code.




3
Graphics / Draw Vector of pointers to a class = crash
« on: October 03, 2011, 02:56:45 am »
So i made a function, which makes new tysy object when it's called.
It then pushes the objects to a vector:

Code: [Select]

void piirto::CreateCan()
{
tysy *Can1 = new tysy(Win);
      std::cout << "Object " << Can1 << " says..." << std::endl;
Can1->Hello();
   std::cout << std::endl <<  std::endl;
 Can1++;
    Tyz.push_back(Can1);
}


Now in my mainloop i have:

Code: [Select]

//blabla
    Win.Clear();
    goDraw();
    Win.Draw(p12.s_tysy); //This draws fine.

    Win.Display();


Now the goDraw(); function has :

Code: [Select]

if (i want to do this .. .. . .)
                    for (int i = 0; i < Tyz.size(); ++i)
                            {
                                 Tyz[i]->Hello("buu");
                                 Win.Draw(Tyz[i]->s_tysy); // Crash

                            }


If i call Tyz->Hello("buu"); It prints buu nice and soundy.
But whenever i try to draw those same sprites from s_tysy members using pointers to objects it causes a crash.
Program compiles good.

So if i just make normal tysy object i can draw it's sprite ok.
So why is this pointer thing crashing it?

Code: [Select]
tysy
   .h
        sf::Image       i_tysy;
        sf::Sprite      s_tysy;


   .cpp
i_tysy.LoadFromFile("kanuuna.jpg");
   s_tysy.SetImage(i_tysy);
   s_tysy.SetScale(0.4,0.4);
   s_tysy.SetColor(sf::Color(255,0,0,255));


Any help & instructions are welcome!

Pages: [1]