X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=lib%2Fmath%2Fvector.h;h=31b171d691a03cdbd6d48028e475700724befbb7;hb=495f8b77cb935fe8eff81bec755efca8e34e8a99;hp=faedaff9e6dcfde3d4c0415f66406655f2fd424d;hpb=5d068da91eb5eff9bc13d53e6632028c0f61f315;p=supertux.git diff --git a/lib/math/vector.h b/lib/math/vector.h index faedaff9e..31b171d69 100644 --- a/lib/math/vector.h +++ b/lib/math/vector.h @@ -1,7 +1,7 @@ // $Id$ // // SuperTux - A Jump'n Run -// Copyright (C) 2004 Matthias Braun // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -20,8 +20,6 @@ #ifndef SUPERTUX_VECTOR_H #define SUPERTUX_VECTOR_H -#include "../special/base.h" - namespace SuperTux { @@ -36,9 +34,6 @@ namespace SuperTux Vector(const Vector& other) : x(other.x), y(other.y) { } - Vector(const base_type& base) - : x(base.x), y(base.y) - { } Vector() : x(0), y(0) { } @@ -48,6 +43,11 @@ namespace SuperTux return x == other.x && y == other.y; } + bool operator !=(const Vector& other) const + { + return !(x == other.x && y == other.y); + } + const Vector& operator=(const Vector& other) { x = other.x; @@ -87,6 +87,20 @@ namespace SuperTux return *this; } + const Vector& operator *=(float val) + { + x *= val; + y *= val; + return *this; + } + + const Vector& operator /=(float val) + { + x /= val; + y /= val; + return *this; + } + /// Scalar product of 2 vectors float operator*(const Vector& other) const {