mirror of
https://codeberg.org/demostf/frontend.git
synced 2026-06-03 18:24:12 +02:00
render cart
This commit is contained in:
parent
c96f2e6b7b
commit
a4d835f0c6
9 changed files with 97 additions and 12 deletions
|
|
@ -2,14 +2,16 @@ import {Player as PlayerDot} from './Render/Player';
|
|||
import {Building as BuildingDot} from './Render/Building';
|
||||
import {Projectile as ProjectileDot} from './Render/Projectile';
|
||||
import {findMapAlias} from './MapBoundries';
|
||||
import {PlayerState, Header, WorldBoundaries, BuildingState, ProjectileState} from "./Data/Parser";
|
||||
import {PlayerState, Header, WorldBoundaries, BuildingState, ProjectileState, CartState} from "./Data/Parser";
|
||||
import {Show} from "solid-js";
|
||||
import {Projectile} from "./Render/Cart";
|
||||
|
||||
export interface MapRenderProps {
|
||||
header: Header;
|
||||
players: PlayerState[];
|
||||
buildings: BuildingState[];
|
||||
projectiles: ProjectileState[];
|
||||
cart: CartState | null;
|
||||
size: {
|
||||
width: number;
|
||||
height: number;
|
||||
|
|
@ -27,6 +29,8 @@ export function MapRender(props: MapRenderProps) {
|
|||
const image = `${map_root}images/${mapAlias}.webp`;
|
||||
const background = `url(${image})`;
|
||||
|
||||
console.log(props.cart);
|
||||
|
||||
return (
|
||||
<svg class="map-background" width={props.size.width} height={props.size.height}
|
||||
style={{"background-image": background}}>
|
||||
|
|
@ -73,6 +77,10 @@ export function MapRender(props: MapRenderProps) {
|
|||
scale={props.scale}/>
|
||||
</Show>
|
||||
}</For>
|
||||
<Show when={props.cart}>
|
||||
<Projectile cart={props.cart} mapBoundary={props.world} targetSize={props.size}
|
||||
scale={props.scale}/>
|
||||
</Show>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue