4
1
mirror of https://github.com/QuasarApp/Snake.git synced 2025-04-30 11:44:42 +00:00
Snake/front-end/GraphicItem.qml

29 lines
701 B
QML
Raw Normal View History

2018-11-14 23:15:36 +03:00
import QtQuick 2.9
Rectangle {
id: graphicItem
property var model: null
property real angle: (model) ? model.angle : 0;
property string texture: (model) ? model.texture : "";
property int guiId: (model) ? model.color : -1;
2018-11-25 03:24:41 +03:00
property double devX: width / 2
property double devY: height / 2
2018-11-16 20:01:47 +03:00
2018-11-14 23:15:36 +03:00
color: (model) ? model.color : "#11ff32";
2018-11-16 20:01:47 +03:00
2018-11-25 03:24:41 +03:00
width: (model) ? model.w * mainWindow.point: 0;
height: (model) ? model.h * mainWindow.point: 0;
2018-11-16 20:01:47 +03:00
2018-11-25 03:24:41 +03:00
x: (model) ? model.x * mainWindow.point - devX: 0;
y: (model) ? model.y * mainWindow.point - devY: 0;
2018-11-14 23:15:36 +03:00
transform: Rotation {
2018-11-25 03:24:41 +03:00
origin.x: devX;
origin.y: devY;
2018-11-14 23:15:36 +03:00
angle: graphicItem.angle;
}
2018-11-16 02:21:27 +03:00
2018-11-14 23:15:36 +03:00
}