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

Pages: [1]
1
Graphics / SFML does not wan't to draw a line
« on: October 06, 2011, 08:42:33 am »
Yeah, I know the code is quite messy (it was written fast just to test some code, but you're wriht: this shouldn't be an excuse)

Yes vec2D is a mathematical 2dimensional vector, but I wanted it to have more functionalities(the startpoint) because for some calculations is is handy that you've got a startpoint.

The zerovectors were there to experiment with other functionalities, but this isn't that important too.

Yes I used using namespace sf, but some code I copy pasted from a former program, where I didn't use it. But that shouldn't be a problem i guess?

When I increase line thickness, nothing changes. But I just think it's weird, because it prints out the values i want it to print. And these values are being sent but nor printed in the screen.

The couts i put there were simply to test if the right values were given

2
Graphics / SFML does not wan't to draw a line
« on: October 05, 2011, 09:58:36 pm »
Hi,

I am trying to making my own game in my spare time. (It's a project I'm doing on my new website webthomas.sharkserve.com, which is actually part of the project too).

Now I've written a class called vec2D. I think it was all okay, but 1 problem kept occuring:
There's one line it doesn't want do draw.

Code: [Select]
void printvec(vector<vec2D> v, int n){
RenderWindow win(VideoMode(1000, 1000), "screen");
win.Clear(sf::Color::Black);
for(int i1=0; i1<=n;i1++){
win.Draw(Shape::Line(v[i1].getStartX(),v[i1].getStartY(),v[i1].getStartX()+v[i1].getVecX(),v[i1].getStartY()+v[i1].getVecY(),2,Color::Green));
cout <<v[i1].getStartX()<<' '<<v[i1].getStartY()<<' '<<v[i1].getStartX()+v[i1].getVecX()<<' '<<v[i1].getStartY()+v[i1].getVecY()<<endl;
}
win.Display();
while (win.IsOpened()){
Event Event;
while (win.GetEvent(Event)){
//Sluit het scherm
if (Event.Type == Event::Closed){//het scherm sluiten
win.Close();
}
}
win.Clear(sf::Color::Black);
for(int i1=0; i1<=n;i1++){
win.Draw(Shape::Line(v[i1].getStartX(),v[i1].getStartY(),v[i1].getVecX(),v[i1].getVecY(),1,Color::Green));
}
win.Display();
}
return;
}


the output of this function is:
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
20 20 120 60
20 20 60 120
140 140 280 280
0 0 0 0

which is allright, except that id doesn't want to draw the line starting at (140,140) going to (280,280)

Pages: [1]