Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Graphic

Posted on 1999-07-19
14
Medium Priority
?
186 Views
Last Modified: 2010-05-18
How do I draw,clear dots and lines on the screen using C++?
(Pton, Ptoff?)
0
Comment
Question by:cdloves
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 7
14 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1200522
Standard C++ provides no features for doing this sort of thing.  However, many operating systems do have these sorts of features and they can be accessed through C++.  Such an approach however, is non portable.  i.e. the code you write will not work on other operating systems.   What operating system is this for?
0
 

Author Comment

by:cdloves
ID: 1200523
The operating system I have in mind is windows 95/98....Do you have any info on that?
0
 
LVL 22

Expert Comment

by:nietod
ID: 1200524
Graphics operations in Windows are quite complex--they aren't hard, but there is a lot to learn before you can get started.  There are two main approaches.  For games or programs that will "take over" the screen and that need very fast graphics, you should use DirectX.   For GUI programs, ordinary windows programs that run in ordinary windows ("windows" meaning graphicals windows, not the windows operating system) you should use the windows API functions.  

What are your needs?
What compiler are you using?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:cdloves
ID: 1200525
Well, I dont really need all those fansy graphic methods.  All I need is to be able to turn a point using X,Y coordinates on or off.  In other words, I want to draw a dot at coordinate (x,y) on the dosprompt screen. I am using VC++.  I have use the pton, ptoff in VB and Pascal as well, so I think there is a way doing it in C++ too.  Is there any built-in libraries has that function at all?
0
 
LVL 22

Expert Comment

by:nietod
ID: 1200526
>> Is there any built-in libraries
>> has that function at all?
Not standard ones.

Is this for a true DOS program?  i.e. not a win32 console program?  If so you can use the DOS video services to do this.  (Note that VC and Borland C++ builder both create win32 console programs, not DOS programs.)
0
 

Author Comment

by:cdloves
ID: 1200527
Sorry, I meant win32 console.  So do you have a way to do it?
0
 
LVL 22

Expert Comment

by:nietod
ID: 1200528
Win32 consoles don't support graphics operations at all.    You have to switch to a GUI program or back to a DOS program.   You could try to use the DOS video services from one, but I really doubt it will work.
0
 

Author Comment

by:cdloves
ID: 1200529
how do I use dos video service?
0
 
LVL 22

Expert Comment

by:nietod
ID: 1200530
First you would have to switch to graphics mode with service 0.  To go to 640X400 mode you would load AH with 0 (service number) and AL with 12h (the video mode you want.)   (There are lots of other modes, but that is very popular)  Then execute int 10h.

Then to set a pixel, use service 0Ch.  You load AH with 0Ch, AL with the pixel color you want to use.  (Standard DOS colors)  CX with the pixel's X coordinate DX with the y coordinate and BH with the page number (0).

That's about all I can tell you because I am moving a week from today and my books are all packed up.
0
 

Author Comment

by:cdloves
ID: 1200531
How do I do all those Assembly lines in C++?  By the way, I dont know much about assembly
0
 
LVL 22

Accepted Solution

by:
nietod earned 120 total points
ID: 1200532
You use _asm.  Like

_asm MOV AH,0
_asm MOV AL,12h
_asm INT 10h



0
 

Author Comment

by:cdloves
ID: 1200533
It looks like I have to read more about Assembly (I dont understand what those lines you give me do).
Thanks a lot for your patient.  After all, your answer is very excellence.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1200534
Just so you know, I'm moving Tuesday and the computer is getting packed next.  So I will be off EE for at least a week, maybe two.
0
 

Author Comment

by:cdloves
ID: 1200535
sure, if you can find any more information about my question about graphic, please let me know or email me at cdloves@email.com. Thanks

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question