Advertisement

Text mode graphics

Started by September 04, 2000 12:56 PM
13 comments, last by furby100 24 years, 3 months ago
What I would like to know is, is there any good way to print text at any position on the console without double buffering it and then printf()ing it, and how to change the text colours, and how to make the PC''s internal beeper beep at different frequencies. ------------------------------ #pragma twice

sharewaregames.20m.com

Just use QBASIC if you want to do all that fancy text stuff. I''m not sure how you would do it in C++ though. I know an older version of Visual C++ (like 1.52) had its own DOS graphics library (graph.h i think), and it included colored text.

Sorry, that probably wasn''t much help.

Alex
Alexbigshot@austin.rr.comFoolish man give wife grand piano. Wise man give wife upright organ.
Advertisement
You can do all that in DJGPP (except possibly the beeping stuff).

Martee
Magnum Games
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
No, if you''re wondering I am converting a QBASIC game. For fun. Into VC++. I was wondering,

------------------------------
#pragma twice


sharewaregames.20m.com

The best way to do this kind of stuff would be to use TurboC++ and its conio.h libraries.
I think Borland C++ will do it as well, but personnaly I hate all those manip, and the fact that they cahnged the ASCII set of characters.

If you are interested, my first year project was a drawing program for ASCII art, and it works damn well... if you need some source. Just mail me.

youpla :-P
-----------------------------Sancte Isidore ora pro nobis !
Ok, the pointer to text vidmem is at 0xB8000h. Just get your pointer...

unsigned short *vidptr = (unsigned short *)0xB8000L;

Video memory in this mode consists of an 80x25 word array. I haven''t coded DOS for aeons now by each word is broken up as follows...

byte1 = letter colour
byte2 = ascii letter code

It might be the other way around, just try it. So when you want to write to a position on screen, just do...

void write(int x, int y, unsigned short code)
{
vidptr[y * 80 + x] = code;
}
Advertisement
Anon, this is a Win32 Console Program rather than a pure DOS one. However, I found some stuff in the Win32 API anyway, so it''s alright. It is just the beeping I can''t do. Anybody know a way to do it?

------------------------------
#pragma twice


sharewaregames.20m.com

I don''t have the docs with me here, but isn''t there a:

SysBeep(-1);

command or something that beeps the PC speaker?
This may be worthless information, but I seem to remember that way back in my console days I came across a function that had frequency in it. Something like FreqOut, or GenerateFreq. I don''t think that will help much, but who knows.

--------------------


You are not a real programmer until you end all your sentences with semicolons;

Yanroy@usa.com

Visit the ROAD Programming Website for more programming help.

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

Not sure, but I think once for beeping I used something with cout and /a.. I dunno, look into cout, I'm pretty sure it can do beeping or something

And er, maybe not. I have no idea what a console program is, but I think it worked for whatever I was doing

Edited by - Peon on September 5, 2000 7:28:15 PM
Peon

This topic is closed to new replies.

Advertisement