From bf85f90837b14b76f7df62fba43d9436cb387325 Mon Sep 17 00:00:00 2001 From: cha0s Date: Thu, 13 Jun 2024 15:46:56 -0500 Subject: [PATCH] ui: tweaks --- app/react-components/dom.jsx | 7 ++++++- app/react-components/hotbar.module.css | 12 +++++++----- app/react-components/pixi.jsx | 4 ++++ app/react-components/slot.module.css | 25 +++++++++++++------------ 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/app/react-components/dom.jsx b/app/react-components/dom.jsx index 73c627c..6643941 100644 --- a/app/react-components/dom.jsx +++ b/app/react-components/dom.jsx @@ -28,7 +28,12 @@ export default function Dom({children}) { return (
{scale > 0 && ( - + )} {children}
diff --git a/app/react-components/hotbar.module.css b/app/react-components/hotbar.module.css index e684def..9ccd027 100644 --- a/app/react-components/hotbar.module.css +++ b/app/react-components/hotbar.module.css @@ -1,15 +1,17 @@ .hotbar { - border: 2px solid #999999; + --border: calc(var(--unit) * 3px); + background-color: rgba(0, 0, 0, 0.2); + border: var(--border) solid #444444; box-sizing: border-box; display: inline-block; - left: 135px; + left: calc(var(--unit) * 225px); line-height: 0; position: absolute; - top: 20px; + top: calc(var(--unit) * 25px); } .slotWrapper { - border: 2px solid #999999; + border: var(--border) solid #999999; box-sizing: border-box; display: inline-block; line-height: 0; @@ -19,7 +21,7 @@ } &:hover { - background-color: rgba(0, 0, 0, 0.1); + background-color: rgba(0, 0, 0, 0.2); cursor: pointer; } } diff --git a/app/react-components/pixi.jsx b/app/react-components/pixi.jsx index a6879e7..7f688a1 100644 --- a/app/react-components/pixi.jsx +++ b/app/react-components/pixi.jsx @@ -1,6 +1,8 @@ import { Stage as PixiStage, } from '@pixi/react'; +import {SCALE_MODES} from '@pixi/constants'; +import {settings} from '@pixi/settings'; import {RESOLUTION} from '@/constants.js'; import ClientContext from '@/context/client.js'; @@ -8,6 +10,8 @@ import ClientContext from '@/context/client.js'; import Ecs from './ecs.jsx'; import styles from './pixi.module.css'; +settings.SCALE_MODE = SCALE_MODES.NEAREST; + const ContextBridge = ({ children, Context, render }) => { return ( diff --git a/app/react-components/slot.module.css b/app/react-components/slot.module.css index 21a8894..5abd469 100644 --- a/app/react-components/slot.module.css +++ b/app/react-components/slot.module.css @@ -1,32 +1,33 @@ .slot { - --size: 35px; - --base: calc(var(--size) / 5); + --size: calc(var(--unit) * 50px); + --space: calc(var(--unit) * 10px); background-position: center; background-repeat: no-repeat; background-size: contain; - box-sizing: border-box; display: inline-block; + height: var(--size); image-rendering: pixelated; - padding: var(--base); user-select: none; + width: var(--size); } .slotInner { background-position: center; background-repeat: no-repeat; background-size: contain; - height: calc(var(--base) * 5); + height: calc(100% - var(--space) * 2); + padding: var(--space); position: relative; - width: calc(var(--base) * 5); + width: calc(100% - var(--space) * 2); } .qty { - bottom: calc(var(--base) / -1.25); + bottom: calc(var(--space) / -1.25); font-family: monospace; - font-size: calc(var(--base) * 2); + font-size: calc(var(--space) * 2); line-height: 1; position: absolute; - right: calc(var(--base) / -1.25); + right: calc(var(--space) / -1.25); text-shadow: 0px -1px 0px white, 1px 0px 0px white, @@ -34,12 +35,12 @@ -1px 0px 0px white ; &:global(.q-2) { - font-size: calc(var(--base) * 1.75); + font-size: calc(var(--space) * 1.75); } &:global(.q-3) { - font-size: calc(var(--base) * 1.5); + font-size: calc(var(--space) * 1.5); } &:global(.q-4) { - font-size: calc(var(--base) * 1.25); + font-size: calc(var(--space) * 1.25); } }