Forum: Programmieren allgemein
by Lyan,
19. Dez 2014
type
vec2 = packed record
x,y:double;
constructor Create(xi, yi: Double);
class operator add(v1, v2: vec2): vec2;
class operator subtract(v1, v2: vec2): vec2;
class operator multyply(d : double; v1 : vec2): vec2;
end;
TMainFrm = class(TForm)
Forum: Programmieren allgemein
by Lyan,
19. Dez 2014
struct vec2 {
float x, y;
vec2(float x, float y)
{
x = x;
y = y;
}
};
Also wäre das das gleiche, okay vielen Dank, hätte ich auch selbst drauf kommen können >.<
Forum: Programmieren allgemein
by Lyan,
19. Dez 2014
struct vec2 {
float x, y;
vec2(float x, float y) : x(x), y(y) {}
};
vec2 operator + (vec2 a, vec2 b) {
return vec2(a.x + b.x, a.y + b.y);
}
vec2 operator - (vec2 a, vec2 b) {