Can anyone tell me way where I can get/put a single char at any x/y on the screen?
Can anyone tell me way where I can get/put a single char at any x/y on the screen?
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
Isn't this in the faq ?
Actually, it's not...and yes, I am trying to look it up, but since i am at work, I can't just sit here and do research... More specifically, I know how to gotoxy. But then how might I "grab" the char at that position, and further, how to "place" a char at that position (hopefully, without using printf() et al...)? I do realize there are differences between each OS's implementation, and both examples are welcome.
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
Well for DOS with a conio.h, you have
#include <conio.h>
int gettext(int _left, int _top, int _right, int _bottom, void *_dest);
int puttext(int _left, int _top, int _right, int _bottom, void *_source);
When you allocate memory for this, remember each on-screen char has an attribute byte as well
You might get some portability by using say ncurses package, but you'd need to check whether it has a 'get' function for on-screen text.
Thank you for the tip. I am going to create a multithreaded "windowing" sytem for the console, and will be using these functions in a layer below the "text-positioning-calculation" engine that will be running the show... Could I use the two functions you listed in unix? Or are you saying I will need to do that in ncurses? Either way, I would be placing these function calls in generic wrappers that would allow portability.
And what is meant by "an attribute byte"? Where/how to access it?
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
> Could I use the two functions you listed in unix?
No - you need ncurses for this
> And what is meant by "an attribute byte"?
In DOS text mode, the attribute byte contains the colour/flash state of each char
ok, well thanks again Salem. Have a good day!
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }