[client] gamepad: update SmartActionAreaBuilder
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tankz",
|
||||
"version": "0.16.8",
|
||||
"version": "0.16.9",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"dateformat": "^3.0.3",
|
||||
|
||||
31
sql/init.sql
31
sql/init.sql
@@ -1,31 +0,0 @@
|
||||
-- mysql -u shmyga -pxkbp8jh9z2 armageddon --protocol TCP
|
||||
CREATE USER 'shmyga'@'localhost' IDENTIFIED BY 'xkbp8jh9z2';
|
||||
|
||||
DROP DATABASE IF EXISTS armageddon;
|
||||
CREATE DATABASE IF NOT EXISTS armageddon;
|
||||
GRANT ALL ON armageddon.* TO 'shmyga'@'localhost' IDENTIFIED BY 'xkbp8jh9z2';
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS armageddon.account;
|
||||
CREATE TABLE IF NOT EXISTS armageddon.account (
|
||||
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
|
||||
login VARCHAR(255) UNIQUE,
|
||||
password VARCHAR(32)
|
||||
);
|
||||
|
||||
DROP TABLE IF EXISTS armageddon.person;
|
||||
CREATE TABLE IF NOT EXISTS armageddon.person (
|
||||
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
|
||||
account_id INT UNSIGNED NOT NULL,
|
||||
name VARCHAR(255),
|
||||
|
||||
CONSTRAINT person_2_account FOREIGN KEY (account_id) REFERENCES armageddon.account(id)
|
||||
MATCH SIMPLE ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
);
|
||||
|
||||
INSERT INTO armageddon.account (id,login,password) VALUES(1,'shmyga', 'd48cc4eb42c058869ae90daef9606e43');
|
||||
INSERT INTO armageddon.person (id,account_id,name) VALUES(1,1,'-=Shmyga=-');
|
||||
|
||||
INSERT INTO armageddon.account (id,login,password) VALUES(2,'a', md5('a'));
|
||||
INSERT INTO armageddon.person (id,account_id,name) VALUES(2,2,'a');
|
||||
|
||||
@@ -50,6 +50,7 @@ class SettingsStorage extends SharedObjectStorage {
|
||||
MOVE(Direction.RIGHT) => null,
|
||||
SHOT(0) => null,
|
||||
SHOT(1) => null,
|
||||
SHOT(2) => null,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ views:
|
||||
- $type: haxework.view.form.ButtonView
|
||||
style: button.close
|
||||
geometry.position: absolute
|
||||
geometry.hAlign: right
|
||||
geometry.vAlign: bottom
|
||||
geometry.hAlign: left
|
||||
geometry.vAlign: top
|
||||
geometry.margin: 10
|
||||
+onPress: ~close()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.m.tankz.view.gamepad;
|
||||
|
||||
import haxework.view.geometry.Box;
|
||||
import ru.m.control.DeviceAction;
|
||||
import ru.m.geom.Circle;
|
||||
import ru.m.geom.Direction;
|
||||
@@ -12,36 +13,36 @@ class SmartActionAreaBuilder implements IActionAreaBuilder {
|
||||
public function build(width:Float, height:Float):Array<IActionArea> {
|
||||
var areas:Array<IActionArea> = [];
|
||||
var size = Math.min(width, height) / 5;
|
||||
var padding = size / 3;
|
||||
var padding = Box.fromArray([size / 4, size / 3]);
|
||||
// top
|
||||
areas.push(new RhombusActionArea(
|
||||
DIRECTION(Direction.TOP),
|
||||
new Rectangle(padding + size * 0.5, height - size * 2 - padding, size, size )
|
||||
new Rectangle(padding.left + size * 0.5, height - size * 2 - padding.bottom, size, size )
|
||||
));
|
||||
// left
|
||||
areas.push(new RhombusActionArea(
|
||||
DIRECTION(Direction.LEFT),
|
||||
new Rectangle(padding, height - size * 1.5 - padding, size, size)
|
||||
new Rectangle(padding.left, height - size * 1.5 - padding.bottom, size, size)
|
||||
));
|
||||
// bottom
|
||||
areas.push(new RhombusActionArea(
|
||||
DIRECTION(Direction.BOTTOM),
|
||||
new Rectangle(padding + size * 0.5, height - size - padding, size, size)
|
||||
new Rectangle(padding.left + size * 0.5, height - size - padding.bottom, size, size)
|
||||
));
|
||||
// right
|
||||
areas.push(new RhombusActionArea(
|
||||
DIRECTION(Direction.RIGHT),
|
||||
new Rectangle(padding + size, height - size * 1.5 - padding, size, size)
|
||||
new Rectangle(padding.left + size, height - size * 1.5 - padding.bottom, size, size)
|
||||
));
|
||||
// key 0
|
||||
areas.push(new CircleActionArea(
|
||||
KEY(0),
|
||||
new Circle(width - size * 1 - padding, height - size * 0.5 - padding, size / 2)
|
||||
new Circle(width - size * 0.5 - padding.right, height - size * 0.5 - padding.bottom, size / 2)
|
||||
));
|
||||
// key 1
|
||||
areas.push(new CircleActionArea(
|
||||
KEY(1),
|
||||
new Circle(width - size * 1 - padding, height - size * 1.5 - padding, size / 2)
|
||||
new Circle(width - size * 0.5 - padding.right, height - size * 1.5 - padding.bottom, size / 2)
|
||||
));
|
||||
return areas;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user