Exemplo n.º 1
0
        void CreateSprite()
        {
            try {
                int sprite_type = OSSpriteOp.GenerateOldSpriteType(OS.PixelDepth.BPP24,
                                                                   OSSpriteOp.SpriteDpi.Dpi90,
                                                                   OSSpriteOp.SpriteDpi.Dpi90,
                                                                   false);
                var sprite = new TestSprite(SpriteArea,
                                            "sprite1",
                                            false,
                                            50,
                                            50,
                                            sprite_type);

                OSSpriteOp.RedirectContext context = sprite.SwitchTo(IntPtr.Zero);

                // Make sure that if any errors occur, output is directed back to the
                // screen.
                try {
                    for (int x = 0; x < 100; x++)
                    {
                        uint red = (uint)((256 * x) / 256) + 30;

                        ColourTrans.SetGCOL(red << ColourTrans.RedShift,
                                            OS.GCOLAction.Replace_FG);
                        OS.PlotLine(x, 0, x, 100);
                    }

                    Sprites.Add(sprite);
                    MsgModeChange += sprite.ModeChangeHandler;
                }
                catch {
                    throw;
                }
                finally {
                    sprite.SwitchFrom(context);
                }
            }
            catch {
                throw;
            }
        }
Exemplo n.º 2
0
 public TestBoxDrawNode(TestSprite source, TextureUnit unit)
     : base(source)
 {
     this.unit = unit;
 }