-
Notifications
You must be signed in to change notification settings - Fork 0
/
body.h
28 lines (25 loc) · 1001 Bytes
/
body.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
#include "system.h"
class Body : public System{ //êëàññ êîòîðûé ñëóæèò îñíîâîé äëÿ âñåõ äðóãèõ êëàññîâ ñ ãðàôèêîé
protected:
int w, h; //øèðèíà, âûñîòà
RectangleShape shape; //òåêñòóðà
int wTexture, hTexture; //÷òî áû ìàñøòàáèðîâàòü òåêñòóðó, íóæíî çíàòü êàêîé èìåííî êóñîê òàéëà ìàñøòàáèðîâàòü
public:
int x, y; //êîîðäèíàòû
String name; //èìÿ
public:
Body (Texture *tmpTexture, String Name, int X, int Y, int W, int H, int WTexture, int HTexture){ //êîíñòðóêòîð ñ òåêñòóðîé
x = X; y = Y; w = W; h = H; name = Name;
wTexture = WTexture; hTexture = HTexture;
shape.setSize (Vector2f ((float) w, (float) h));
shape.setPosition ((float) x, (float) y);
shape.setTexture (tmpTexture);
shape.setTextureRect (IntRect (0, 0, wTexture, hTexture));
}
Body (String Name, int X, int Y, int W, int H, int WTexture, int HTexture){ //êîíñòðóêòîð áåç òåêñòóðû
x = X; y = Y; w = W; h = H; name = Name;
wTexture = WTexture; hTexture = HTexture;
}
virtual void draw () = 0;
};