mirror of
https://github.com/Kapendev/parin.git
synced 2025-04-26 13:09:56 +03:00
22 lines
535 B
D
22 lines
535 B
D
/// This example shows how to draw a 9-patch texture in Parin.
|
|
|
|
import parin;
|
|
|
|
auto atlas = TextureId();
|
|
auto patchAtlasArea = Rect(5 * 16, 1 * 16, Vec2(16 * 3));
|
|
|
|
void ready() {
|
|
lockResolution(320, 180);
|
|
atlas = loadTexture("parin_atlas.png");
|
|
}
|
|
|
|
bool update(float dt) {
|
|
auto start = Vec2(8);
|
|
// Draw a 9-patch texture with a size based on the mouse position.
|
|
drawTexturePatch(atlas, patchAtlasArea, Rect(start, mouse - start), true);
|
|
return false;
|
|
}
|
|
|
|
void finish() { }
|
|
|
|
mixin runGame!(ready, update, finish);
|