概要
cscの作法、調べてみた。
OpenRCF v2.8、見つけたので、windows11で、MSbuildしてみた。
練習問題やってみた。
練習問題
ボールをシミュレーションせよ。
写真
サンプルコード
using System;
using System.Windows;
using OpenRCF;
using Vector = OpenRCF.Vector;
namespace OpenRCF
{
partial class MainWindow: Window {
Sphere Ball = new Sphere(0.25f);
float g = 9.8f,
v0 = 6,
t,
z;
bool isMoved = false;
void Setup() {
Ball.Position[2] = Ball.Radius;
}
void Loop() {
if (isMoved)
{
t = Timer.GetElapsedTimeSec(0);
z = Ball.Radius + v0 * t - 0.5F * g * t * t;
if (Ball.Radius < z)
{
Ball.Position[2] = z;
}
else
{
Ball.Position[2] = Ball.Radius;
//isMoved = false;
v0 *= 0.8f;
Timer.SetTimeLabel(0);
}
}
}
void Draw() {
Ball.Draw();
}
void Button1_Click(object sender, RoutedEventArgs e) {
Timer.SetTimeLabel(0);
isMoved = true;
}
void Button2_Click(object sender, RoutedEventArgs e) {
}
void Button3_Click(object sender, RoutedEventArgs e) {
}
void Button4_Click(object sender, RoutedEventArgs e) {
}
void Button5_Click(object sender, RoutedEventArgs e) {
}
}
}
以上。