From 2ec38be58c52b583a0094e612b1097e5630ee3eb Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 17 Nov 2009 00:17:14 +0000 Subject: [PATCH] added tests/bowling.lua git-svn-id: svn://anubis/anaglym/trunk@178 99a6e188-d820-4881-8870-2d33a10e2619 --- Engine.cc | 1 + Engine.h | 1 + tests/bowling.lua | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 tests/bowling.lua diff --git a/Engine.cc b/Engine.cc index 89f5c35..3da9110 100644 --- a/Engine.cc +++ b/Engine.cc @@ -851,6 +851,7 @@ Engine::Object::Object(const Engine::Object & orig) m_args = orig.m_args; for (int i = 0; i < 4; i++) m_color[i] = orig.m_color[i]; + m_texture = orig.m_texture; } Engine::Object::~Object() diff --git a/Engine.h b/Engine.h index ca16705..8f6001d 100644 --- a/Engine.h +++ b/Engine.h @@ -64,6 +64,7 @@ class Engine m_color[0] = r; m_color[1] = g; m_color[2] = b; + m_color[3] = 1.0f; render(); } void setTexture(GLuint tex); diff --git a/tests/bowling.lua b/tests/bowling.lua new file mode 100644 index 0000000..bda689d --- /dev/null +++ b/tests/bowling.lua @@ -0,0 +1,44 @@ + +function init() + local levels = 5 + local pin = ag.loadModel("bowling_pin", 0.5) + pin:setPosition(0, -5.5, 2) + for level = 2, levels do + for x = 1, level do + local p = pin:clone() + p:setPosition(x - 0.5 - level/2, + -(levels - level + 1.5), 2) + end + end + + --local ground = ag.loadStaticModel("crate", 10) + local ground = ag.createPlane(0, 0, 1, 0) + ground:setColor(0.8, 0.5, 0.0) + ground:setPosition(0, 0, -10) + ag.setCamera(0, -25, 10, 0, 0, 1, 0, 0, 1) + camx, camy, camz, cx, cy, cz = ag.getCamera() + + ball = ag.loadModel("checkerball", 0.5) + --ball = ag.createSphere(0.4) + --ball:setColor(0.2, 0.2, 0.9) + ball:setPosition(2*camx - cx, 2*camy - cy, 2*camz - cz) +end + +function mousebutton_down_event(button) + local function button1() + local newball = ball:clone() + newball:setPosition(camx, camy, 1) + force = 800 + newball:addForce(force * (cx-camx), + force * (cy-camy), + force * (cz-camz)) + end + if (button == 1) then + button1() + end +end + +--function update_overlay_event(width, height) +-- local tw, th = ag.getTextSize("Hi there", 18) +-- ag.drawText("Hi there", 1, 1, 1, 18, width - tw - 4, height - th - 4) +--end