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

Pages: [1] 2 3
1
General / Why does SFML cut off output before the main while loop?
« on: August 15, 2011, 10:41:32 pm »
Quote from: "Laurent"
std::cout is buffered. Use std::endl or std::flush to force it to output its internal buffer to the console.


I don't really know what that means, but it worked!

Thank you, I am always baffled by how fast you respond to things here. It's awesome.

2
General / Why does SFML cut off output before the main while loop?
« on: August 15, 2011, 10:30:44 pm »
Hi guys, I've noticed something strange. I just want to output a few variables before the main while(App.IsOpened()) loop, but it seems like it doesn't display the last thing before the loop until something inside the loop outputs. For example, if I have:

Code: [Select]

cout << endl << "Vert angle before: " << twoLayers[0].vertical_tilt_angle;
cout << endl << "Horiz angle before: " << twoLayers[0].horizontal_tilt_angle;
while(App.IsOpened()){


It only displays the first line, until an event in the loop triggers another cout, at which point it outputs the second line, then the one from the event.

If I put in this:

Code: [Select]

cout << endl << "Vert angle before: " << twoLayers[0].vertical_tilt_angle;
cout << endl << "Horiz angle before: " << twoLayers[0].horizontal_tilt_angle;
cout << endl << "MOOOOOOOOOO";
while(App.IsOpened()){


It outputs both, but not the MOOOOOOO until, as before, something in the loop outputs.

I'm noticing this inside the loop as well, and it's a little annoying. Does anyone know the cause of it?

Thanks!

3
General / sf::Image::CopyScreen() not in sf::Image??
« on: August 13, 2011, 09:36:07 pm »
Quote from: "Nexus"
You can checkout the latest source code from GitHub, so you have access to the newest features and bugfixes.

I thought you would use an older version, but it seems like it is quite up-to-date, too (2011-07-28). I am not used to Arch Linux and its packaging system, I have always used Git directly (on Windows and Ubuntu).


Yeah, that's why I'm confused. Arch's main thing is being "cutting edge", which is cool, but sometimes a huge PITA.

Any idea why it's not compiling for me? I'm compiling with the -l flags. In fact, I'm using the same exact code and makefile, and both systems have the same exact version of SFML. Any ideas?

Thanks!

4
General / sf::Image::CopyScreen() not in sf::Image??
« on: August 12, 2011, 07:57:29 pm »
Quote from: "Nexus"
Why don't you just use the latest SFML 2 Git revision? Then you don't have to port a lot of code when SFML 2 is finally released.


Errr, I'm sorry, I don't know what that means...

If I do pacman -Qi sfml, it gives me:

Version        : 1.99.git20110728-1

What exactly do you mean?

Also, very strangely, at my work computer, I have the same exact version with Arch Linux, and my code is working fine. When I try the same code at home (with the same version of SFML), it is giving me errors:

Code: [Select]
undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, sf::WindowSettings const&)'


Strange...

5
General / sf::Image::CopyScreen() not in sf::Image??
« on: August 11, 2011, 05:28:36 pm »
Wow, I feel like an idiot. I looked at my Image.hpp file and it showed the header for CopyScreen():

Code: [Select]
bool CopyScreen(RenderWindow& window, const IntRect& sourceRect = IntRect(0, 0, 0, 0));

There is a default Rect, so I don't need to supply one. Herp derp!

myImage.CopyScreen(App);

6
General / sf::Image::CopyScreen() not in sf::Image??
« on: August 11, 2011, 05:17:38 pm »
Quote from: "Laurent"
SFML 2 changes a lot, so don't trust older topics, only the online documentation is reliable (assuming you use the latest snapshot -- it you use an older one you can only rely on headers).

So if you have a recent revision (not more than a few days old), RenderWindow::Capture is back.

If you have an older revision (which should be the case since your compiler still finds Image::CopyScreen), read the documentation (in Image.hpp directly) of Image::CopyScreen. I don't know what your "5" is supposed to be, but it's not a rectangle ;)


Thanks for the swift response!

I'm using "sfml1.99" which is Arch's package for it. From another thread I read here it seems that it is an alpha version of SFML 2.

RenderWindow::Capture definitely doesn't work. If I try App.Capture(), it says

Code: [Select]
error: class 'sf::RenderWindow' has no member named "Capture'

So it's not that. But it recognizes some sort of CopyScreen, so I guess I'll have to use that.

Haha, I just did 5 because I wanted to have two arguments, and see what it gave me. Why do I have to supply a Rect? What is that rect, the area it is capturing?

7
General / sf::Image::CopyScreen() not in sf::Image??
« on: August 11, 2011, 04:46:01 pm »
Hi, I'm very confused. I want to take a screenshot several times in my program. I'm using SFML2, so I discovered that they don't use Capture() anymore.

From [url = http://www.sfml-dev.org/forum/viewtopic.php?p=31491&sid=99742a8c296d8c942218806680bef595]this[/url] thread, the guy said to use sf::Image::CopyScreen().  But when I go to the link for sf::Image (http://www.sfml-dev.org/documentation/2.0/classsf_1_1Image.php), it's nowhere to be seen!

So, does it still exist? Because it's not in the documentation, I don't know what arguments to supply it. When I try some silly thing just to see the output, like:

Code: [Select]
sf::Image::CopyScreen(App,5);

it says

Code: [Select]
...candidate is:
/usr/include/SFML/Graphics/Image.hpp:233:10: note: bool sf::Image::CopyScreen(sf::RenderWindow&, const IntRect&)


I'm not really sure what an IntRect is, or how I will save the screenshot to an sf::Image. It was so much easier with App.Capture, why'd they change it?

Can anyone help me?

Thanks!

8
General / How can I group shapes/lines together?
« on: December 10, 2010, 07:21:02 am »
Quote from: "heishe"
I think you can set the center of the other arrows two head lines to the middle of the other line, so they rotate around that.


This is a clever idea...I think I'll try it. Still, I don't see why there wouldn't be some sort of group option.

9
General / How can I group shapes/lines together?
« on: December 10, 2010, 07:19:41 am »
Quote from: "DeadLeaves"
Wouldn't it work to use an image? Or make a polygon?


I suppose I could be clever and make a polygon that has no lines that cross, but I made a simple arrow out of a polygon with 4 or 5 lines, and it came out pretty awful. An image might not be a bad idea, but arrows drawn with lines seemed like the natural solution because they have to be resized and rotated a lot.

10
General / How can I group shapes/lines together?
« on: December 08, 2010, 03:38:26 am »
Hey everyone!

I am trying to draw a ton of small arrows, which I then set the positions of, and rotate around the center of the arrow. Right now I'm doing it with regular lines and it's working fine, but I eventually want arrows. However, it would be a pain in the ass to rotate the two lines that make the head of the arrow around the center of the thing:




So my question is, is there any way to group the lines together so that I can manipulate them as a single, larger object?

Thanks!!

11
General discussions / Problem with sf::Color
« on: August 09, 2010, 09:16:11 pm »
Ok. I'll post it here in case anyone ever wants it, not that it's very complicated to make:

Code: [Select]

//This function converts HSL (Hue, saturation, lightness) to RGB.
//H goes from 0 to 360.
//S goes from 0 to 1.
//L goes from 0 to 1.
//The RGB values in the returned pointer go from 0 to 255.
//The returned pointer is 3 doubles long, *(ptr)=R, *(ptr+1)=G, *(ptr+2)=B.

double* HSLtoRGB(double H, double S, double L){
double * HSLptr;
try{
HSLptr = new double[3];
}
catch(bad_alloc&){
cout << endl << "Error in HSLtoRGB when allocating memory." << endl;
}
double C = 2*L*S;
double Hprime = H/60.0;
double a = Hprime - 2*floor(Hprime/2.0);
double X = C*(1-fabs(a-1));
double C_0 = C*255;
double X_0 = X*255;

if(Hprime>=0 && Hprime<1){
*(HSLptr+0) = C_0;
*(HSLptr+1) = X_0;
*(HSLptr+2) = 0;
         }
         if(Hprime>=1 && Hprime<2){
*(HSLptr+0) = X_0;
*(HSLptr+1) = C_0;
*(HSLptr+2) = 0;
         }      
         if(Hprime>=2 && Hprime<3){
*(HSLptr+0) = 0;
*(HSLptr+1) = C_0;
*(HSLptr+2) = X_0;
         }      
         if(Hprime>=3 && Hprime<4){
*(HSLptr+0) = 0;
*(HSLptr+1) = X_0;
*(HSLptr+2) = C_0;
         }      
         if(Hprime>=4 && Hprime<5){
*(HSLptr+0) = X_0;
*(HSLptr+1) = 0;
*(HSLptr+2) = C_0;
         }      
         if(Hprime>=5 && Hprime<6){
*(HSLptr+0) = C_0;
*(HSLptr+1) = 0;
*(HSLptr+2) = X_0;
         }    

return HSLptr;


} //HSLtoRGB


Hmm, the tags made my indentation a little weird.

12
General discussions / Problem with sf::Color
« on: August 09, 2010, 08:54:17 pm »
Haha, well I assumed that 0 would be completely dim, 255 would be really bright. I'm not exactly sure why I was using 500 to begin with... I only noticed because I upgraded gcc and this newer version seems to care about this, while the older one didn't.

Is there another function for defining colors? Because in my program, using HSL is a whole lot more convenient than RGB. I made a little function to switch it, but I'm just curious.

13
General discussions / Problem with sf::Color
« on: August 09, 2010, 07:46:38 pm »
Goddamnit! I took a few screenshots and in the process, found the solution, but I'm still confused. For 500, it's really bright, for 400, it's dimmer, 300, still dimmer...then 200, brighter, so I tried 255, and it's as bright as I want! But I swear I tried 255 before. GRRRR. All warnings are gone, anyway. Thanks!

14
General discussions / Problem with sf::Color
« on: August 09, 2010, 07:41:15 pm »
Haha, I believe it...but then why is it giving me a much brighter color when I set it to 500? I want it to be brighter. Let me get a couple screenshots.

15
General discussions / Problem with sf::Color
« on: August 09, 2010, 05:09:15 pm »
Hey guys. I have a black background to my app. At some point, I draw a rainbow strip at the bottom. So my code works, but it's giving me the obnoxious error of:

Code: [Select]
flowfield.cpp:476: warning: large integer implicitly truncated to unsigned type

I suspect (in fact, know) that it's because I'm doing this:

Code: [Select]
sf::Color(*gridptr,*(gridptr+1),*(gridptr+2),500)

While the fourth argument should only be going from 0-255, according to the documentation for this. But when I set it to 255, it's too dark! I can barely see it. What can I do?

Thanks!

Pages: [1] 2 3
anything