-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
48 lines (37 loc) · 1.57 KB
/
Copy pathProgram.cs
File metadata and controls
48 lines (37 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using Aup2Drawer;
using Aup2Drawer.Renderer;
using Raylib_cs;
using System.Diagnostics;
// --- 1. パース ---
var parser = new AupParser();
var project = parser.Parse("path/to/your/animation.aup2"); // path/to/your/animation.aup2の部分は描画したいaup2ファイルのパスに置換
// --- 2. 初期化 ---
Raylib.InitWindow(project.Width, project.Height, "Aup2Drawer Example");
// アプリケーション自体のFPSを設定 (アニメーションのFPSとは独立)
Raylib.SetTargetFPS(120);
// --- レンダラーの初期化オプション ---
// 例1: ループ再生する。
var renderer = new AupRenderer(project, isLooping: true);
// 例2: ループせず、再生が終了したら停止
// var renderer = new AupRenderer(project, isLooping: false);
// 再生開始
renderer.Play();
// --- 3. メインループ ---
while (!Raylib.WindowShouldClose())
{
renderer.Update();
// --- 描画 ---
Raylib.BeginDrawing();
Raylib.BeginBlendMode(BlendMode.Alpha); // 内部でrlgl.SrtBlendMode()を用いて合成モードを切り替えているので、これがないと合成モードが正しく切り替わらない
Raylib.ClearBackground(Color.Black);
// --- 描画位置の指定 ---
// 例1: ウィンドウの中央に描画する
float drawPosX = (Raylib.GetScreenWidth() - project.Width) / 2.0f;
float drawPosY = (Raylib.GetScreenHeight() - project.Height) / 2.0f;
renderer.Draw(drawPosX, drawPosY);
Raylib.EndBlendMode();
Raylib.EndDrawing();
}
// --- 4. クリーンアップ ---
renderer.Dispose();
Raylib.CloseWindow();