コード例 #1
0
ファイル: TEncoder.cpp プロジェクト: x414e54/nano
static const NString kKeyDictionary									= "Test Dictionary";
static const NString kKeyPoint										= "Test Point";
static const NString kKeySize										= "Test Size";
static const NString kKeyRectangle									= "Test Rectangle";


// Values
static const bool       kValueBoolean1								= true;
static const bool       kValueBoolean2								= false;
static const NNumber    kValueNumber1								=  1234LL;
static const NNumber    kValueNumber2								= -5678LL;
static const NNumber    kValueNumber3								=  1234.12f;
static const NNumber    kValueNumber4								= -5678.5678765000102;
static const NString    kValueString								= "This \" is & a ' test < text > string";
static const UInt8      kValueData[]								= { 0xAA, 0xBB, 0xCC, 0xDD };
static const NPoint		kValuePoint									= NPoint(10, 20);
static const NSize		kValueSize									= NSize(30, 40);
static const NRectangle kValueRectangle								= NRectangle(10, 20, 30, 40);


// Results
static const UInt32  kResultBinary									= 0x0F48C7C8;
static const NString kResultXML										=	"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
																		"<encoder version=\"1.0\">\n"
																		"	<object class=\"TEncodable\" key=\"root\">\n"
																		"		<bool key=\"Test Boolean 1\">true</bool>\n"
																		"		<bool key=\"Test Boolean 2\">false</bool>\n"
																		"		<number key=\"Test Number 1\">1234</number>\n"
																		"		<number key=\"Test Number 2\">-5678</number>\n"
																		"		<number key=\"Test Number 3\">1234.12</number>\n"
																		"		<number key=\"Test Number 4\">-5678.5678765000102</number>\n"
コード例 #2
0
ファイル: brushstroke.cpp プロジェクト: snori/ntk
void
SequentialBrushStroke::mouse_moved(const NPoint& point, uint buttons)
{
	if(painting())
	{
		struct func {
			static coord abs(coord val) {return val < 0 ? -val : val;}
			static coord sgn(coord val) {return val < 0 ?   -1 :   1;}
		};

		coord x1 = m_prev_point.x, y1 = m_prev_point.y;
		coord x2 = point.x,        y2 = point.y;

		coord dx = func::abs(x2 - x1);
		coord dy = func::abs(y2 - y1);
		coord sx = func::sgn(x2 - x1);
		coord sy = func::sgn(y2 - y1);

		coord x = x1;
		coord y = y1;
		if(dx >= dy)
		{
			coord d = -dx;

			for(int i=0; i<=dx; ++i)
			{
				paint(NPoint(x, y));

				x += sx;
				d += dy * 2;

				if(d >= 0)
				{
					y += sy;
					d -= dx * 2;
				}
			}
		}
		else
		{
			coord d = -dy;

			for(int i=0; i<=dy; ++i)
			{
				paint(NPoint(x, y));

				y += sy;
				d += dx * 2;

				if(d >= 0)
				{
					x += sx;
					d -= dy * 2;
				}
			}
		}

		m_prev_point = point;
	}

	BrushStroke::mouse_moved(point, buttons);
}
コード例 #3
0
ファイル: windoweventkey.cpp プロジェクト: iso9660/linux-sdk
NPoint WindowEventKey::Position()
{
	return NPoint(keyEvent->x, keyEvent->y);
}
コード例 #4
0
ファイル: windoweventkey.cpp プロジェクト: iso9660/linux-sdk
NPoint WindowEventKey::PositionRoot()
{
	return NPoint(keyEvent->x_root, keyEvent->y_root);
}
コード例 #5
0
ファイル: npoint.cpp プロジェクト: iso9660/linux-sdk
NPoint NPoint::operator -(const NPoint &p)
{
	return NPoint(x - p.x, y - p.y);
}
コード例 #6
0
ファイル: TPoint.cpp プロジェクト: refnum/nano
*/
//============================================================================
//		Include files
//----------------------------------------------------------------------------
#include "NMathUtilities.h"
#include "NTestFixture.h"
#include "NPoint.h"





//============================================================================
//		Internal constants
//----------------------------------------------------------------------------
static const NPoint kTestPoint1										= NPoint(1.0f, -1.0f);

static const NPoint kTestPoint2										= NPoint(1.3f, 1.9f);
static const NPoint kTestPoint2_Integral							= NPoint(1.0f, 2.0f);
static const NPoint kTestPoint2_Offset								= NPoint(5.3f, 5.9f);





//============================================================================
//		Test fixture
//----------------------------------------------------------------------------
#define TEST_NPOINT(...)											TEST_NANO(TPoint, ##__VA_ARGS__)

FIXTURE_NANO(TPoint)
コード例 #7
0
ファイル: npoint.cpp プロジェクト: iso9660/linux-sdk
NPoint NPoint::operator +(const NPoint &p)
{
	return NPoint(x + p.x, y + p.y);
}
コード例 #8
0
ファイル: NPoint.hpp プロジェクト: martin-au/NXtpandedLib
	static NPoint ZERO() {return NPoint(0, 0);}
コード例 #9
0
ファイル: NPoint.hpp プロジェクト: martin-au/NXtpandedLib
const NPoint operator-(NPoint p1, NPoint p2) {
	return NPoint(p1.x() - p2.x(), p2.y() - p2.y());
}
コード例 #10
0
ファイル: nrectangle.cpp プロジェクト: iso9660/linux-sdk
NPoint NRectangle::GetPosition()
{
	return NPoint(x, y);
}
コード例 #11
0
ファイル: TDictionary.cpp プロジェクト: x414e54/nano
	__________________________________________________________________________
*/
//============================================================================
//		Include files
//----------------------------------------------------------------------------
#include "NTestFixture.h"
#include "NDictionary.h"





//============================================================================
//		Internal constants
//----------------------------------------------------------------------------
static const NPoint kTestPoint										= NPoint(10.0f, 10.0f);
static const SInt32 kTestSInt32										=  2000;
static const SInt64 kTestSInt64										= -4000;





//============================================================================
//		Test fixture
//----------------------------------------------------------------------------
#define TEST_NDICTIONARY(...)										TEST_NANO(TDictionary, ##__VA_ARGS__)

FIXTURE_NANO(TDictionary)
{
	NDictionary		theDict, theDict2;