mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-28 14:17:02 -06:00
.upptst
git-svn-id: svn://ultimatepp.org/upp/trunk@6245 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
a373fc16a4
commit
e98e15dc02
2 changed files with 53 additions and 12 deletions
|
|
@ -25,13 +25,15 @@ struct ColorRenderer : DDARasterizer {
|
|||
struct MyApp : TopWindow {
|
||||
Point p;
|
||||
int width;
|
||||
bool type;
|
||||
|
||||
virtual void Paint(Draw& w);
|
||||
virtual void MouseMove(Point p, dword keyflags);
|
||||
virtual void LeftDown(Point p, dword keyflags);
|
||||
virtual void MouseWheel(Point p, int zdelta, dword keyflags);
|
||||
virtual Image CursorImage(Point p, dword keyflags);
|
||||
|
||||
MyApp() { width = 20; p = Point(0, 0); Sizeable().Zoomable(); }
|
||||
MyApp() { width = 20; p = Point(0, 0); Sizeable().Zoomable(); type = false; }
|
||||
};
|
||||
|
||||
Image MyApp::CursorImage(Point p, dword keyflags)
|
||||
|
|
@ -52,13 +54,32 @@ void MyApp::MouseWheel(Point p, int zdelta, dword keyflags)
|
|||
Refresh();
|
||||
}
|
||||
|
||||
void MyApp::LeftDown(Point p, dword keyflags)
|
||||
{
|
||||
type = !type;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void FatLine(DDARasterizer& r, Point p1, Point p2, int width)
|
||||
{
|
||||
Point v = p2 - p1;
|
||||
Point shift = (width - 0.5) * Orthogonal(Pointf(v) / Length((Pointf(v))));
|
||||
Point p = p1 + shift / 2;
|
||||
r.Move(p);
|
||||
r.Line(p += v);
|
||||
r.Line(p -= shift);
|
||||
r.Line(p - v);
|
||||
r.Close();
|
||||
}
|
||||
|
||||
void MyApp::Paint(Draw& w)
|
||||
{
|
||||
Size sz = GetSize();
|
||||
|
||||
w.DrawRect(GetSize(), Gray());
|
||||
|
||||
Point p0(10, 10);
|
||||
Point p0(200, 200);
|
||||
|
||||
Vector< Vector<Point> > pgs;
|
||||
|
||||
|
|
@ -75,25 +96,47 @@ void MyApp::Paint(Draw& w)
|
|||
r.Line(Point(700, 400));
|
||||
r.Fill();
|
||||
*/
|
||||
#if 1
|
||||
w.DrawRect(p.x, p.y, 1, 1, White());
|
||||
// w.DrawRect(p.x, p.y, 1, 1, White());
|
||||
#if 0
|
||||
r.color = LtRed();
|
||||
r.Width(width);
|
||||
r.Move(Point(50, 200));
|
||||
r.Move(p0);
|
||||
r.Line(p);
|
||||
r.color = LtBlue();
|
||||
// r.Move(p);
|
||||
r.Line(Point(sz.cx / 2, 300));
|
||||
// r.color = LtGreen();
|
||||
r.color = LtGreen();
|
||||
r.Close();
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
r.Width(width);
|
||||
r.Ellipse(Rect(10, 10, p.x, p.y));
|
||||
#endif
|
||||
|
||||
r.color = Black();
|
||||
/*
|
||||
if(type) {
|
||||
r.Width(width);
|
||||
r.Move(p0);
|
||||
r.Line(p);
|
||||
}
|
||||
else*/
|
||||
#if 0
|
||||
if(type)
|
||||
r.Polygon();
|
||||
FatLine(r, p0, p, width);
|
||||
if(type)
|
||||
r.Fill();
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
r.color = LtRed();
|
||||
r.Width(2);
|
||||
r.Move(Point(800, 100));
|
||||
r.Line(Point(800, 200));
|
||||
|
||||
w.DrawRect(p0.x, p0.y, 1, 1, White());
|
||||
#endif
|
||||
|
||||
// w.DrawRect(p0.x, p0.y, 1, 1, White());
|
||||
w.DrawRect(700, 400, 1, 1, White());
|
||||
|
||||
r.color = LtBlue();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
using namespace Upp;
|
||||
|
||||
void Test(const char *text, const char *fmt)
|
||||
void Test(const char *text)
|
||||
{
|
||||
Time tm;
|
||||
const char *q = StrToTime(tm, text);
|
||||
|
|
@ -21,7 +21,5 @@ CONSOLE_APP_MAIN
|
|||
Test("15.12.2005 12 foo!");
|
||||
Test("15.12.2005 foo!");
|
||||
Test("uck!");
|
||||
|
||||
ASSERT(
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue