import Tile from "@/components/common/Tile";
import { GBA } from "@/lib/gba";
import {
Badge,
Box,
Group,
Modal,
Paper,
SimpleGrid,
Stack,
Text,
ThemeIcon,
} from "@mantine/core";
import {
IconArrowsMaximize,
IconBlocks,
IconCube,
IconFlipHorizontal,
IconFlipVertical,
IconFocus2,
IconGrid4x4,
IconLayersIntersect,
IconPalette,
} from "@tabler/icons-react";
import { ObjMode, type Obj } from "boya_wasm";
import ColorView from "../memory/ColorView";
const objModeMap = {
[ObjMode.Normal]: "normal",
[ObjMode.Window]: "window",
[ObjMode.SemiTransparent]: "semi-transparent",
};
function ObjectModal(props: {
id: number;
object: Obj;
opened: boolean;
onClose: () => void;
}) {
const { object: obj } = props;
const flags = [
{
label: "Transform",
value: obj.transform,
icon: ,
},
{
label: "V-Flip",
value: obj.vflip,
icon: ,
},
{
label: "H-Flip",
value: obj.hflip,
icon: ,
},
{
label: "Mosaic",
value: obj.mosaic,
icon: ,
},
{
label: "Double",
value: obj.double_size,
icon: ,
},
];
return (
#{props.id}}
centered
size="md"
radius="md"
>
GBA.renderObj(props.id)}
width={obj.width * 8}
height={obj.height * 8}
innerWidth={obj.width}
innerHeight={obj.height}
checkerboard
/>
{obj.width * 8} × {obj.height * 8} px
Position
X: {obj.x} Y: {obj.y}
Priority
Level {obj.priority}
Character
{obj.character.toString()}
Mode
{objModeMap[obj.mode]}
Palette
({obj.color_mode === 0 ? "16" : "256"} colors)
{obj.color_mode === 0 && (
Index {obj.palette}
)}
Attributes
{flags.map((f) => (
{f.label}
))}
);
}
export default ObjectModal;