Ejemplo n.º 1
0
        void Init()
        {
            int[] mess_list = { 0 };

            Initialise(350, "Test App", mess_list);

            Heap = new OS.DynamicAreaHeap("C# Sprites",
                                          4 * 1024,                             // 4KB Initial
                                          10 * 1024 * 1024);                    // 10MB Max

            // Allocate 1MB of memory from the dynamic area to use as a sprite area.
            var sprite_area = Heap.Alloc(1 * 1024 * 1024);

            SpriteArea = new OSSpriteOp.SpriteArea(sprite_area, 1 * 1024 * 1024);

            CreateSprite();

            Wimp.WindowAttributes attributes = new Wimp.WindowAttributes("CSharp Sprites");
            attributes.WorkArea    = new OS.Rect(0, 0, 2000, 2000);
            attributes.UserRedrawn = true;

            SpriteWindow window = new SpriteWindow(Sprites,
                                                   attributes);

            // Use a lambda expression for the Quit handler.
            window.Closed += (sender, e) => Quit = true;

            window.Open(new OS.Rect(100, 100, 2000, 1500),                      // Visible area
                        new OS.Coord(0, 2000),                                  // Scroll offsets
                        Wimp.WindowStackPosition.Top);
        }
Ejemplo n.º 2
0
            public TestSprite(OSSpriteOp.SpriteArea spriteArea, string name, bool palette,
                              int width, int height, int mode)
                : base(spriteArea, name, palette, width, height, mode)
            {
                int buffer_size = GetTransTableSize(ColourTrans.CurrentMode,
                                                    ColourTrans.CurrentPalette,
                                                    false);

                if (buffer_size != 0)
                {
                    TransTable = SpriteTask.Heap.Alloc(buffer_size);
                    GetTransTable(TransTable,
                                  ColourTrans.CurrentMode,
                                  ColourTrans.CurrentPalette,
                                  false);
                }
            }