Răsfoiți Sursa

Delete a bunch of outdated samples

Daniele Bartolini 12 ani în urmă
părinte
comite
3162db0e39

+ 0 - 3
samples/CMakeLists.txt

@@ -5,8 +5,5 @@ project(crown-samples)
 link_directories(${CROWN_BINARY_DIR})
 link_directories(${CROWN_BINARY_DIR})
 
 
 add_subdirectory(terrain)
 add_subdirectory(terrain)
-#add_subdirectory(texturing)
-#add_subdirectory(textrenderer)
-#add_subdirectory(collision)
 add_subdirectory(json)
 add_subdirectory(json)
 add_subdirectory(lua)
 add_subdirectory(lua)

+ 0 - 332
samples/collision/collision.cpp

@@ -1,332 +0,0 @@
-#include "Crown.h"
-#include <cstdlib>
-#include <GL/glu.h>
-
-using namespace Crown;
-
-class WndCtrl: public KeyboardListener
-{
-public:
-
-	WndCtrl()
-	{
-		GetDevice()->GetInputManager()->RegisterKeyboardListener(this);
-	}
-
-	virtual void KeyReleased(const KeyboardEvent& event)
-	{
-		if (event.key == KC_ESCAPE)
-		{
-			GetDevice()->StopRunning();
-		}
-	}
-};
-
-class MainScene: public MouseListener//, public KeyboardListener
-{
-
-public:
-
-	MainScene()
-	{
-		GetDevice()->GetInputManager()->RegisterMouseListener(this);
-		//GetDevice()->GetInputManager()->RegisterKeyboardListener(this);
-
-		sphereCount = 0;
-	}
-
-	virtual ~MainScene()
-	{
-		if (quadric)
-			gluDeleteQuadric(quadric);
-	}
-
-	virtual void ButtonPressed(const MouseEvent& event)
-	{
-		if (event.button == MB_LEFT)
-		{
-			if (sphereCount < 12)
-			{
-				sphere[sphereCount].c = cam->GetPosition();
-				velocity[sphereCount] = cam->GetLookAt() * 0.7f;
-				sphereCount++;
-			}
-		}
-
-		if (event.button == MB_RIGHT)
-		{
-			sphereCount = 0;
-		}
-	}
-
-	virtual void OnLoad()
-	{
-		Crown::Renderer* renderer = Crown::GetDevice()->GetRenderer();
-		renderer->SetClearColor(Crown::Color4(0.0f, 0.0f, 0.0f, 1.0f));
-
-		// Add a movable camera
-		cam = new MovableCamera(Vec3::ZERO, Angles::ZERO, true, 90.0f, 1.6f, 0.01, 2.5, true);
-
-		if (cam)
-		{
-			cam->SetActive(true);
-			cam->SetSpeed(0.1);
-			cam->SetFarClipDistance(1000.0f);
-			cam->SetPosition(Vec3(0, 10, 15));
-
-		}
-
-		grass = GetTextureManager()->Load("res/test_texture1.tga");
-
-		dplane = GetMeshManager()->LoadPlane("3dplane", 128.0f, 128.0f);
-
-		ray.origin = Vec3(0, 0, 10);
-		ray.direction = Vec3(0, 0, -1);
-
-		for (int i = 0; i < 12; i++)
-		{
-			sphere[i].r = 1.5f;
-		}
-
-		plane[0].n			= Vec3(0, 1, 0);
-		plane[0].d			= 0;
-
-		plane[1].n 			= Vec3(0, 0, 1);
-		plane[1].d			= 0;
-
-		plane[2].n			= Vec3(1, 0, 0);
-		plane[2].d			= 0;
-
-		gravity				= Vec3(0, -0.003, 0);
-
-		quadric = gluNewQuadric();
-	}
-
-	virtual void RenderScene()
-	{
-		Renderer* renderer = GetDevice()->GetRenderer();
-
-		renderer->_SetLighting(false);
-		renderer->_SetBlending(false);
-		renderer->_SetAlphaTest(false);
-		renderer->_SetBackfaceCulling(false);
-		renderer->_SetTexturing(0, false);
-		renderer->_SetTexturing(1, false);
-		renderer->_SetTexturing(2, false);
-
-		cam->Render();
-
-		for (int i = 0; i < sphereCount; i++)
-		{
-			velocity[i] += gravity;
-			for (int j = 0; j < 3; j++)
-			{
-				real itt;
-				Vec3 intersectionPoint;
-				if (Intersection::TestDynamicSpherePlane(sphere[i], velocity[i], plane[j], itt, intersectionPoint))
-				{
-					real velLength = velocity[i].GetLength();
-
-					velocity[i].Normalize();
-					Vec3 nuovo = ((2.0f * (-velocity[i].Dot(plane[j].n))) * plane[j].n) + velocity[i];
-					velocity[i] = nuovo * velLength * 0.7f;
-				}
-			}
-		}
-
-		for (int i = 0; i < sphereCount; i++)
-		{
-			if (velocity[i] == Vec3::ZERO)
-			{
-				velocity[i].Zero();
-			}
-			sphere[i].c += velocity[i];
-		}
-
-		if (cam->IsActive())
-		{
-			ray.origin = cam->GetPosition();
-			ray.direction = cam->GetLookAt();
-		}
-
-		renderer->SetMatrix(MT_MODEL, Mat4::IDENTITY);
-
-		for (int j = 0; j < sphereCount; j++)
-		{
-			// Draw spheres
-			glColor3f(1, 0, 0);
-			tr.LoadIdentity();
-			tr.SetTranslation(sphere[j].c);
-			renderer->SetMatrix(MT_MODEL, tr);
-			gluSphere(quadric, sphere[j].r, 64, 64);
-		}
-
-//		tr.SetTranslation(sphere[1].c);
-//		renderer->SetMatrix(MT_MODEL, tr);
-//		gluSphere(quadric, sphere[1].r, 64, 64);
-
-//		tr.SetTranslation(sphere[2].c);
-//		renderer->SetMatrix(MT_MODEL, tr);
-//		gluSphere(quadric, sphere[2].r, 64, 64);
-		// End Draw spheres
-
-//		// Draw velocity segments
-//		glColor3f(1, 0, 0);
-//		renderer->SetMatrix(MT_MODEL, Mat4::IDENTITY);
-
-//		glBegin(GL_LINES);
-//		glVertex3fv(sphere[0].c.ToFloatPtr());
-//		glVertex3fv((sphere[0].c + velocity[0]).ToFloatPtr());
-//		glEnd();
-
-//		glBegin(GL_LINES);
-//		glVertex3fv(sphere[1].c.ToFloatPtr());
-//		glVertex3fv((sphere[1].c + velocity[1]).ToFloatPtr());
-//		glEnd();
-
-//		glBegin(GL_LINES);
-//		glVertex3fv(sphere[2].c.ToFloatPtr());
-//		glVertex3fv((sphere[2].c + velocity[2]).ToFloatPtr());
-//		glEnd();
-//		// End Draw velocity segments
-
-//		// Draw end spheres
-//		glColor3f(1.0, 0.0, 0.0);
-//		tr.LoadIdentity();
-//		tr.SetTranslation(sphere[0].c + velocity[0]);
-//		renderer->SetMatrix(MT_MODEL, tr);
-//		gluSphere(quadric, sphere[0].r, 64, 64);
-
-//		tr.SetTranslation(sphere[1].c + velocity[1]);
-//		renderer->SetMatrix(MT_MODEL, tr);
-//		gluSphere(quadric, sphere[1].r, 64, 64);
-
-//		tr.SetTranslation(sphere[2].c + velocity[2]);
-//		renderer->SetMatrix(MT_MODEL, tr);
-//		gluSphere(quadric, sphere[2].r, 64, 64);
-//		// End Draw end spheres
-
-//		// Draw spheres at collision time
-//		glColor3f(0.0, 1.0, 0.0);
-//		real it;
-//		if (Intersection::TestDynamicSphereSphere(sphere[0], velocity[0], sphere[1], velocity[1], it))
-//		{
-//			tr.LoadIdentity();
-
-//			tr.SetTranslation(sphere[0].c + (velocity[0] * it));
-//			renderer->SetMatrix(MT_MODEL, tr);
-//			gluSphere(quadric, sphere[0].r, 64, 64);
-
-
-//			tr.SetTranslation(sphere[1].c + (velocity[1] * it));
-//			renderer->SetMatrix(MT_MODEL, tr);
-//			gluSphere(quadric, sphere[1].r, 64, 64);
-//		}
-
-//		if (Intersection::TestDynamicSpherePlane(sphere[2], velocity[2], plane, it))
-//		{
-//			tr.LoadIdentity();
-
-//			tr.SetTranslation(sphere[2].c + (velocity[2] * it));
-//			renderer->SetMatrix(MT_MODEL, tr);
-//			gluSphere(quadric, sphere[2].r, 64, 64);
-//		}
-//		// End Draw spheres at collision time
-
-		renderer->_SetTexture(0, grass);
-		renderer->_SetTexturing(0, true);
-		renderer->_SetTextureMode(0, grass->GetMode(), grass->GetBlendColor());
-		renderer->_SetTextureFilter(0, grass->GetFilter());
-
-		tr.BuildRotationX(Math::PI / 2.0f);
-		tr.SetTranslation(Vec3(0, 0, 0));
-		renderer->SetMatrix(MT_MODEL, tr);
-		renderer->RenderVertexIndexBuffer(dplane->GetVertexBuffer(), dplane->GetIndexBuffer());
-
-		tr.LoadIdentity();
-		tr.SetTranslation(Vec3(0, 0, 0));
-		renderer->SetMatrix(MT_MODEL, tr);
-		renderer->RenderVertexIndexBuffer(dplane->GetVertexBuffer(), dplane->GetIndexBuffer());
-
-		tr.BuildRotationY(Math::PI / 2.0f);
-		tr.SetTranslation(Vec3(0, 0, 0));
-		renderer->SetMatrix(MT_MODEL, tr);
-		renderer->RenderVertexIndexBuffer(dplane->GetVertexBuffer(), dplane->GetIndexBuffer());
-	}
-
-private:
-
-	Mesh* dplane;
-	Mat4 ortho;
-	Mat4 crateModel;
-	Mat4 tr;
-	Texture* grass;
-
-	Ray ray;
-	Plane plane[3];
-	Sphere sphere[12];
-	Vec3 velocity[12];
-	Vec3 gravity;
-	GLUquadric* quadric;
-	MovableCamera* cam;
-	int sphereCount;
-};
-
-int main(int argc, char** argv)
-{
-	Device* mDevice = GetDevice();
-	EventLoop loop;
-
-	if (!mDevice->Init(argc, argv))
-	{
-		return 0;
-	}
-
-	WndCtrl ctrl;
-
-	MainScene scene;
-	scene.OnLoad();
-
-	mDevice->GetMainWindow()->SetTitle("Crown Engine v0.1 - Collision Test");
-
-	while (mDevice->IsRunning())
-	{
-		InputManager* mInputManager = GetDevice()->GetInputManager();
-
-		if (mInputManager)
-		{
-			if (mInputManager->IsMouseAvailable())
-			{
-				if (mInputManager->IsMouseAvailable())
-				{
-					mInputManager->GetMouse()->EventLoop();
-				}
-				if (mInputManager->IsKeyboardAvailable())
-				{
-					mInputManager->GetKeyboard()->EventLoop();
-				}
-				if (mInputManager->IsTouchAvailable())
-				{
-					mInputManager->GetTouch()->EventLoop();
-				}
-			}
-		}
-
-		mDevice->GetMainWindow()->EventLoop();
-
-		GetDevice()->GetRenderer()->_BeginFrame();
-
-		scene.RenderScene();
-
-		GetDevice()->GetRenderer()->_EndFrame();
-
-		mDevice->GetMainWindow()->Update();
-	}
-
-	mDevice->Shutdown();
-
-	mDevice->Shutdown();
-
-	return 0;
-}
-

+ 0 - 246
samples/intersection/intersection.cpp

@@ -1,246 +0,0 @@
-#include "Crown.h"
-#include <cstdlib>
-#include <GL/glu.h>
-
-using namespace Crown;
-
-class WndCtrl: public KeyboardListener
-{
-public:
-
-	WndCtrl()
-	{
-		GetDevice()->GetInputManager()->RegisterKeyboardListener(this);
-	}
-
-	virtual void KeyReleased(const KeyboardEvent& event)
-	{
-		if (event.key == KC_ESCAPE)
-		{
-			GetDevice()->StopRunning();
-		}
-	}
-};
-
-class MainScene: public Scene, public KeyboardListener, public MouseListener
-{
-
-public:
-
-	MainScene(uint windowWidth, uint windowHeight)
-	{
-		GetDevice()->GetInputManager()->RegisterMouseListener(this);
-		GetDevice()->GetInputManager()->RegisterKeyboardListener(this);
-	}
-
-	virtual ~MainScene()
-	{
-		if (quadric)
-			gluDeleteQuadric(quadric);
-	}
-
-	virtual void ButtonReleased(const MouseEvent& event)
-	{
-		if (event.button == MB_LEFT)
-		{
-			GLint view[4];
-			GLdouble proj[16], model[16];
-
-			glGetDoublev(GL_MODELVIEW_MATRIX, model);
-			glGetDoublev(GL_PROJECTION_MATRIX, proj);
-			glGetIntegerv(GL_VIEWPORT, view);
-
-			int x = event.x;
-			int y = event.y;
-
-			// Adjust y wndCoord
-			y = (625 - y);
-
-			double sX, sY, sZ;
-			double eX, eY, eZ;
-
-			gluUnProject(x, y, 0.0f, model, proj, view, &sX, &sY, &sZ);
-			gluUnProject(x, y, 1.0f, model, proj, view, &eX, &eY, &eZ);
-
-			Vec3 dir = Vec3(eX, eY, eZ) - Vec3(sX, sY, sZ);
-
-			dir.Normalize();
-
-			ray.origin = cam->GetPosition();
-			ray.direction = dir;
-
-			//std::cout << x << " " << y << std::endl;
-			//std::cout << "Ori: " << ray.origin.ToStr().c_str() << std::endl;
-			//std::cout << "Dir: " << ray.direction.ToStr().c_str() << std::endl;
-		}
-	}
-
-	virtual void KeyPressed(const KeyboardEvent& event)
-	{
-		if (event.key == KC_UP)
-		{
-			ray.origin += Vec3(0, 0, -0.1);
-		}
-
-		if (event.key == KC_DOWN)
-		{
-			ray.origin += Vec3(0, 0, 0.1);
-		}
-
-		if (event.key == KC_LCONTROL)
-		{
-			cam->SetActive(!cam->IsActive());
-		}
-	}
-		
-
-	virtual void OnLoad()
-	{
-		Scene::OnLoad();
-
-		Crown::Renderer* renderer = Crown::GetDevice()->GetRenderer();
-		renderer->SetClearColor(Crown::Color4(0.0f, 0.0f, 0.0f, 1.0f));
-
-		// Add a movable camera
-		cam = AddMovableCamera();
-
-		if (cam)
-		{
-			cam->SetActive(true);
-			cam->SetSpeed(0.1);
-			cam->SetFarClipDistance(1000.0f);
-			//cam->SetPosition(Vec3(25, 0, 15));
-
-		}
-
-		grid = GetMeshManager()->LoadGrid("grid", 32);
-
-		ray.origin = Vec3(0, 0, 10);
-		ray.direction = Vec3(0, 0, -1);
-
-		sphere[0].c = Vec3(0, 0, 0);
-		sphere[0].r = 2.0f;
-
-		sphere[1].c = Vec3(3, -1, -5);
-		sphere[1].r = 1.0f;
-
-		sphere[2].c = Vec3(-5, 3, 2);
-		sphere[2].r = 3.0f;
-
-		quadric = gluNewQuadric();
-	}
-
-	virtual void RenderScene()
-	{
-		Renderer* renderer = GetDevice()->GetRenderer();
-
-		renderer->_SetLighting(false);
-		renderer->_SetBlending(false);
-		renderer->_SetAlphaTest(false);
-		Scene::RenderScene();
-
-		renderer->SetMatrix(MT_MODEL, Mat4::IDENTITY);
-		renderer->_SetTexturing(0, false);
-		renderer->_SetTexturing(1, false);
-		renderer->_SetTexturing(2, false);
-
-		if (cam->IsActive())
-		{
-			ray.origin = cam->GetPosition();
-			ray.direction = cam->GetLookAt();
-			//std::cout << ray.direction.ToStr().c_str() << std::endl;
-		}
-
-		int sphereIndex = -1;
-		real lastDist = 1000000.0f;
-		// Check ray-sphere intersection
-		for (int i = 0; i < 3; i++)
-		{
-			real dist;
-			if (Intersection::TestRaySphere(ray, sphere[i], dist))
-			{
-				if (dist <= lastDist)
-				{
-					lastDist = dist;
-					sphereIndex = i;
-				}
-			}
-		}
-
-		for (int i = 0; i < 3; i++)
-		{
-			if (sphereIndex == i)
-			{
-				glColor3f(1, 0, 0);
-			}
-			else
-			{
-				glColor3f(0, 1, 0);
-			}
-
-			tr.LoadIdentity();
-			tr.SetTranslation(sphere[i].c);
-			renderer->SetMatrix(MT_MODEL, tr);
-			gluSphere(quadric, sphere[i].r, 64, 64);
-		}
-
-		renderer->SetMatrix(MT_MODEL, Mat4::IDENTITY);
-		glColor3f(0, 0, 1);
-		glBegin(GL_LINES);
-		glVertex3fv(ray.origin.ToFloatPtr());
-		glVertex3fv((ray.origin + ray.direction).ToFloatPtr());
-		glEnd();
-
-		tr.SetTranslation(Vec3(0, -2, 0));
-		renderer->SetMatrix(MT_MODEL, tr);
-		renderer->RenderMesh(grid.GetPointer());
-	}
-
-private:
-
-	MeshPtr grid;
-	Mat4 ortho;
-	Mat4 crateModel;
-	Mat4 tr;
-
-	Ray ray;
-	Sphere sphere[3];
-	GLUquadric* quadric;
-	MovableCamera* cam;
-	Mouse* mouse;
-	Keyboard* keyboard;
-	InputManager* input;
-};
-
-int main(int argc, char** argv)
-{
-	int wndW = 1000;
-	int wndH = 625;
-
-	if (argc == 3)
-	{
-		wndW = atoi(argv[1]);
-		wndH = atoi(argv[2]);
-	}
-
-	Device* mDevice = GetDevice();
-
-	if (!mDevice->Init(wndW, wndH, 32, false))
-	{
-		return 0;
-	}
-
-	WndCtrl ctrl;
-
-	MainScene* mainScene = new MainScene(wndW, wndH);
-	GetDevice()->GetSceneManager()->SelectNextScene(mainScene);
-
-	mDevice->GetMainWindow()->SetTitle("Crown Engine v0.1 - Intersection Test");
-
-	mDevice->Run();
-
-	mDevice->Shutdown();
-
-	return 0;
-}
-

BIN
samples/res/closebutton_x.bmp


BIN
samples/res/crw_dir_icon.bmp


BIN
samples/res/crw_file_icon.bmp


+ 0 - 36
samples/res/editor_editorwindow.xml

@@ -1,36 +0,0 @@
-<Window Name="editorWindow" Title="Editor Window" Height="400" Width="850">
-  <StackLayout Orientation="Horizontal" >
-    <TreeView Name="twCrwLibrary" Width="200" BindingContext="{Bind CrwObjectModel}" Items="{Bind Root}" OnSelectionChanged="{Action UpdateCrwFilePreview}">
-	  <TreeView.ItemTemplate Items="{Bind Children}" ItemTemplate="{Bind ItemTemplate,Source=LogicalParent}">
-	    <StackLayout Orientation="Horizontal">
-		  <ImageWidget DesiredSize="16,16" Margins="2,2,2,2" ImageSource="{Bind Type,Converter=CrwIconConverter}" />
-		  <Label Text="{Bind Name}" Height="18"/>
-		</StackLayout>
-	  </TreeView.ItemTemplate>
-	</TreeView>
-	
-	<StackLayout Width="200" BindingContext="{Bind twCrwLibrary.SelectedItem,Source=Widget}" FitToChildren="Vertically" Margins="2,2,2,-1">
-	  <StackLayout Orientation="Horizontal">
-		<Label Text="ID: " DesiredSize="{Bind MinimumSize,Source=Self}" />
-		<Label Text="{Bind ID}" HorizontalTextAlign="Left" />
-	  </StackLayout>
-	  <StackLayout Orientation="Horizontal">
-		<Label Text="Name: " DesiredSize="{Bind MinimumSize,Source=Self}" />
-		<Label Text="{Bind Name}" />
-	  </StackLayout>
-	  <StackLayout Orientation="Horizontal">
-		<Label Text="Type: " DesiredSize="{Bind MinimumSize,Source=Self}" />
-		<Label Text="{Bind Type}" HorizontalTextAlign="Left" />
-	  </StackLayout>
-	  <StackLayout Orientation="Horizontal">
-		<Label Text="Offset: " DesiredSize="{Bind MinimumSize,Source=Self}" />
-		<Label Text="{Bind ContentOffset}" HorizontalTextAlign="Left" />
-	  </StackLayout>
-	  <StackLayout Orientation="Horizontal">
-		<Label Text="Size: " DesiredSize="{Bind MinimumSize,Source=Self}" />
-		<Label Text="{Bind ContentSize}" HorizontalTextAlign="Left" />
-	  </StackLayout>
-	  <ImageWidget DesiredSize="100, 100" ImageSource="{Bind BindingContext,Source=Self,Converter=CrwDescriptorToFullPathConverter}" />
-	</StackLayout>
-  </StackLayout>
-</Window>

+ 0 - 13
samples/res/editor_mainwindow.xml

@@ -1,13 +0,0 @@
-<Window Name="mainWindow" Title="Main Window" DesiredSize="90, 80">
-  <StackLayout Orientation="Vertical">
-    <Button Name="btnNewLibrary" Margins="0,0,0,1" OnClick="{Action NewLibrary}">
-      <Label Text="New Library" HorizontalTextAlign="Center" />
-    </Button>
-	<Button Name="btnOpenLibrary" Margins="0,1,0,1" OnClick="{Action OpenLibrary}">
-      <Label Text="Open Library" HorizontalTextAlign="Center" />
-    </Button>
-    <Button Name="btnClose" Margins="0,1,0,0" OnClick="{Action QuitApplication}">
-      <Label Text="Close" HorizontalTextAlign="Center" />
-    </Button>
-  </StackLayout>
-</Window>

BIN
samples/res/terrain.bmp


+ 0 - 12
samples/res/window.xml

@@ -1,12 +0,0 @@
-<Window Name="mainWindow" Title="A Window">
-  <StackLayout Margins="2, 0, 2, 0">
-    <Button Name="btnQuit" OnClick="{Action QuitApplication}" DesiredSize="35, 15">
-	  <Label Name="lblCaption" Text="Close" />
-	</Button>
-    <Button Name="btnNew" OnClick="{Action NewLibrary}" Margins="0, 15, 0, 0" DesiredSize="70, 20">
-	  <Label Name="lblCaption" Text="New Library" />
-	</Button>
-  </StackLayout>
-</Window>
-
-

+ 0 - 45
samples/res/window_fractal.xml

@@ -1,45 +0,0 @@
-<Window Name="loaderWindow" Title="Fractal" DesiredSize="200, 176">
-  <StackLayout Margins="2, 2, 2, 2">
-	<Label Text="Interactions:" Height="25" />
-	<Button OnClick="{Action Generate}" Height="25">
-	  <Label Text="Generate" HorizontalTextAlign="Center" />
-	</Button>
-	
-	<StackLayout Orientation="Horizontal">
-	  <Button OnClick="{Action MoveLeft}" DesiredSize="25, 25">
-	    <Label Text="<" HorizontalTextAlign="Center" />
-	  </Button>
-	  
-	  <StackLayout Orientation="Vertical" FitToChildren="Both">
-	    <Button OnClick="{Action MoveUp}" DesiredSize="25, 25">
-	      <Label Text="^" HorizontalTextAlign="Center" />
-	    </Button>
-	    
-	    <Button OnClick="{Action MoveDown}" DesiredSize="25, 25">
-	      <Label Text="v" HorizontalTextAlign="Center" />
-	    </Button>
-	  </StackLayout>
-	
-	  <Button OnClick="{Action MoveRight}" DesiredSize="25, 25">
-	    <Label Text=">" HorizontalTextAlign="Center" />
-	  </Button>
-	  
-	  <StackLayout Orientation="Vertical" FitToChildren="Both" Margins="25,0,0,0">
-	    <Button OnClick="{Action ZoomPlus}" DesiredSize="25, 25">
-	      <Label Text="z+" HorizontalTextAlign="Center" />
-	    </Button>
-	    
-	    <Button OnClick="{Action ZoomMinus}" DesiredSize="25, 25">
-	      <Label Text="z-" HorizontalTextAlign="Center" />
-	    </Button>
-	  </StackLayout>
-	  
-	</StackLayout>
-	
-	<Button OnClick="{Action QuitApplication}" Height="25">
-	  <Label Text="Quit" HorizontalTextAlign="Center" />
-	</Button>
-  </StackLayout>
-</Window>
-
-

+ 0 - 30
samples/res/window_listview.xml

@@ -1,30 +0,0 @@
-<Window Name="listviewWindow" Title="List View Window" DesiredSize="300, 300">
-  <StackLayout Orientation="Horizontal">
-    <ListView Name="lwFruits" Items="{Bind FruitsList}">
-	  <ListView.ItemTemplate>
-	    <StackLayout Margins="4,4,4,4">
-		  <StackLayout Orientation="Horizontal">
-		    <Label Text="Name: " />
-			<Label Text="{Bind fruitName}" />
-		  </StackLayout>
-		  <StackLayout Orientation="Horizontal">
-		    <Label Text="Cost: " />
-			<Label Text="{Bind fruitPrice}" />
-			<Label Text="€" />
-		  </StackLayout>
-		</StackLayout>
-	  </ListView.ItemTemplate>
-	</ListView>
-    <StackLayout Margins="2, -1, 2, -1" Orientation="Horizontal" FitToChildren="Vertically">
-	  <Label Text="Price:" Width="0" />
-      <Button Height="20" Margins="4,0,0,0" OnClick="{Action IncreaseFruitPrice}" >
-		<Label Text="Increase" />
-	  </Button>
-	  <Button Height="20" Margins="4,0,0,0" OnClick="{Action DecreaseFruitPrice}" >
-		<Label Text="Decrease" />
-	  </Button>
-    </StackLayout>
-  </StackLayout>
-</Window>
-
-

+ 0 - 33
samples/res/window_loader.xml

@@ -1,33 +0,0 @@
-<Window Name="loaderWindow" Title="Load a XWML file" DesiredSize="200, 176">
-  <StackLayout Margins="2, 2, 2, 2">
-	<Label Text="Insert the XWML file:" />
-    <TextBox Name="tbXWMLFilepath" Text="<insert xwml filename>" />
-    <Button Name="btnLoad" OnClick="{Action LoadXWMLFromFilepath}" Margins="0, 4, 0, 0">
-	  <Label Name="lblCaption" Text="Load XWML" HorizontalTextAlign="Center" />
-	</Button>
-	<Label Text="Examples:" Margins="0, 5, 0, 0" />
-	<StackLayout Orientation="Horizontal" FitToChildren="Both">
-	  <Label Name="lblExample1" Text="res/window.xml" />
-	  <Button DesiredSize="10, 10" Margins="3,0,0,0" OnClick="{Action CopyProperty('lblExample1.Text','tbXWMLFilepath.Text')}">
-	    <Label Text="+" />
-	  </Button>
-	</StackLayout>
-	<StackLayout Orientation="Horizontal" FitToChildren="Both">
-	  <Label Name="lblExample2" Text="res/window_listview.xml" />
-	  <Button DesiredSize="10, 10" Margins="3,0,0,0" OnClick="{Action CopyProperty('lblExample2.Text','tbXWMLFilepath.Text')}">
-	    <Label Text="+" />
-	  </Button>
-	</StackLayout>
-	<StackLayout Orientation="Horizontal" FitToChildren="Both">
-	  <Label Name="lblExample3" Text="res/window_loader.xml" />
-	  <Button DesiredSize="10, 10" Margins="3,0,0,0" OnClick="{Action CopyProperty('lblExample3.Text','tbXWMLFilepath.Text')}">
-	    <Label Text="+" />
-	  </Button>
-	</StackLayout>
-	<Button OnClick="{Action QuitApplication}">
-	  <Label Text="Quit" HorizontalTextAlign="Center" />
-	</Button>
-  </StackLayout>
-</Window>
-
-

BIN
samples/textrenderer/res/arial.tga


+ 0 - 95
samples/textrenderer/res/arial.tga.txt

@@ -1,95 +0,0 @@
-32 0.000000 0.050781 0.000000 0.066406 0.000000 0.000000 8.000000 0.000000
-33 0.056641 0.107422 0.000000 0.066406 4.000000 20.000000 8.000000 20.000000
-34 0.113281 0.164062 0.000000 0.066406 10.000000 7.000000 13.000000 20.000000
-35 0.169922 0.220703 0.000000 0.066406 15.000000 20.000000 15.000000 20.000000
-36 0.226562 0.277344 0.000000 0.066406 12.000000 23.000000 15.000000 21.000000
-37 0.283203 0.333984 0.000000 0.066406 22.000000 21.000000 24.000000 20.000000
-38 0.339844 0.390625 0.000000 0.066406 18.000000 20.000000 20.000000 20.000000
-39 0.396484 0.447266 0.000000 0.066406 4.000000 7.000000 6.000000 20.000000
-40 0.453125 0.503906 0.000000 0.066406 7.000000 25.000000 9.000000 20.000000
-41 0.509766 0.560547 0.000000 0.066406 7.000000 25.000000 9.000000 20.000000
-42 0.566406 0.617188 0.000000 0.066406 10.000000 9.000000 11.000000 20.000000
-43 0.623047 0.673828 0.000000 0.066406 14.000000 14.000000 16.000000 17.000000
-44 0.000000 0.050781 0.072266 0.138672 4.000000 8.000000 8.000000 4.000000
-45 0.056641 0.107422 0.072266 0.138672 8.000000 4.000000 9.000000 9.000000
-46 0.113281 0.164062 0.072266 0.138672 4.000000 4.000000 8.000000 4.000000
-47 0.169922 0.220703 0.072266 0.138672 9.000000 20.000000 8.000000 20.000000
-48 0.226562 0.277344 0.072266 0.138672 13.000000 20.000000 15.000000 20.000000
-49 0.283203 0.333984 0.072266 0.138672 9.000000 20.000000 15.000000 20.000000
-50 0.339844 0.390625 0.072266 0.138672 13.000000 20.000000 15.000000 20.000000
-51 0.396484 0.447266 0.072266 0.138672 13.000000 20.000000 15.000000 20.000000
-52 0.453125 0.503906 0.072266 0.138672 14.000000 20.000000 15.000000 20.000000
-53 0.509766 0.560547 0.072266 0.138672 13.000000 20.000000 15.000000 20.000000
-54 0.566406 0.617188 0.072266 0.138672 13.000000 20.000000 15.000000 20.000000
-55 0.623047 0.673828 0.072266 0.138672 13.000000 20.000000 15.000000 20.000000
-56 0.000000 0.050781 0.144531 0.210938 13.000000 20.000000 15.000000 20.000000
-57 0.056641 0.107422 0.144531 0.210938 13.000000 20.000000 15.000000 20.000000
-58 0.113281 0.164062 0.144531 0.210938 4.000000 15.000000 10.000000 15.000000
-59 0.169922 0.220703 0.144531 0.210938 4.000000 19.000000 10.000000 15.000000
-60 0.226562 0.277344 0.144531 0.210938 13.000000 15.000000 16.000000 17.000000
-61 0.283203 0.333984 0.144531 0.210938 14.000000 10.000000 16.000000 15.000000
-62 0.339844 0.390625 0.144531 0.210938 13.000000 15.000000 16.000000 17.000000
-63 0.396484 0.447266 0.144531 0.210938 14.000000 20.000000 17.000000 20.000000
-64 0.453125 0.503906 0.144531 0.210938 25.000000 27.000000 26.000000 20.000000
-65 0.509766 0.560547 0.144531 0.210938 19.000000 20.000000 19.000000 20.000000
-66 0.566406 0.617188 0.144531 0.210938 17.000000 20.000000 20.000000 20.000000
-67 0.623047 0.673828 0.144531 0.210938 18.000000 20.000000 20.000000 20.000000
-68 0.000000 0.050781 0.216797 0.283203 17.000000 20.000000 20.000000 20.000000
-69 0.056641 0.107422 0.216797 0.283203 15.000000 20.000000 18.000000 20.000000
-70 0.113281 0.164062 0.216797 0.283203 14.000000 20.000000 17.000000 20.000000
-71 0.169922 0.220703 0.216797 0.283203 18.000000 20.000000 21.000000 20.000000
-72 0.226562 0.277344 0.216797 0.283203 16.000000 20.000000 20.000000 20.000000
-73 0.283203 0.333984 0.216797 0.283203 4.000000 20.000000 8.000000 20.000000
-74 0.339844 0.390625 0.216797 0.283203 13.000000 20.000000 15.000000 20.000000
-75 0.396484 0.447266 0.216797 0.283203 18.000000 20.000000 20.000000 20.000000
-76 0.453125 0.503906 0.216797 0.283203 14.000000 20.000000 17.000000 20.000000
-77 0.509766 0.560547 0.216797 0.283203 19.000000 20.000000 21.000000 20.000000
-78 0.566406 0.617188 0.216797 0.283203 16.000000 20.000000 20.000000 20.000000
-79 0.623047 0.673828 0.216797 0.283203 19.000000 20.000000 21.000000 20.000000
-80 0.000000 0.050781 0.289062 0.355469 15.000000 20.000000 18.000000 20.000000
-81 0.056641 0.107422 0.289062 0.355469 20.000000 22.000000 21.000000 20.000000
-82 0.113281 0.164062 0.289062 0.355469 18.000000 20.000000 20.000000 20.000000
-83 0.169922 0.220703 0.289062 0.355469 16.000000 20.000000 18.000000 20.000000
-84 0.226562 0.277344 0.289062 0.355469 16.000000 20.000000 18.000000 20.000000
-85 0.283203 0.333984 0.289062 0.355469 16.000000 20.000000 20.000000 20.000000
-86 0.339844 0.390625 0.289062 0.355469 17.000000 20.000000 18.000000 20.000000
-87 0.396484 0.447266 0.289062 0.355469 25.000000 20.000000 25.000000 20.000000
-88 0.453125 0.503906 0.289062 0.355469 18.000000 20.000000 18.000000 20.000000
-89 0.509766 0.560547 0.289062 0.355469 20.000000 20.000000 18.000000 20.000000
-90 0.566406 0.617188 0.289062 0.355469 16.000000 20.000000 17.000000 20.000000
-91 0.623047 0.673828 0.289062 0.355469 7.000000 25.000000 9.000000 20.000000
-92 0.000000 0.050781 0.361328 0.427734 9.000000 20.000000 8.000000 20.000000
-93 0.056641 0.107422 0.361328 0.427734 7.000000 25.000000 9.000000 20.000000
-94 0.113281 0.164062 0.361328 0.427734 12.000000 10.000000 16.000000 20.000000
-95 0.169922 0.220703 0.361328 0.427734 16.000000 3.000000 15.000000 -2.000000
-96 0.226562 0.277344 0.361328 0.427734 6.000000 4.000000 9.000000 20.000000
-97 0.283203 0.333984 0.361328 0.427734 13.000000 15.000000 15.000000 15.000000
-98 0.339844 0.390625 0.361328 0.427734 14.000000 20.000000 17.000000 20.000000
-99 0.396484 0.447266 0.361328 0.427734 13.000000 15.000000 15.000000 15.000000
-100 0.453125 0.503906 0.361328 0.427734 14.000000 20.000000 17.000000 20.000000
-101 0.509766 0.560547 0.361328 0.427734 14.000000 15.000000 15.000000 15.000000
-102 0.566406 0.617188 0.361328 0.427734 10.000000 20.000000 9.000000 20.000000
-103 0.623047 0.673828 0.361328 0.427734 15.000000 20.000000 17.000000 15.000000
-104 0.000000 0.050781 0.433594 0.500000 13.000000 20.000000 17.000000 20.000000
-105 0.056641 0.107422 0.433594 0.500000 4.000000 20.000000 8.000000 20.000000
-106 0.113281 0.164062 0.433594 0.500000 7.000000 25.000000 8.000000 20.000000
-107 0.169922 0.220703 0.433594 0.500000 13.000000 20.000000 15.000000 20.000000
-108 0.226562 0.277344 0.433594 0.500000 4.000000 20.000000 8.000000 20.000000
-109 0.283203 0.333984 0.433594 0.500000 22.000000 15.000000 26.000000 15.000000
-110 0.339844 0.390625 0.433594 0.500000 13.000000 15.000000 17.000000 15.000000
-111 0.396484 0.447266 0.433594 0.500000 15.000000 15.000000 17.000000 15.000000
-112 0.453125 0.503906 0.433594 0.500000 14.000000 20.000000 17.000000 15.000000
-113 0.509766 0.560547 0.433594 0.500000 14.000000 20.000000 17.000000 15.000000
-114 0.566406 0.617188 0.433594 0.500000 9.000000 15.000000 11.000000 15.000000
-115 0.623047 0.673828 0.433594 0.500000 13.000000 15.000000 15.000000 15.000000
-116 0.000000 0.050781 0.505859 0.572266 9.000000 20.000000 9.000000 20.000000
-117 0.056641 0.107422 0.505859 0.572266 13.000000 15.000000 17.000000 15.000000
-118 0.113281 0.164062 0.505859 0.572266 15.000000 15.000000 15.000000 15.000000
-119 0.169922 0.220703 0.505859 0.572266 21.000000 15.000000 21.000000 15.000000
-120 0.226562 0.277344 0.505859 0.572266 15.000000 15.000000 15.000000 15.000000
-121 0.283203 0.333984 0.505859 0.572266 17.000000 20.000000 15.000000 15.000000
-122 0.339844 0.390625 0.505859 0.572266 12.000000 15.000000 14.000000 15.000000
-123 0.396484 0.447266 0.505859 0.572266 9.000000 25.000000 11.000000 20.000000
-124 0.453125 0.503906 0.505859 0.572266 3.000000 25.000000 7.000000 20.000000
-125 0.509766 0.560547 0.505859 0.572266 9.000000 25.000000 11.000000 20.000000
-126 0.566406 0.617188 0.505859 0.572266 14.000000 6.000000 16.000000 13.000000

BIN
samples/textrenderer/res/arialbd.ttf


BIN
samples/textrenderer/res/times.ttf


+ 0 - 113
samples/textrenderer/textrenderer.cpp

@@ -1,113 +0,0 @@
-#include "Crown.h"
-#include <cstdlib>
-#include <GL/glew.h>
-
-using namespace Crown;
-
-class WndCtrl: public KeyboardListener
-{
-public:
-
-	WndCtrl()
-	{
-		GetDevice()->GetInputManager()->RegisterKeyboardListener(this);
-	}
-
-	virtual void KeyReleased(const KeyboardEvent& event)
-	{
-		if (event.key == KC_ESCAPE)
-		{
-			GetDevice()->StopRunning();
-		}
-	}
-};
-
-class MainScene
-{
-
-public:
-
-	MainScene(uint windowWidth, uint windowHeight)
-	{
-	}
-
-	virtual ~MainScene()
-	{
-	}
-
-	virtual void OnLoad()
-	{
-		mOrtho.BuildProjectionOrtho2dRH(800, 600, 10, -10);
-
-		Crown::Renderer* renderer = Crown::GetDevice()->GetRenderer();
-
-		renderer->SetClearColor(Crown::Color4(0.8f, 0.8f, 0.8f, 0.8f));
-
-		// Load and select the font
-		mLargeFont = GetFontManager()->Load("res/arial.tga");
-
-		renderer->_SetLighting(false);
-	}
-
-	virtual void RenderScene()
-	{
-		Scene::RenderScene();
-
-		Renderer* renderer = GetDevice()->GetRenderer();
-
-		Scene::RenderScene();
-
-		renderer->SetMatrix(MT_PROJECTION, mOrtho);
-
-		//text.SetFont(mLargeFont);
-		//text.SetColor(Color4::SILVER);
-		text.Draw("abcdef ABCDEF .@#^?=()&%!", 100, 90, mLargeFont);
-		text.Draw("Hello world! This is the new TextRenderer.\n", 100, 120, mLargeFont);
-		text.Draw("It supports a lot of new features!", 100, 150, mLargeFont);
-	}
-
-private:
-
-	Mat4 mOrtho;
-	Crown::Font* mLargeFont;
-	Crown::Font* mSmallFont;
-	Crown::Font* mTimesFont;
-
-	TextRenderer text;
-};
-
-int main(int argc, char** argv)
-{
-	int wndW = 800;
-	int wndH = 600;
-
-	if (argc == 3)
-	{
-		wndW = atoi(argv[1]);
-		wndH = atoi(argv[2]);
-	}
-
-	Device* mDevice = GetDevice();
-
-	if (!mDevice->Init(wndW, wndH, 32, false))
-	{
-		return 0;
-	}
-
-	WndCtrl ctrl;
-
-	MainScene* mainScene = new MainScene(wndW, wndH);
-	GetDevice()->GetSceneManager()->SelectNextScene(mainScene);
-
-	mDevice->GetMainWindow()->SetTitle("Crown Engine v0.1 - TextRenderer Test");
-
-	while (mDevice->IsRunning())
-	{
-		mDevice->Frame();
-	}
-
-	mDevice->Shutdown();
-
-	return 0;
-}
-

BIN
samples/texturing/ress/crate.tga


BIN
samples/texturing/ress/grass.tga


BIN
samples/texturing/ress/red_down.tga


BIN
samples/texturing/ress/red_east.tga


BIN
samples/texturing/ress/red_north.tga


BIN
samples/texturing/ress/red_south.tga


BIN
samples/texturing/ress/red_up.tga


BIN
samples/texturing/ress/red_west.tga


+ 0 - 222
samples/texturing/texturing.cpp

@@ -1,222 +0,0 @@
-#include "Crown.h"
-#include <cstdlib>
-
-using namespace Crown;
-
-class WndCtrl: public KeyboardListener
-{
-public:
-
-	WndCtrl()
-	{
-		GetDevice()->GetInputManager()->RegisterKeyboardListener(this);
-	}
-
-	virtual void KeyReleased(const KeyboardEvent& event)
-	{
-		if (event.key == KC_ESCAPE)
-		{
-			GetDevice()->StopRunning();
-		}
-	}
-};
-
-class MainScene: public Scene, public KeyboardListener
-{
-
-public:
-
-	MainScene() :
-		optShowSkybox(true),
-		optShowCrate(true),
-		optShowTerrain(true)
-	{
-		GetDevice()->GetInputManager()->RegisterKeyboardListener(this);
-	}
-
-	virtual ~MainScene()
-	{
-	}
-
-	virtual void KeyReleased(const KeyboardEvent& event)
-	{
-		if (event.key == '1')
-		{
-			optShowSkybox = !optShowSkybox;
-		}
-
-		if (event.key == '2')
-		{
-			optShowCrate = !optShowCrate;
-		}
-
-		if (event.key == '3')
-		{
-			optShowTerrain = !optShowTerrain;
-		}
-
-		if (event.key == KC_F5)
-		{
-			GetTextureManager()->Unload("res/grass.tga", false);
-		}
-
-		if (event.key == KC_SPACE)
-		{
-			if (cam)
-			{
-				cam->SetActive(!cam->IsActive());
-			}
-		}
-	}
-		
-
-	virtual void OnLoad()
-	{
-		Crown::Renderer* renderer = Crown::GetDevice()->GetRenderer();
-		renderer->SetClearColor(Crown::Color4(0.0f, 0.0f, 0.0f, 1.0f));
-
-		// Add a movable camera
-		cam = AddMovableCamera();
-
-		if (cam)
-		{
-			cam->SetActive(true);
-			cam->SetSpeed(0.1);
-			cam->SetFarClipDistance(1000.0f);
-		}
-
-		// Add a skybox
-		skybox = AddSkybox();
-
-		if (skybox)
-		{
-			skybox->SetFace(SF_NORTH,	GetTextureManager()->Load("res/red_north.tga"));
-			skybox->SetFace(SF_SOUTH,	GetTextureManager()->Load("res/red_south.tga"));
-			skybox->SetFace(SF_EAST,	GetTextureManager()->Load("res/red_east.tga"));
-			skybox->SetFace(SF_WEST,	GetTextureManager()->Load("res/red_west.tga"));
-			skybox->SetFace(SF_UP,		GetTextureManager()->Load("res/red_up.tga"));
-			skybox->SetFace(SF_DOWN,	GetTextureManager()->Load("res/red_down.tga"));
-		}
-
-		crate = GetTextureManager()->Load("res/crate.tga");
-		grass = GetTextureManager()->Load("res/grass.tga");
-
-		crate->SetFilter(TF_BILINEAR);
-		grass->SetFilter(TF_BILINEAR);
-
-		cube = GetMeshManager()->LoadCube("cube", 1.0f);
-		grid = GetMeshManager()->LoadGrid("grid", 32);
-
-		font = GetFontManager()->Load("arial", "res/arialbd.ttf", 12);
-
-		renderer->GetTextRenderer()->SetFont(font);
-		renderer->GetTextRenderer()->SetColor(Color4::WHITE);
-
-		ortho.BuildProjectionOrtho2dRH(1000, 625, -1, 1);
-		crateModel.LoadIdentity();
-		crateModel.SetTranslation(Vec3(0, 2, 0));
-	}
-
-	virtual void RenderScene()
-	{
-		Renderer* renderer = GetDevice()->GetRenderer();
-
-		if (skybox)
-		{
-			skybox->SetVisible(optShowSkybox);
-		}
-
-		Scene::RenderScene();
-
-		renderer->_SetLighting(false);
-		renderer->_SetBlending(false);
-		renderer->_SetAlphaTest(false);
-
-		renderer->SetMatrix(MT_MODEL, Mat4::IDENTITY);
-		renderer->_SetTexturing(0, false);
-		renderer->_SetTexturing(1, false);
-		renderer->_SetTexturing(2, false);
-
-		// Render crate
-		if (optShowCrate)
-		{
-			renderer->_SetTexture(0, crate);
-			renderer->_SetTexturing(0, true);
-			renderer->_SetTextureMode(0, crate->GetMode(), crate->GetBlendColor());
-			renderer->_SetTextureFilter(0, crate->GetFilter());
-
-			renderer->SetMatrix(MT_MODEL, crateModel);
-			renderer->RenderVertexIndexBuffer(cube->GetVertexBuffer(), cube->GetIndexBuffer());
-		}
-
-		// Render terrain
-		if (optShowTerrain)
-		{
-			renderer->_SetTexture(0, grass);
-			renderer->_SetTexturing(0, true);
-			renderer->_SetTextureMode(0, grass->GetMode(), grass->GetBlendColor());
-			renderer->_SetTextureFilter(0, grass->GetFilter());
-
-			renderer->SetMatrix(MT_MODEL, Mat4::IDENTITY);
-			renderer->RenderVertexIndexBuffer(grid->GetVertexBuffer(), grid->GetIndexBuffer());
-		}
-
-/*
-		renderer->SetMatrix(MT_MODEL,		Mat4::IDENTITY);
-		renderer->SetMatrix(MT_VIEW,		Mat4::IDENTITY);
-		renderer->SetMatrix(MT_PROJECTION,	mOrtho2dRH);
-
-		renderer->_SetDepthTest(false);
-		renderer->SetMatrix(MT_PROJECTION, ortho);
-		renderer->SetMatrix(MT_MODEL, Mat4::IDENTITY);
-		renderer->SetMatrix(MT_VIEW, Mat4::IDENTITY);
-		renderer->GetTextRenderer()->Draw("Show/Hide Skybox (1)", 10, 24);
-		renderer->GetTextRenderer()->Draw("Show/Hide Crate (2)", 10, 38);
-		renderer->GetTextRenderer()->Draw("Show/Hide Terrain (3)", 10, 52);
-		renderer->_SetDepthTest(true);
-*/
-	}
-
-private:
-
-	MovableCamera* cam;
-	Skybox* skybox;
-	Texture* crate;
-	Texture* grass;
-	Mesh* cube;
-	Mesh* grid;
-	Crown::Font* font;
-	Mat4 ortho;
-	Mat4 crateModel;
-
-	bool optShowSkybox;
-	bool optShowCrate;
-	bool optShowTerrain;
-};
-
-int main(int argc, char** argv)
-{
-	Device* mDevice = GetDevice();
-
-	if (!mDevice->Init(argc, argv))
-	{
-		return 0;
-	}
-
-	WndCtrl ctrl;
-
-	MainScene* mainScene = new MainScene();
-	GetDevice()->GetSceneManager()->SelectNextScene(mainScene);
-
-	mDevice->GetMainWindow()->SetTitle("Crown Engine v0.1 - Texturing Test");
-
-	while (mDevice->IsRunning())
-	{
-		mDevice->Frame();
-	}
-
-	mDevice->Shutdown();
-
-	return 0;
-}
-