コード例 #1
0
ファイル: GDIGraphic.cs プロジェクト: timik44452/2DGameEngine
    public static GDIGraphic Create(int width, int height, HandleRef handle)
    {
        float size_unit = height * 0.08F;

        GDIGraphic graphic = new GDIGraphic();

        graphic.width  = width;
        graphic.height = height;
        graphic.info   = GDIHelper.CreateBitmapinfo(width, height);
        graphic.handle = handle;

        graphic.frame = new int[width * height];
        graphic.depth = new int[width * height];

        graphic.worldViewMatrix = new Matrix3x3(
            size_unit, 0, width / 2,
            0, size_unit, height / 2,
            0, 0, 1);

        graphic.screenViewMatrix = new Matrix3x3(
            width, 0, width / 2,
            0, height, height / 2,
            0, 0, 1);

        init(ref graphic.frame[0], ref graphic.depth[0], width, height);

        return(graphic);
    }
コード例 #2
0
ファイル: RendererBox.cs プロジェクト: timik44452/Simple3DSR
        public void InitGDI(int Width, int Height)
        {
            try
            {
                var graphics = CreateGraphics();

                width  = Width;
                height = Height;

                info   = GDIHelper.CreateBitmapinfo(width, height);
                handle = new HandleRef(graphics, graphics.GetHdc());

                isInitialized = true;
            }
            catch (Exception e)
            {
            }
        }