aboutsummaryrefslogtreecommitdiffstats
path: root/dev/a2-carsoccer/car_soccer.cc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dev/a2-carsoccer/car_soccer.cc104
1 files changed, 0 insertions, 104 deletions
diff --git a/dev/a2-carsoccer/car_soccer.cc b/dev/a2-carsoccer/car_soccer.cc
deleted file mode 100644
index a9cea69..0000000
--- a/dev/a2-carsoccer/car_soccer.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-/** CSci-4611 Assignment 2: Car Soccer
- */
-
-#include "car_soccer.h"
-#include "config.h"
-
-
-CarSoccer::CarSoccer() : GraphicsApp(1024,768, "Car Soccer") {
- // Define a search path for finding data files (images and shaders)
- searchPath_.push_back(".");
- searchPath_.push_back("./data");
- searchPath_.push_back(DATA_DIR_INSTALL);
- searchPath_.push_back(DATA_DIR_BUILD);
-}
-
-CarSoccer::~CarSoccer() {
-}
-
-
-Vector2 CarSoccer::joystick_direction() {
- Vector2 dir;
- if (IsKeyDown(GLFW_KEY_LEFT))
- dir[0]--;
- if (IsKeyDown(GLFW_KEY_RIGHT))
- dir[0]++;
- if (IsKeyDown(GLFW_KEY_UP))
- dir[1]++;
- if (IsKeyDown(GLFW_KEY_DOWN))
- dir[1]--;
- return dir;
-}
-
-
-void CarSoccer::OnSpecialKeyDown(int key, int scancode, int modifiers) {
- if (key == GLFW_KEY_SPACE) {
- // Here's where you could call some form of launch_ball();
- }
-}
-
-
-void CarSoccer::UpdateSimulation(double timeStep) {
- // Here's where you shound do your "simulation", updating the positions of the
- // car and ball as needed and checking for collisions. Filling this routine
- // in is the main part of the assignment.
-
-}
-
-
-void CarSoccer::InitOpenGL() {
- // Set up the camera in a good position to see the entire field
- projMatrix_ = Matrix4::Perspective(60, aspect_ratio(), 1, 1000);
- modelMatrix_ = Matrix4::LookAt(Point3(0,60,70), Point3(0,0,10), Vector3(0,1,0));
-
- // Set a background color for the screen
- glClearColor(0.8f, 0.8f, 0.8f, 1.0f);
-
- // Load some image files we'll use
- fieldTex_.InitFromFile(Platform::FindFile("pitch.png", searchPath_));
- crowdTex_.InitFromFile(Platform::FindFile("crowd.png", searchPath_));
-}
-
-
-void CarSoccer::DrawUsingOpenGL() {
- // Draw the crowd as a fullscreen background image
- quickShapes_.DrawFullscreenTexture(Color(1,1,1), crowdTex_);
-
- // Draw the field with the field texture on it.
- Color col(16.0f/255.0f, 46.0f/255.0f, 9.0f/255.0f);
- Matrix4 M = Matrix4::Translation(Vector3(0.0f, -0.201f, 0.0f)) * Matrix4::Scale(Vector3(50.0f, 1.0f, 60.0f));
- quickShapes_.DrawSquare(modelMatrix_ * M, viewMatrix_, projMatrix_, col);
- M = Matrix4::Translation(Vector3(0.0f, -0.2f, 0.0f)) * Matrix4::Scale(Vector3(40.0f, 1.0f, 50.0f));
- quickShapes_.DrawSquare(modelMatrix_ * M, viewMatrix_, projMatrix_, Color(1,1,1), fieldTex_);
-
- // Draw the car
- Color carcol(0.8f, 0.2f, 0.2f);
- Matrix4 Mcar =
- Matrix4::Translation(car_.position() - Point3(0,0,0)) *
- Matrix4::Scale(car_.size()) *
- Matrix4::Scale(Vector3(0.5f, 0.5f, 0.5f));
- quickShapes_.DrawCube(modelMatrix_ * Mcar, viewMatrix_, projMatrix_, carcol);
-
-
- // Draw the ball
- Color ballcol(1,1,1);
- Matrix4 Mball =
- Matrix4::Translation(ball_.position() - Point3(0,0,0)) *
- Matrix4::Scale(Vector3(ball_.radius(), ball_.radius(), ball_.radius()));
- quickShapes_.DrawSphere(modelMatrix_ * Mball, viewMatrix_, projMatrix_, ballcol);
-
-
- // Draw the ball's shadow -- this is a bit of a hack, scaling Y by zero
- // flattens the sphere into a pancake, which we then draw just a bit
- // above the ground plane.
- Color shadowcol(0.2f, 0.4f, 0.15f);
- Matrix4 Mshadow =
- Matrix4::Translation(Vector3(ball_.position()[0], -0.1f, ball_.position()[2])) *
- Matrix4::Scale(Vector3(ball_.radius(), 0, ball_.radius())) *
- Matrix4::RotationX(90);
- quickShapes_.DrawSphere(modelMatrix_ * Mshadow, viewMatrix_, projMatrix_, shadowcol);
-
-
- // You should add drawing the goals and the boundary of the playing area
- // using quickShapes_.DrawLines()
-}