its this a gui program or a full-screen program? |
It is definitely a gui program.
also, is there any chance you are looking at the dimensions of a window or drawing surface, and not the screen itself? Make sure you care calling the right versions of the right functions as the stuff to get dimenions of the screen vs a 'surface' etc are similar looking. |
The way I tested it was by following the instructions from a previous chapter in which Stroustrup draws a bit of text on the screen.
1 2 3 4 5 6 7 8
|
Point tl(150, 150);
Simple_window win(tl, 800, 600, "test");
ostringstream oss;
oss << "screen size: " << x_max() << '*' << y_max() << ' '
<< "window size: " << win.x_max() << '*' << win.y_max();
Text sizes{ Point{150,150},oss.str() };
sizes.set_color(Color::black);
win.attach(sizes);
|
For the window, the size is correct (800x600), or at least, it returns the parameters that I gave it, but as I mentioned, it tells me that my screen resolution is 1280x680.
According to the book, x_max() is supposed to be screen width, but if it doesn't actually return screen width, I guess I wouldn't know.
I now suspect that it returns Fl::w() which is supposed to return the "... width in pixels of the main screen work area.", which I understand as being the width of the screen.
The program I was trying to build have you create a randomly moving button.
I've set the parameters to keep it inside the 800x600 area and it does return points in that range, but the button is still frequently being placed outside the window.
Also, whenever I've tried to create a fullscreen window(1920x1080), it appears to be much larger than the screen.
Where did you get your copy of the FLTK library? What version is it?
If you downloaded it from Stroustrup's website the version is very outdated. 1.1.9.
The current stable release is 1.3.5, available at https://www.fltk.org/ |
a last thought: any chance you have a dated library that can't understand higher res? |
I recently updated to the 2019 version (from 2017) of Visual Studio at which point I also updated from fltk-1.3.4-2 to fltk-1.3.5.
I did so using the method described in this(
https://bumpyroadtocode.com/2017/08/29/how-to-install-and-use-fltk-1-3-4-in-visual-studio-2017-complete-guide-2-0-no-cross-contamination/) guide which I also used the first time I installed fltk.
I should mention, that I had the same problem with both versions. Solving it was my primary incentive for the update.
Maybe, but the way I was using it was to get two integers.
How would I use Fl::screen_xywh to test/print my screen resolution?
By the way, I tried to use Fl::w() and Fl::h() which returns the same resolution, so I guess that x_max() simple returns Fl::w().
Sorry if you are past these beginner questions, but we have to start somewhere. I can't open 3rd party files at work. |
No need to apologize, I would definitely still consider myself to be a beginner and a lot of the troubles I've run into during the learning process have, in hindsight, been glaringly obvious.