Simple lines problem

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
Psychoman
Posts: 36
Joined: June 13th, 2013, 2:12 pm

Simple lines problem

Post by Psychoman » June 16th, 2013, 6:21 pm

Hello guys ,sorry for troubling you.I think it's a silly problem ,but I can't figure it out.The thing is that I created a letter ,it's 'R' in my code,I only done 9 lesson ,so I don't know any functions that I can use to draw lines directly , so I used good old PutPixel.And then ,where the problem starts,the last segment of letter 'R' (the one that must be drawn diagonally) doesn't get thicker.What I mean, I used 4 lines to create 1 segment of letter.And the last segment draw only 1 line for a segment ,not 4.Thank you ppl for answers.

Code: Select all

void Game::Alphabet()
{
           //Position of the letter
	int charX = 200; int charY = 450;
           //1 segment
	for(int k = -2;k<2;k++)
	{
		for(int i = charX;i<charX+30;i++)
		{
			gfx.PutPixel(i,charY+k,0,0,0);
		}
	}
           //2 segment
	for(int k = -2;k<2;k++)
	{
		for(int i = charY;i<charY+40;i++)
		{
			gfx.PutPixel(charX+k,i,0,0,0);
		}
	}
          //3 segment
	for(int k = -2;k<2;k++)
	{
		for(int i = charX;i<charX+30;i++)
		{
			gfx.PutPixel(i,charY+20+k,0,0,0);
		}
	}
           //4 segment
	for(int k = -2;k<2;k++)
	{

		for(int i = charY;i<charY+20;i++)
		{
			gfx.PutPixel(charX+30+k,i,0,0,0);
		}
	}
	//5 segment
	for(int k = -2;k<2;k++)
	{
		charX = 230+k;charY = 470+k;
		for(int i = 0;i<15;i++)
		{
			gfx.PutPixel(charX,charY,0,0,0);
			charX++;
			charY++;
		
	    }
	}

User avatar
viruskiller
Posts: 399
Joined: June 14th, 2012, 5:07 pm

Re: Simple lines problem

Post by viruskiller » June 16th, 2013, 7:36 pm

charX = 230+k;charY = 470+k;

read this till u realize what's wrong:P

try imagine what were char x and char y cords before and after this line.

Psychoman
Posts: 36
Joined: June 13th, 2013, 2:12 pm

Re: Simple lines problem

Post by Psychoman » June 17th, 2013, 7:29 am

Yep, I got, .hit happens.Thanks :D

Post Reply