pen and math tests completed
This commit is contained in:
parent
e59b5cada4
commit
9d6e8db0cf
19
photon.mm
19
photon.mm
@ -40,29 +40,22 @@
|
|||||||
<icon BUILTIN="button_ok"/>
|
<icon BUILTIN="button_ok"/>
|
||||||
</node>
|
</node>
|
||||||
<node ID="Freemind_Link_1283736172" TEXT="Math Test">
|
<node ID="Freemind_Link_1283736172" TEXT="Math Test">
|
||||||
<node COLOR="#000000" ID="Freemind_Link_876352622" TEXT="General Math">
|
|
||||||
<icon BUILTIN="button_ok"/>
|
<icon BUILTIN="button_ok"/>
|
||||||
</node>
|
</node>
|
||||||
<node COLOR="#000000" ID="Freemind_Link_171161365" TEXT="Circle">
|
<node ID="Freemind_Link_279976301" TEXT="Pen">
|
||||||
<icon BUILTIN="button_ok"/>
|
<icon BUILTIN="button_ok"/>
|
||||||
</node>
|
</node>
|
||||||
<node COLOR="#000000" ID="Freemind_Link_1333080570" TEXT="Rect">
|
|
||||||
<icon BUILTIN="button_ok"/>
|
|
||||||
</node>
|
|
||||||
<node COLOR="#000000" ID="Freemind_Link_63576276" TEXT="Vector2"/>
|
|
||||||
</node>
|
|
||||||
<node ID="Freemind_Link_279976301" TEXT="Pen"/>
|
|
||||||
<node ID="Freemind_Link_609153459" TEXT="Image">
|
<node ID="Freemind_Link_609153459" TEXT="Image">
|
||||||
<icon BUILTIN="button_ok"/>
|
<icon BUILTIN="button_ok"/>
|
||||||
</node>
|
</node>
|
||||||
<node ID="Freemind_Link_1961072093" TEXT="Font">
|
<node ID="Freemind_Link_1961072093" TEXT="Font">
|
||||||
<icon BUILTIN="button_ok"/>
|
<icon BUILTIN="button_ok"/>
|
||||||
</node>
|
</node>
|
||||||
|
<node COLOR="#000000" ID="Freemind_Link_964892891" TEXT="Input"/>
|
||||||
<node ID="Freemind_Link_25725154" TEXT="Audio">
|
<node ID="Freemind_Link_25725154" TEXT="Audio">
|
||||||
<node COLOR="#000000" ID="Freemind_Link_1981834308" TEXT="integrate playing of >1 sample"/>
|
<node COLOR="#000000" ID="Freemind_Link_1981834308" TEXT="integrate playing of >1 sample"/>
|
||||||
<node COLOR="#000000" ID="Freemind_Link_212747291" TEXT="allow control via mouse or keyboard"/>
|
<node COLOR="#000000" ID="Freemind_Link_212747291" TEXT="allow control via keyboard"/>
|
||||||
</node>
|
</node>
|
||||||
<node COLOR="#000000" ID="Freemind_Link_964892891" TEXT="Input"/>
|
|
||||||
<node ID="Freemind_Link_1348104879" TEXT="Kernel/AppCore">
|
<node ID="Freemind_Link_1348104879" TEXT="Kernel/AppCore">
|
||||||
<node ID="Freemind_Link_1664207862" TEXT="how to test?"/>
|
<node ID="Freemind_Link_1664207862" TEXT="how to test?"/>
|
||||||
</node>
|
</node>
|
||||||
@ -77,7 +70,8 @@
|
|||||||
<node ID="Freemind_Link_363257674" TEXT="contact info"/>
|
<node ID="Freemind_Link_363257674" TEXT="contact info"/>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
<node FOLDED="true" ID="Freemind_Link_486829238" POSITION="right" TEXT="0.2 Release">
|
<node ID="Freemind_Link_486829238" POSITION="right" TEXT="0.2 Release">
|
||||||
|
<node ID="Freemind_Link_1298931281" TEXT="XML resource files"/>
|
||||||
<node ID="Freemind_Link_216021234" TEXT="Sprite System">
|
<node ID="Freemind_Link_216021234" TEXT="Sprite System">
|
||||||
<font NAME="SansSerif" SIZE="12"/>
|
<font NAME="SansSerif" SIZE="12"/>
|
||||||
</node>
|
</node>
|
||||||
@ -90,7 +84,6 @@
|
|||||||
<node COLOR="#000000" ID="Freemind_Link_420721466" TEXT="XML/XSLT sink">
|
<node COLOR="#000000" ID="Freemind_Link_420721466" TEXT="XML/XSLT sink">
|
||||||
<icon BUILTIN="help"/>
|
<icon BUILTIN="help"/>
|
||||||
</node>
|
</node>
|
||||||
<node ID="Freemind_Link_1298931281" TEXT="XML resource files"/>
|
|
||||||
</node>
|
</node>
|
||||||
<node ID="Freemind_Link_351891371" POSITION="left" TEXT="General Mateinance">
|
<node ID="Freemind_Link_351891371" POSITION="left" TEXT="General Mateinance">
|
||||||
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
|
<font BOLD="true" NAME="SansSerif" SIZE="12"/>
|
||||||
@ -103,7 +96,7 @@
|
|||||||
<node ID="Freemind_Link_1080393911" TEXT="audio:: could using some cleaning"/>
|
<node ID="Freemind_Link_1080393911" TEXT="audio:: could using some cleaning"/>
|
||||||
<node ID="Freemind_Link_632977685" TEXT="make compilation succeed without OpenAL"/>
|
<node ID="Freemind_Link_632977685" TEXT="make compilation succeed without OpenAL"/>
|
||||||
</node>
|
</node>
|
||||||
<node COLOR="#147f1e" ID="Freemind_Link_438641521" POSITION="left" TEXT="Version: $Id: photon.mm,v 1.15 2005/07/06 13:28:34 cozman Exp $">
|
<node COLOR="#147f1e" ID="Freemind_Link_438641521" POSITION="left" TEXT="Version: $Id: photon.mm,v 1.16 2005/07/17 05:38:44 cozman Exp $">
|
||||||
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
<font ITALIC="true" NAME="SansSerif" SIZE="12"/>
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// James Turk (jpt2433@rit.edu)
|
// James Turk (jpt2433@rit.edu)
|
||||||
//
|
//
|
||||||
// Version:
|
// Version:
|
||||||
// $Id: Vector2.cpp,v 1.2 2005/07/06 04:27:23 cozman Exp $
|
// $Id: Vector2.cpp,v 1.3 2005/07/17 05:38:44 cozman Exp $
|
||||||
|
|
||||||
#include "math/Vector2.hpp"
|
#include "math/Vector2.hpp"
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ void Vector2::set(scalar nx, scalar ny)
|
|||||||
|
|
||||||
void Vector2::resolveDeg(scalar magnitude, scalar angle)
|
void Vector2::resolveDeg(scalar magnitude, scalar angle)
|
||||||
{
|
{
|
||||||
angle = degToRad(clamp(angle,0,360));
|
angle = degToRad(angle);
|
||||||
x = magnitude*std::cos(angle);
|
x = magnitude*std::cos(angle);
|
||||||
y = magnitude*-std::sin(angle);
|
y = magnitude*-std::sin(angle);
|
||||||
}
|
}
|
||||||
|
109
test/Pen_test.cpp
Normal file
109
test/Pen_test.cpp
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
//This file is part of Photon (http://photon.sourceforge.net)
|
||||||
|
//Copyright (C) 2004-2005 James Turk
|
||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// James Turk (jpt2433@rit.edu)
|
||||||
|
//
|
||||||
|
// Version:
|
||||||
|
// $Id: Pen_test.cpp,v 1.1 2005/07/17 05:38:44 cozman Exp $
|
||||||
|
|
||||||
|
#include "photon.hpp"
|
||||||
|
using namespace photon;
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
class MainTask : public Task
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
MainTask() :
|
||||||
|
Task("MainTask"),
|
||||||
|
app(AppCore::getInstance()),
|
||||||
|
video(video::VideoCore::getInstance())
|
||||||
|
{
|
||||||
|
LogSinkPtr csp( new ConsoleSink("console") );
|
||||||
|
log.addSink(csp);
|
||||||
|
|
||||||
|
video.setOrthoView(800,600);
|
||||||
|
|
||||||
|
r.setColor(255, 0, 0);
|
||||||
|
g.setColor(0, 255, 0);
|
||||||
|
b.setColor(0, 0, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
void update()
|
||||||
|
{
|
||||||
|
static double t=0;
|
||||||
|
static const math::Point2 center(400, 300);
|
||||||
|
|
||||||
|
if(app.getTime() - t > 1.0)
|
||||||
|
{
|
||||||
|
app.setTitle("FPS: " +
|
||||||
|
boost::lexical_cast<std::string>(app.getFramerate()) );
|
||||||
|
t = app.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
video.clear();
|
||||||
|
|
||||||
|
unsigned int i,j; //used throughout demo
|
||||||
|
|
||||||
|
// points
|
||||||
|
for(i=0; i < 400; ++i)
|
||||||
|
{
|
||||||
|
r.drawPoint(math::Point2(i, 2*i));
|
||||||
|
g.drawPoint(math::Point2(i, 3*i));
|
||||||
|
b.drawPoint(math::Point2(i, 4*i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// lines
|
||||||
|
for(i=100; i <= 200; i += 10)
|
||||||
|
{
|
||||||
|
for(j=100; j <= 200; j += 10)
|
||||||
|
{
|
||||||
|
g.drawLine(math::Point2(100,i), math::Point2(j, 200));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// circles
|
||||||
|
b.fillCircle(math::Circle(center, 60));
|
||||||
|
g.drawCircle(math::Circle(center, 60));
|
||||||
|
g.drawCircle(math::Circle(center, 50));
|
||||||
|
|
||||||
|
// vectors
|
||||||
|
math::Vector2 clockHand;
|
||||||
|
clockHand.resolveDeg(50, 20*app.getTime());
|
||||||
|
r.drawVector(center, clockHand);
|
||||||
|
|
||||||
|
// rectangles
|
||||||
|
math::Rect rect1(math::Point2(500, 300), 200, 100);
|
||||||
|
math::Rect rect2(math::Point2(550, 375), 100, 200);
|
||||||
|
r.drawRectangle(rect1);
|
||||||
|
b.drawRectangle(rect2);
|
||||||
|
g.fillRectangle(rect1.calcIntersection(rect2));
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
video::Pen r,g,b;
|
||||||
|
|
||||||
|
|
||||||
|
Log log;
|
||||||
|
AppCore& app;
|
||||||
|
video::VideoCore& video;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FontTest : public Application
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
int main(const StrVec& args)
|
||||||
|
{
|
||||||
|
AppCore::getInstance().createDisplay(800,600,32,0,0,false);
|
||||||
|
|
||||||
|
Kernel::getInstance().addTask(TaskPtr(new MainTask()));
|
||||||
|
|
||||||
|
Kernel::getInstance().run();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ENTRYPOINT(FontTest)
|
Loading…
Reference in New Issue
Block a user