fix bug and make scaling look tight
This commit is contained in:
parent
caf827e42b
commit
96f31346c5
@ -1,45 +1,45 @@
|
|||||||
// POSITIONING FNS
|
// POSITIONING FNS
|
||||||
// floors prevent subpixel rendering which looks trash
|
// floors prevent subpixel rendering which looks trash
|
||||||
|
|
||||||
const CANVAS_WIDTH = 1600;
|
const CANVAS_WIDTH = () => Math.floor(window.innerHeight * 1.6);
|
||||||
const CANVAS_HEIGHT = 1000;
|
const CANVAS_HEIGHT = () => Math.floor(window.innerHeight);
|
||||||
|
|
||||||
const headerWidth = () => CANVAS_WIDTH;
|
const headerWidth = () => CANVAS_WIDTH();
|
||||||
const headerHeight = () => Math.floor(CANVAS_HEIGHT * 0.05);
|
const headerHeight = () => Math.floor(CANVAS_HEIGHT() * 0.05);
|
||||||
|
|
||||||
|
|
||||||
const menuCrypListWidth = () => Math.floor(CANVAS_WIDTH * 0.3);
|
const menuCrypListWidth = () => Math.floor(CANVAS_WIDTH() * 0.3);
|
||||||
const menuCrypListHeight = () => Math.floor(CANVAS_HEIGHT * 0.5);
|
const menuCrypListHeight = () => Math.floor(CANVAS_HEIGHT() * 0.5);
|
||||||
const menuCrypListX = () => 0;
|
const menuCrypListX = () => 0;
|
||||||
const menuCrypListY = () => headerHeight();
|
const menuCrypListY = () => headerHeight();
|
||||||
|
|
||||||
const itemListWidth = () => Math.floor(CANVAS_WIDTH * 0.5);
|
const itemListWidth = () => Math.floor(CANVAS_WIDTH() * 0.5);
|
||||||
const itemListHeight = () => Math.floor(CANVAS_HEIGHT * 0.5);
|
const itemListHeight = () => Math.floor(CANVAS_HEIGHT() * 0.5);
|
||||||
const itemListX = () => 0;
|
const itemListX = () => 0;
|
||||||
const itemListY = () => Math.floor(CANVAS_HEIGHT * 0.5);
|
const itemListY = () => Math.floor(CANVAS_HEIGHT() * 0.5);
|
||||||
const itemBlockWidth = () => Math.floor(itemListWidth() * 0.075);
|
const itemBlockWidth = () => Math.floor(itemListWidth() * 0.075);
|
||||||
const itemBlockHeight = () => Math.floor(itemListHeight() * 0.12);
|
const itemBlockHeight = () => Math.floor(itemListHeight() * 0.12);
|
||||||
|
|
||||||
const menuNavigationWidth = () => Math.floor(CANVAS_WIDTH * 0.5);
|
const menuNavigationWidth = () => Math.floor(CANVAS_WIDTH() * 0.5);
|
||||||
const menuNavigationHeight = () => Math.floor(CANVAS_HEIGHT * 0.3);
|
const menuNavigationHeight = () => Math.floor(CANVAS_HEIGHT() * 0.3);
|
||||||
const menuNavigationX = () => Math.floor(CANVAS_WIDTH * 0.5);
|
const menuNavigationX = () => Math.floor(CANVAS_WIDTH() * 0.5);
|
||||||
const menuNavigationY = () => Math.floor(CANVAS_HEIGHT * 0.7);
|
const menuNavigationY = () => Math.floor(CANVAS_HEIGHT() * 0.7);
|
||||||
|
|
||||||
const menuMainWidth = () => Math.floor(CANVAS_WIDTH * 0.7);
|
const menuMainWidth = () => Math.floor(CANVAS_WIDTH() * 0.7);
|
||||||
const menuMainHeight = () => Math.floor(CANVAS_HEIGHT * 0.5);
|
const menuMainHeight = () => Math.floor(CANVAS_HEIGHT() * 0.5);
|
||||||
const menuMainX = () => Math.floor(CANVAS_WIDTH * 0.3);
|
const menuMainX = () => Math.floor(CANVAS_WIDTH() * 0.3);
|
||||||
const menuMainY = () => headerHeight();
|
const menuMainY = () => headerHeight();
|
||||||
|
|
||||||
|
|
||||||
const combatWidth = () => CANVAS_WIDTH;
|
const combatWidth = () => CANVAS_WIDTH();
|
||||||
const combatHeight = () => CANVAS_HEIGHT - headerHeight();
|
const combatHeight = () => CANVAS_HEIGHT() - headerHeight();
|
||||||
const combatY = () => headerHeight();
|
const combatY = () => headerHeight();
|
||||||
const combatX = () => 0;
|
const combatX = () => 0;
|
||||||
const combatCrypMargin = () => Math.floor((CANVAS_HEIGHT - headerHeight()) / 4.5);
|
const combatCrypMargin = () => Math.floor((CANVAS_HEIGHT() - headerHeight()) / 4.5);
|
||||||
const combatTextMargin = () => Math.floor((CANVAS_HEIGHT - headerHeight()) / 35);
|
const combatTextMargin = () => Math.floor((CANVAS_HEIGHT() - headerHeight()) / 35);
|
||||||
|
|
||||||
const statsWidth = () => Math.floor(CANVAS_WIDTH - menuCrypListWidth());
|
const statsWidth = () => Math.floor(CANVAS_WIDTH() - menuCrypListWidth());
|
||||||
const statsHeight = () => CANVAS_HEIGHT - headerHeight();
|
const statsHeight = () => CANVAS_HEIGHT() - headerHeight();
|
||||||
const statsY = () => headerHeight();
|
const statsY = () => headerHeight();
|
||||||
const statsX = () => menuCrypListWidth();
|
const statsX = () => menuCrypListWidth();
|
||||||
const statsKnownX = () => Math.floor(statsX() + statsWidth() / 4);
|
const statsKnownX = () => Math.floor(statsX() + statsWidth() / 4);
|
||||||
|
|||||||
@ -11,12 +11,12 @@ function renderCryps() {
|
|||||||
// backgroundColor: '#181818',
|
// backgroundColor: '#181818',
|
||||||
resolution: window.devicePixelRatio,
|
resolution: window.devicePixelRatio,
|
||||||
scale: {
|
scale: {
|
||||||
mode: Phaser.Scale.FIT,
|
mode: Phaser.Scale.RESIZE,
|
||||||
width: 1600,
|
width: Math.floor(window.innerHeight * 1.6),
|
||||||
height: 1000,
|
height: Math.floor(window.innerHeight),
|
||||||
max: {
|
max: {
|
||||||
width: window.innerHeight * 1.6,
|
width: Math.floor(window.innerHeight * 1.6),
|
||||||
height: window.innerHeight,
|
height: Math.floor(window.innerHeight),
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -61,6 +61,7 @@ function renderCryps() {
|
|||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
game.scale.displaySize.maxWidth = window.innerHeight * 1.6;
|
game.scale.displaySize.maxWidth = window.innerHeight * 1.6;
|
||||||
game.scale.displaySize.maxHeight = window.innerHeight;
|
game.scale.displaySize.maxHeight = window.innerHeight;
|
||||||
|
// game.scale.resize();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -78,6 +78,7 @@ impl Rpc {
|
|||||||
|
|
||||||
"instance_join" => Rpc::instance_join(data, &mut tx, account.unwrap(), client),
|
"instance_join" => Rpc::instance_join(data, &mut tx, account.unwrap(), client),
|
||||||
"player_state" => Rpc::player_state(data, &mut tx, account.unwrap(), client),
|
"player_state" => Rpc::player_state(data, &mut tx, account.unwrap(), client),
|
||||||
|
"player_cryps_set" => Rpc::player_cryps_set(data, &mut tx, account.unwrap(), client),
|
||||||
"player_vbox_accept" => Rpc::player_vbox_accept(data, &mut tx, account.unwrap(), client),
|
"player_vbox_accept" => Rpc::player_vbox_accept(data, &mut tx, account.unwrap(), client),
|
||||||
"player_vbox_apply" => Rpc::player_vbox_apply(data, &mut tx, account.unwrap(), client),
|
"player_vbox_apply" => Rpc::player_vbox_apply(data, &mut tx, account.unwrap(), client),
|
||||||
"player_vbox_drop" => Rpc::player_vbox_drop(data, &mut tx, account.unwrap(), client),
|
"player_vbox_drop" => Rpc::player_vbox_drop(data, &mut tx, account.unwrap(), client),
|
||||||
@ -282,7 +283,7 @@ impl Rpc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn player_cryps_set(data: Vec<u8>, tx: &mut Transaction, account: Account, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
|
fn player_cryps_set(data: Vec<u8>, tx: &mut Transaction, account: Account, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
|
||||||
let msg = from_slice::<PlayerStateMsg>(&data).or(Err(err_msg("invalid params")))?;
|
let msg = from_slice::<PlayerCrypsSetMsg>(&data).or(Err(err_msg("invalid params")))?;
|
||||||
|
|
||||||
let response = RpcResponse {
|
let response = RpcResponse {
|
||||||
method: "player_state".to_string(),
|
method: "player_state".to_string(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user