Fluid rendering in graphics
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
import { EverythingRegistry, type ItemRegistry } from "$/common/everything_registry.ts";
|
||||
import { ItemStack } from "$/common/inventory.ts";
|
||||
import type { Color, Graphics } from "$/common/mod_api/client.ts";
|
||||
import type { KeyCode } from "$/common/mod_api/shared.ts";
|
||||
import type { FluidVariant, KeyCode } from "$/common/mod_api/shared.ts";
|
||||
import { point_inside_rec } from "$/common/utils.ts";
|
||||
import { AssetManager } from "$/client/assets.ts";
|
||||
import { InputManager, type KeyCode as InputKey } from "$/client/input_manager.ts";
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
measure_text,
|
||||
Texture,
|
||||
} from "$/client/renderer/mod.ts";
|
||||
import { draw_item } from "$/client/rendering/render_utils.ts";
|
||||
import { draw_fluid, draw_item } from "$/client/rendering/render_utils.ts";
|
||||
import { get_sprite_region } from "$/client/sprites.ts";
|
||||
import { draw_tooltip, item_tooltip, type TooltipLine } from "./tooltip.ts";
|
||||
import { TEXT_HEIGHT, TEXT_SCALE, TextInput } from "./widgets.ts";
|
||||
@@ -164,6 +164,10 @@ export class ModGraphics implements Graphics {
|
||||
draw_item(stack, this.#x(x), this.#y(y), count !== 1 && stack.max_amount !== 1);
|
||||
}
|
||||
|
||||
fluid(fluid: FluidVariant, x: number, y: number, filled = 1) {
|
||||
draw_fluid(fluid, this.#x(x), this.#y(y), filled);
|
||||
}
|
||||
|
||||
clip(x: number, y: number, w: number, h: number, draw: () => void) {
|
||||
this.#clip_canvas(this.#x(x), this.#y(y), w * S, h * S, draw);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user