Drawing

Hello. I only really program in Game Maker and I am trying to learn C++. I know all that stuff of if, else, for, etc. However, Game Maker has an easy languague. To draw a sprite you would need to write draw_sprite(sprite number, image number, x, y). I know C++ has a different way to draw things. Pixels, lines, circles, images and stuff. I just dont know how.

Can you tell me how? I want to know how to draw a simple line in a form. Can you help me? Thanks.

By the way, www.yoyogames.com/make Game Maker 7.0 home :)
You want to draw a line which changes its position?
If yes,I t can't be really done in windows forms
If not,you can make a bmp file with the line and the background color of the form background and put it in your form,I don't know anything better
Last edited on
C++ itself doesn't have anything for graphics in the standard library. You need to get yourself a graphics library. Allegro has the functions you need to draw lines, but I find it uncomfortable to use. SDL is great to use for sprites. Loading images and other stuff from disk is very easy, but it doesn't have (that I know) functions to draw lines or circles (although you can draw orthogonal lines with a less than practical method). so you'd need to write the functions yourself.
Wikipedia has articles describing methods to draw lines and circles with and without anti-aliasing.
http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
http://en.wikipedia.org/wiki/Xiaolin_Wu%27s_line_algorithm
Topic archived. No new replies allowed.