Skip to content

Instantly share code, notes, and snippets.

@marihachi
Last active March 2, 2016 07:21
Show Gist options
  • Save marihachi/cdbc1a6b1c26b98c78c9 to your computer and use it in GitHub Desktop.
Save marihachi/cdbc1a6b1c26b98c78c9 to your computer and use it in GitHub Desktop.
DxSharpのサンプルコード
using System;
using System.Drawing;
using System.Windows.Forms;
namespace DxSharp.Sample
{
public static class Program
{
public static void Main()
{
try
{
// ライブラリの初期化
using (var core = SystemCore.Initialize(new Size(1280, 720), Color.White, "DxSharp Sample"))
{
var imageStorage = Storage.ImageStorage.Instance;
var input = Utility.Input.Instance;
// 画像読み込み
imageStorage.Add("test-image", new Data.Image("test.png"));
var testImage = imageStorage.Item("test-image");
// メインループ
while (core.Update())
{
// 上方向キーの入力
if (input.GetKey(Data.KeyType.Up).InputTime == 1)
testImage.Opacity = 100;
// 下方向キーの入力
if (input.GetKey(Data.KeyType.Down).InputTime == 1)
testImage.Opacity = 0;
// 画像表示(※FadeTime が0より大きく設定されている時は Opacity プロパティの設定をトリガとしてフェード処理が開始されます。)
testImage.Draw(new Point(0, 0));
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, ex.GetType().Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment