コード例 #1
0
    public void Run()
    {
        // Altseedを初期化する。
        asd.Engine.Initialize("TextureObject2D_Basic", 640, 480, new asd.EngineOption());

        // 画像を読み込む。
        asd.Texture2D texture = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Picture1.png");

        // 画像描画オブジェクトのインスタンスを生成する。
        asd.TextureObject2D obj = new asd.TextureObject2D();

        // 描画される画像を設定する。
        obj.Texture = texture;

        // 描画位置を指定する。
        obj.Position = new asd.Vector2DF(50, 50);

        // 画像描画オブジェクトのインスタンスをエンジンに追加する。
        asd.Engine.AddObject2D(obj);

        // Altseedのウインドウが閉じられていないか確認する。
        while (asd.Engine.DoEvents())
        {
            // Altseedを更新する。
            asd.Engine.Update();
            Recorder.TakeScreenShot("TextureObject2D_Basic", 5);
        }

        // Altseedの終了処理をする。
        asd.Engine.Terminate();
    }
コード例 #2
0
        private unsafe void Render(asd.Texture2D destination, asd.Texture2D source)
        {
            var dstWidth  = destination.Size.X;
            var dstHeight = destination.Size.Y;
            var srcWidth  = source.Size.X;
            var srcHeight = source.Size.Y;

            var dstLock = new asd.TextureLockInfomation();
            var srcLock = new asd.TextureLockInfomation();

            destination.Lock(dstLock);
            source.Lock(srcLock);

            asd.Color *p = (asd.Color *)srcLock.Pixels.ToPointer();

            for (int y = 0; y < dstHeight && y < srcHeight; y++)
            {
                for (int x = 0; x < dstWidth && x < srcWidth; x++)
                {
                    var src = *(p + x + y * srcWidth);
                    var dst = (asd.Color *)dstLock.Pixels + x + y * dstWidth;

                    *dst = src;
                }
            }

            source.Unlock();
            destination.Unlock();
        }
コード例 #3
0
    public void Run()
    {
        // Altseedを初期化する。
        asd.Engine.Initialize("ImagePackageUI_Basic", 640, 480, new asd.EngineOption());

        // イメージパッケージを読み込む
        asd.ImagePackage imagePackage = asd.Engine.Graphics.CreateImagePackage("Data/ImagePackage/UI.aip");

        for (int i = 0; i < imagePackage.ImageCount; i++)
        {
            // テクスチャを取り出す
            asd.Texture2D texture = imagePackage.GetImage(i);
            asd.RectI     area    = imagePackage.GetImageArea(i);

            // テクスチャをオブジェクトとして追加する
            asd.TextureObject2D textureObject2D = new asd.TextureObject2D();
            textureObject2D.Texture  = texture;
            textureObject2D.Position = new asd.Vector2DF(area.X, area.Y);
            asd.Engine.AddObject2D(textureObject2D);
        }

        // Altseedのウインドウが閉じられていないか確認する。
        while (asd.Engine.DoEvents())
        {
            // Altseedを更新する。
            asd.Engine.Update();
            Recorder.TakeScreenShot("ImagePackageUI_Basic", 5);
        }

        // Altseedの終了処理をする。
        asd.Engine.Terminate();
    }
コード例 #4
0
 internal void DrawSpriteAdditionally_(asd.Vector2DF upperLeftPos,
                                       asd.Vector2DF upperRightPos,
                                       asd.Vector2DF lowerRightPos,
                                       asd.Vector2DF lowerLeftPos,
                                       asd.Color upperLeftCol,
                                       asd.Color upperRightCol,
                                       asd.Color lowerRightCol,
                                       asd.Color lowerLeftCol,
                                       asd.Vector2DF upperLeftUV,
                                       asd.Vector2DF upperRightUV,
                                       asd.Vector2DF lowerRightUV,
                                       asd.Vector2DF lowerLeftUV,
                                       asd.Texture2D texture,
                                       asd.AlphaBlendMode alphaBlend,
                                       int priority)
 {
     base.DrawSpriteAdditionally(upperLeftPos,
                                 upperRightPos,
                                 lowerRightPos,
                                 lowerLeftPos,
                                 upperLeftCol,
                                 upperRightCol,
                                 lowerRightCol,
                                 lowerLeftCol,
                                 upperLeftUV,
                                 upperRightUV,
                                 lowerRightUV,
                                 lowerLeftUV,
                                 texture,
                                 alphaBlend,
                                 priority);
 }
コード例 #5
0
 public static asd.Texture2D getDialogTexture()
 {
     if (_dialogTexture == null)
     {
         _dialogTexture = asd.Engine.Graphics.CreateTexture2D("dialog.png");
     }
     return(_dialogTexture);
 }
コード例 #6
0
 public static asd.Texture2D GetPaintedPicrossTexture()
 {
     if (_paintedpicrossTexture == null)
     {
         _paintedpicrossTexture = asd.Engine.Graphics.CreateTexture2D("paintsquare.png");
     }
     return(_paintedpicrossTexture);
 }
コード例 #7
0
 public static asd.Texture2D getButtonTexture()
 {
     if (_buttonTexture == null)
     {
         _buttonTexture = asd.Engine.Graphics.CreateTexture2D("button.png");
     }
     return(_buttonTexture);
 }
コード例 #8
0
 public static asd.Texture2D GetSelectedNumberTexture()
 {
     if (_selectedNumberTexture == null)
     {
         _selectedNumberTexture = asd.Engine.Graphics.CreateTexture2D("selectSquare.png");
     }
     return(_selectedNumberTexture);
 }
コード例 #9
0
 public static asd.Texture2D getPaletteTexture()
 {
     if (_paletteTexture == null)
     {
         _paletteTexture = asd.Engine.Graphics.CreateTexture2D("palette.png");
     }
     return(_paletteTexture);
 }
コード例 #10
0
ファイル: ToolScene.cs プロジェクト: wraikny/Altseed
 public void Dispose()
 {
     if (Image != null)
     {
         Image.ForceToRelease();
     }
     Image = null;
 }
コード例 #11
0
 public static asd.Texture2D getSelectedTextTexture()
 {
     if (_SelectedTextTexture == null)
     {
         _SelectedTextTexture = asd.Engine.Graphics.CreateTexture2D("text2.png");
     }
     return(_SelectedTextTexture);
 }
コード例 #12
0
 public static asd.Texture2D GetMaskedPicrossTexture()
 {
     if (_maskedpicrossTexture == null)
     {
         _maskedpicrossTexture = asd.Engine.Graphics.CreateTexture2D("masksquare.png");
     }
     return(_maskedpicrossTexture);
 }
コード例 #13
0
ファイル: Wind.cs プロジェクト: gon6109/KAMI-HIKOKI
 //共通初期化
 public static bool Init()
 {
     TextureOfWind = asd.Engine.Graphics.CreateTexture2D("Image/Wind.png");
     if (TextureOfWind == null)
     {
         return(false);
     }
     return(true);
 }
コード例 #14
0
ファイル: LoadManyTexture.cs プロジェクト: wraikny/Altseed
        private void AddTexture(asd.Vector2DF position, asd.Texture2D texture)
        {
            var obj = new asd.TextureObject2D()
            {
                Position = position,
                Texture  = texture,
            };

            asd.Engine.AddObject2D(obj);
        }
コード例 #15
0
    public unsafe void Run()
    {
        // Altseedを初期化する。
        asd.Engine.Initialize("Texture_Basic", 640, 480, new asd.EngineOption());

        // 画像を読み込む。
        asd.Texture2D texture = asd.Engine.Graphics.CreateEmptyTexture2D(256, 256, asd.TextureFormat.R8G8B8A8_UNORM_SRGB);

        // ロックして編集可能な状態にする。
        asd.TextureLockInfomation lockInfo = new asd.TextureLockInfomation();
        if (texture.Lock(lockInfo))
        {
#if LANG_CS
            // C#のみの高速処理
            for (int y = 0; y < lockInfo.Size.Y; y++)
            {
                for (int x = 0; x < lockInfo.Size.X; x++)
                {
                    var pixel = &((byte *)lockInfo.Pixels)[(x + y * lockInfo.Size.X) * lockInfo.Pitch];
                    pixel[0] = (byte)x;
                    pixel[1] = (byte)y;
                    pixel[2] = 0;
                    pixel[3] = 255;
                }
            }
#else
            System.Console.WriteLine("実装されていません。");
#endif
            // Unlockして編集結果を適用する。
            texture.Unlock();
        }

        // 画像描画オブジェクトのインスタンスを生成する。
        asd.TextureObject2D obj = new asd.TextureObject2D();

        // 描画される画像を設定する。
        obj.Texture = texture;

        // 描画位置を指定する。
        obj.Position = new asd.Vector2DF(50, 50);

        // 画像描画オブジェクトのインスタンスをエンジンに追加する。
        asd.Engine.AddObject2D(obj);

        // Altseedのウインドウが閉じられていないか確認する。
        while (asd.Engine.DoEvents())
        {
            // Altseedを更新する。
            asd.Engine.Update();
            Recorder.TakeScreenShot("Texture_Basic", 5);
        }

        // Altseedの終了処理をする。
        asd.Engine.Terminate();
    }
コード例 #16
0
 //共通初期化
 public static bool Init()
 {
     TextureOfCloud_S = asd.Engine.Graphics.CreateTexture2D("Image/Cloud_S.png");
     TextureOfCloud_M = asd.Engine.Graphics.CreateTexture2D("Image/Cloud_M.png");
     TextureOfCloud_L = asd.Engine.Graphics.CreateTexture2D("Image/Cloud_L.png");
     if (TextureOfCloud_S == null || TextureOfCloud_M == null || TextureOfCloud_L == null)
     {
         return(false);
     }
     return(true);
 }
コード例 #17
0
ファイル: Basic.cs プロジェクト: wraikny/Altseed
        protected override void OnStart()
        {
            obj = new asd.TextureObject2D()
            {
                Texture  = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Sample1.png"),
                Position = new asd.Vector2DF(10, 10),
                IsDrawn  = false,
            };
            asd.Engine.AddObject2D(obj);

            asd.Engine.OpenTool();

            texture = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Sample1.png");
        }
コード例 #18
0
    public unsafe void Run()
    {
        // Altseedを初期化する。
        asd.Engine.Initialize("Texture_Edit", 640, 480, new asd.EngineOption());

        // 画像を編集可能な状態で読み込む。
        asd.Texture2D texture = asd.Engine.Graphics.CreateEditableTexture2D("Data/Texture/Picture1.png");

        // ロックして編集可能な状態にする。
        asd.TextureLockInfomation lockInfo = new asd.TextureLockInfomation();
        if (texture.Lock(lockInfo))
        {
            for (int y = 0; y < lockInfo.Size.Y; y++)
            {
                for (int x = 0; x < lockInfo.Size.X; x++)
                {
                    var pixel = &((byte *)lockInfo.Pixels)[(x + y * lockInfo.Size.X) * lockInfo.Pitch];
                    pixel[1] = (byte)(y / 2);
                }
            }

            // Unlockして編集結果を適用する。
            texture.Unlock();
        }

        // 画像描画オブジェクトのインスタンスを生成する。
        asd.TextureObject2D obj = new asd.TextureObject2D();

        // 描画される画像を設定する。
        obj.Texture = texture;

        // 描画位置を指定する。
        obj.Position = new asd.Vector2DF(50, 50);

        // 画像描画オブジェクトのインスタンスをエンジンに追加する。
        asd.Engine.AddObject2D(obj);

        // Altseedのウインドウが閉じられていないか確認する。
        while (asd.Engine.DoEvents())
        {
            // Altseedを更新する。
            asd.Engine.Update();
            Recorder.TakeScreenShot("Texture_Edit", 5);
        }

        // Altseedの終了処理をする。
        asd.Engine.Terminate();
    }
コード例 #19
0
        protected override void OnStart()
        {
            var scene       = new asd.Scene();
            var layer       = new asd.Layer2D();
            var textureObj1 = new asd.TextureObject2D();

            texture = asd.Engine.Graphics.CreateEmptyTexture2D(1280, 720, asd.TextureFormat.R8G8B8A8_UNORM_SRGB);

            layer.AddObject(textureObj1);
            scene.AddLayer(layer);
            asd.Engine.ChangeScene(scene);

            textureObj1.Texture = texture;

            mp = asd.Engine.Graphics.CreateMediaPlayer();
            mp.Load("Data/Movie/Sample1.mp4");
            mp.Play();
        }
コード例 #20
0
        public void Run()
        {
            // aceを初期化する
            asd.Engine.Initialize("ImagePackage", 640, 480, new asd.EngineOption());

            // シーンを生成する
            var scene = new asd.Scene();

            // レイヤーを生成する
            var layer = new asd.Layer2D();

            // シーンにレイヤーを追加する
            scene.AddLayer(layer);

            // シーンを切り替える
            asd.Engine.ChangeScene(scene);

            // イメージパッケージを読み込む
            asd.ImagePackage imagePackage = asd.Engine.Graphics.CreateImagePackage("Data/ImagePackage/Game.aip");

            for (int i = 0; i < imagePackage.ImageCount; i++)
            {
                // テクスチャを取り出す
                asd.Texture2D texture = imagePackage.GetImage(i);
                asd.RectI     area    = imagePackage.GetImageArea(i);

                // テクスチャをオブジェクトとして追加する
                asd.TextureObject2D textureObject2D = new asd.TextureObject2D();
                textureObject2D.Texture  = texture;
                textureObject2D.Position = new asd.Vector2DF(area.X, area.Y);
                layer.AddObject(textureObject2D);
            }

            // aceが進行可能かチェックする。
            while (asd.Engine.DoEvents())
            {
                // aceを更新する。
                asd.Engine.Update();
            }

            // aceを終了する。
            asd.Engine.Terminate();
        }
コード例 #21
0
    public void Run()
    {
        // Altseedを初期化する。
        asd.Engine.Initialize("ImagePackageUI_Component", 640, 480, new asd.EngineOption());

        // イメージパッケージを読み込む
        asd.ImagePackage imagePackage = asd.Engine.Graphics.CreateImagePackage("Data/ImagePackage/UI.aip");

        for (int i = 0; i < imagePackage.ImageCount; i++)
        {
            // テクスチャを取り出す
            asd.Texture2D texture = imagePackage.GetImage(i);
            asd.RectI     area    = imagePackage.GetImageArea(i);

            // テクスチャをオブジェクトとして追加する
            asd.TextureObject2D textureObject2D = new asd.TextureObject2D();
            textureObject2D.Texture  = texture;
            textureObject2D.Position = new asd.Vector2DF(area.X, area.Y);
            asd.Engine.AddObject2D(textureObject2D);

            // Background_Lightという名称の画像にコンポーネントを適用する。
            if (imagePackage.GetImageName(i) == "Background_Light")
            {
                textureObject2D.AlphaBlend = asd.AlphaBlendMode.Add;
                textureObject2D.AddComponent(new ImagePackageUI_Component_AlphaAnimationComponent(), "AlphaAnimation");
            }
        }

        // Altseedのウインドウが閉じられていないか確認する。
        while (asd.Engine.DoEvents())
        {
            // Altseedを更新する。
            asd.Engine.Update();
            Recorder.CaptureScreen("ImagePackageUI_Component", 5, 16, 0.25f, 0.5f);
            Recorder.TakeScreenShot("ImagePackageUI_Component", 30);
        }

        // Altseedの終了処理をする。
        asd.Engine.Terminate();
    }
コード例 #22
0
    public unsafe void Run()
    {
        // Altseedを初期化する。
        asd.Engine.Initialize("MediaPlayer_Basic", 640, 480, new asd.EngineOption());

        // 空の画像を生成する。
        asd.Texture2D texture = asd.Engine.Graphics.CreateEmptyTexture2D(640, 480, asd.TextureFormat.R8G8B8A8_UNORM_SRGB);

        // 画像描画オブジェクトのインスタンスを生成する。
        asd.TextureObject2D obj = new asd.TextureObject2D();

        // 描画される画像を設定する。
        obj.Texture = texture;

        // 画像描画オブジェクトのインスタンスをエンジンに追加する。
        asd.Engine.AddObject2D(obj);

        // メディアプレイヤーを生成する。
        asd.MediaPlayer mp = asd.Engine.Graphics.CreateMediaPlayer();

        // 映像を読み込む。
        mp.Load("Data/Movie/Sample1.mp4");

        // 映像を再生する。
        mp.Play();

        // Altseedのウインドウが閉じられていないか確認する。
        while (asd.Engine.DoEvents())
        {
            // 映像を画像にコピーする。
            mp.WriteToTexture2D(texture);

            // Altseedを更新する。
            asd.Engine.Update();
            Recorder.TakeScreenShot("MediaPlayer_Basic", 50);
        }

        // Altseedの終了処理をする。
        asd.Engine.Terminate();
    }
コード例 #23
0
    public void Run()
    {
        // Altseedを初期化する。
        asd.Engine.Initialize("TextureObject2D_Transform", 640, 480, new asd.EngineOption());

        // 画像を読み込む。
        asd.Texture2D texture = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Picture1.png");

        // 画像描画オブジェクトのインスタンスを生成する。
        asd.TextureObject2D obj = new asd.TextureObject2D();

        // 描画される画像を設定する。
        obj.Texture = texture;

        // 描画位置を指定する。
        obj.Position = new asd.Vector2DF(320, 240);

        // 画像(サイズ 512 x 512)の中心(256 x 256 の地点)を描画の起点とする。
        obj.CenterPosition = new asd.Vector2DF(256, 256);

        // 中心を軸に画像を45度回転する。
        obj.Angle = 45;

        // 画像をX,Y方向に0.4倍に縮小する。
        obj.Scale = new asd.Vector2DF(0.4f, 0.4f);

        // 画像描画オブジェクトのインスタンスをエンジンに追加する。
        asd.Engine.AddObject2D(obj);

        // Altseedのウインドウが閉じられていないか確認する。
        while (asd.Engine.DoEvents())
        {
            // Altseedを更新する。
            asd.Engine.Update();
            Recorder.TakeScreenShot("TextureObject2D_Transform", 5);
        }

        // Altseedの終了処理をする。
        asd.Engine.Terminate();
    }
コード例 #24
0
    public InvertedDrawnObject2D()
    {
        // シェーダーをHLSL/GLSLから生成する。
        if (asd.Engine.Graphics.GraphicsDeviceType == asd.GraphicsDeviceType.DirectX11)
        {
            shader = asd.Engine.Graphics.CreateShader2D(shader2d_dx_ps);
        }
        else if (asd.Engine.Graphics.GraphicsDeviceType == asd.GraphicsDeviceType.OpenGL)
        {
            shader = asd.Engine.Graphics.CreateShader2D(shader2d_gl_ps);
        }

        // シェーダーからマテリアルを生成する。
        material2d = asd.Engine.Graphics.CreateMaterial2D(shader);

        // 画像を読み込む。
        texture = asd.Engine.Graphics.CreateTexture2D("Data/Texture/Picture1.png");

        // 画像を設定する。
        material2d.SetTexture2D("g_texture", texture);
        material2d.SetTextureFilterType("g_texture", asd.TextureFilterType.Linear);
        material2d.SetTextureWrapType("g_texture", asd.TextureWrapType.Repeat);
    }
コード例 #25
0
ファイル: Entity.cs プロジェクト: Namakeya/STG01_Start
 public virtual void SetTexture(asd.Texture2D tex)
 {
     TextureObject.Texture        = tex;
     TextureObject.CenterPosition = new asd.Vector2DF(tex.Size.X / 2f, Program.BlockSize / 2);
 }
コード例 #26
0
        public void Render()
        {
            var tool = asd.Engine.Tool;

            if (asd.Engine.Tool.BeginFullscreen("FontGenerator", 0))
            {
                var fontType = new[] { selectedFont };

                if (tool.BeginCombo("フォントの種類", fontPairs[selectedFont].Name))
                {
                    for (int i = 0; i < fontPairs.Count; i++)
                    {
                        if (tool.Selectable(fontPairs[i].Name, i == selectedFont))
                        {
                            selectedFont              = i;
                            viewModel.FontName.Value  = fontPairs[i].Name;
                            viewModel.FontIndex.Value = i;
                            tool.SetItemDefaultFocus();
                            break;
                        }
                    }
                    tool.EndCombo();
                }

                tool.InputText("文字一覧ファイル", viewModel.TextPath);
                if (tool.Button("ファイルを開く..."))
                {
                    var defaultPath = File.Exists(viewModel.TextPath.String)
                                                ? Path.GetDirectoryName(viewModel.TextPath.String)
                                                : Directory.GetCurrentDirectory();
                    viewModel.TextPath.String = tool.OpenDialog("txt", defaultPath);
                }

                tool.InputText("出力先ディレクトリ", viewModel.ExportPath);
                if (tool.Button("ディレクトリを開く..."))
                {
                    var defaultPath = Directory.Exists(viewModel.ExportPath.String)
                                                ? viewModel.ExportPath.String
                                                : Directory.GetCurrentDirectory();
                    viewModel.ExportPath.String = tool.PickFolder(defaultPath);
                }

                tool.InputText("シート名", viewModel.SheetName);
                tool.InputInt("フォントサイズ", viewModel.FontSize);
                tool.InputInt("テクスチャサイズ", viewModel.TextureSize);
                tool.InputInt("輪郭線の太さ", viewModel.OutlineSize);
                tool.InputColor("フォント色", viewModel.FontColor);
                tool.InputColor("輪郭線の色", viewModel.OutlineColor);

                if (preview != null)
                {
                    tool.Image(preview, preview.Size.To2DF());
                }

                if (tool.Button("設定ロード..."))
                {
                    var path = tool.OpenDialog("afcfg", Directory.GetCurrentDirectory());

                    if (!string.IsNullOrWhiteSpace(path))
                    {
                        converter.LoadFromModel(ConfigurationFile.Load(path), viewModel);
                        selectedFont = fontPairs.IndexOf(fontPairs.Find(x => x.Name == viewModel.FontName.Value));
                    }
                }
                if (tool.Button("設定セーブ..."))
                {
                    var path = tool.SaveDialog("afcfg", Directory.GetCurrentDirectory());

                    if (!string.IsNullOrWhiteSpace(path))
                    {
                        if (path.EndsWith(".afcfg"))
                        {
                            path += ".afcfg";
                        }

                        ConfigurationFile.Save(converter.ConvertToModel(viewModel), path);
                    }
                }
                if (!isGenerating && tool.Button("aff生成"))
                {
                    isGenerating = true;
                    statusText   = "生成中...";
                    var task = Generator.GenerateAsync(converter.ConvertToModel(viewModel));
                    task.ContinueWith(x =>
                    {
                        isGenerating = false;
                        statusText   = "生成完了";
                    }, TaskContinuationOptions.OnlyOnRanToCompletion);
                    task.ContinueWith(x =>
                    {
                        isGenerating = false;
                        if (x.Exception is AggregateException)
                        {
                            statusText = "生成失敗:" + x.Exception.InnerException.Message;
                        }
                        else
                        {
                            statusText = "生成失敗:" + x.Exception.Message;
                        }
                        Console.WriteLine(x.Exception);
                    }, TaskContinuationOptions.OnlyOnFaulted);
                }

                tool.Text(statusText);

                tool.End();

                if (isReloadRequired)
                {
                    var src = asd.Engine.Graphics.CreateEditableTexture2D(previewPath);
                    if (src != null)
                    {
                        var canvas = asd.Engine.Graphics.CreateEmptyTexture2D(320, 100, asd.TextureFormat.R8G8B8A8_UNORM_SRGB);
                        Render(canvas, src);
                        preview = canvas;
                    }
                    else
                    {
                        preview = null;
                    }
                    asd.Engine.Reload();
                    isReloadRequired = false;
                }
            }
        }
コード例 #27
0
ファイル: Resource.cs プロジェクト: akitsu-sanae/mazai-700
 static public void Init()
 {
     Font = asd.Engine.Graphics.CreateTexture2D("Resource/font.png");
 }
コード例 #28
0
 private NoiseSource(asd.Texture2D texture)
 {
     this.texture = texture;
 }
コード例 #29
0
 public static NoiseSource Texture(asd.Texture2D texture) =>
 new NoiseSource(texture);
コード例 #30
0
ファイル: Otetsuki.cs プロジェクト: hatena75/ElementalSpeed
 public Otetsuki(asd.Texture2D tex, asd.Vector2DF pos)
 {
     Texture  = tex;
     Position = pos;
 }