April 27, 2024, 06:04:17 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


(Very) simple drawing app

Started by Parker, December 11, 2005, 03:25:15 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

Parker

Draw with the mouse. It just demonstrates using OnMouseMove and LineTo, pretty much. But it's my first windows app with AuroraÂÃ,  :D

class DrawApp : window
{
declare OnMouseMove(int x, int y, int flags),int;
declare OnClose(),int;
declare OnCreate(),int;
POINT p;
}

global sub main()
{
DrawApp drw;
drw.Create(0, 0, 500, 500, AWS_CAPTION|AWS_VISIBLE|AWS_BORDER|AWS_SYSMENU|AWS_AUTODRAW, 0, "Drawing app", null);
do { wait(); } until drw.m_hWnd = 0;
return;
}

DrawApp::OnMouseMove(int x, int y, int flags)
{
Move(p.x, p.y);
if (flags = 1) LineTo(x, y);
p.x = x; p.y = y;
return window!!OnMouseMove(x, y, flags);
}

DrawApp::OnClose()
{
Destroy();
return true;
}

DrawApp::OnCreate()
{
CenterWindow();
return true;
}

Doc

Simple but cool and it works as advertised!  8) 8) 8)

Thanks for sharing.

-Doc-