Click here to Skip to main content
15,921,203 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Simplest way to start a MFC program from a MFC program Pin
Member 28839418-Nov-11 23:18
Member 28839418-Nov-11 23:18 
QuestionHow to inhibit parent window from blocking when using CSocket/CTimeoutSocket Pin
Member 28839418-Nov-11 20:53
Member 28839418-Nov-11 20:53 
AnswerRe: How to inhibit parent window from blocking when using CSocket/CTimeoutSocket Pin
Code-o-mat20-Nov-11 2:23
Code-o-mat20-Nov-11 2:23 
QuestionReverse Triangle Star Pin
AREYASB18-Nov-11 17:21
AREYASB18-Nov-11 17:21 
AnswerRe: Reverse Triangle Star Pin
Rajesh R Subramanian18-Nov-11 17:51
professionalRajesh R Subramanian18-Nov-11 17:51 
QuestionRe: Reverse Triangle Star Pin
David Crow19-Nov-11 15:46
David Crow19-Nov-11 15:46 
AnswerRe: Reverse Triangle Star Pin
AREYASB19-Nov-11 21:28
AREYASB19-Nov-11 21:28 
GeneralRe: Reverse Triangle Star Pin
enhzflep20-Nov-11 1:57
enhzflep20-Nov-11 1:57 
:smacks-head: Of course, why didn't I understand that when I first saw your initial post? Laugh | :laugh: Poke tongue | ;-P

Well, judging from your images, they're simply 10x10 blocks, with (the right-hand) 1/2 filled with characters. If you were to assume the windows co-ord system (the one your using when outputting to the console), where by (0,0) is at the top left of the screen, with (width-1, height-1) being at the bottom right you could view the problem like so:

Image 1: draw line from (0,0) to (9,9) - fill in any pixels to the right of this line up to X=9
Image 2: draw line from (9,0) to (0,0) - fill in any pixels to the right of this line up to X=9

You need to animate between the two.

---

(1) Since the block is 10 stars wide, you'll need 10 frames
(2) The middle frame would be - draw line from (4,0) to (4,9) - a vertical line.

Hmm perhaps we could run a 10 iter loop -
iterNum = 0 .. 9
    x1 = iterNum
    y1 = 0
    x2 = 9-iterNum
    y2 = 9
    FillBetweenAndToRightOf(x1,y2, x2,y2)
endLoop



You'll obviously have to come up with the FillBetweenAndToRightOf function yourself.

Your above tricks won't work when it comes to determining how many spaces to print before you start printing * characters, this time you'll need to calculate the gradient of the line
Recall that gradient = rise/run.
For img1, your X pos varies by 10(from 0-9), as the Y pos changes by 10(from 0-9). Therefore the gradient is 10/10 = 1.

You can then multiply the gradient by the Y pos, add this to X1 to find the first * character on the line. E.g row 4 (0 based) 4*1 + 0 = 4.

For img2, your X pos varies by -10 as the Y pos changes by 10. This time the gradient is -10/10 = -1
E.g row 4 (0 based) 4*-1 + 9 = 5.


Simply draw the figure 10 times with changing values of x1 and x2, using the above formulas to calculate where to start and how many stars to draw on each line.
GeneralRe: Reverse Triangle Star Pin
AREYASB20-Nov-11 21:51
AREYASB20-Nov-11 21:51 
QuestionRe: Reverse Triangle Star Pin
David Crow20-Nov-11 17:14
David Crow20-Nov-11 17:14 
AnswerRe: Reverse Triangle Star Pin
AREYASB20-Nov-11 21:48
AREYASB20-Nov-11 21:48 
QuestionRe: Reverse Triangle Star Pin
David Crow21-Nov-11 4:13
David Crow21-Nov-11 4:13 
QuestionStar Shear Pin
AREYASB18-Nov-11 15:58
AREYASB18-Nov-11 15:58 
QuestionRe: Star Shear Pin
David Crow1-Dec-11 7:43
David Crow1-Dec-11 7:43 
QuestionUnderstanding wndproc, callbacks and threads, win32 c++ Pin
jkirkerx18-Nov-11 6:47
professionaljkirkerx18-Nov-11 6:47 
AnswerRe: Understanding wndproc, callbacks and threads, win32 c++ Pin
David Crow18-Nov-11 7:05
David Crow18-Nov-11 7:05 
GeneralRe: Understanding wndproc, callbacks and threads, win32 c++ Pin
jkirkerx18-Nov-11 7:47
professionaljkirkerx18-Nov-11 7:47 
AnswerRe: Understanding wndproc, callbacks and threads, win32 c++ Pin
Chuck O'Toole18-Nov-11 7:46
Chuck O'Toole18-Nov-11 7:46 
GeneralRe: Understanding wndproc, callbacks and threads, win32 c++ Pin
jkirkerx18-Nov-11 8:04
professionaljkirkerx18-Nov-11 8:04 
AnswerRe: Understanding wndproc, callbacks and threads, win32 c++ Pin
Chuck O'Toole18-Nov-11 10:01
Chuck O'Toole18-Nov-11 10:01 
GeneralRe: Understanding wndproc, callbacks and threads, win32 c++ Pin
enhzflep18-Nov-11 15:27
enhzflep18-Nov-11 15:27 
GeneralRe: Understanding wndproc, callbacks and threads, win32 c++ Pin
Richard MacCutchan18-Nov-11 21:57
mveRichard MacCutchan18-Nov-11 21:57 
AnswerRe: Understanding wndproc, callbacks and threads, win32 c++ Pin
Erudite_Eric18-Nov-11 21:55
Erudite_Eric18-Nov-11 21:55 
GeneralRe: Understanding wndproc, callbacks and threads, win32 c++ Pin
jkirkerx19-Nov-11 7:27
professionaljkirkerx19-Nov-11 7:27 
GeneralRe: Understanding wndproc, callbacks and threads, win32 c++ Pin
Erudite_Eric20-Nov-11 2:10
Erudite_Eric20-Nov-11 2:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.