示例#1
0
    // These are C# 'event' handlers.
    public void redraw_main_window(object sender, Wimp.RedrawEventArgs e)
    {
        ColourTrans.SetGCOL(ColourTrans.FullRed, OS.GCOLAction.Replace_FG);
        OS.PlotCircleFill(e.Origin.X + 1000, e.Origin.Y + 1000, 400);
        ColourTrans.SetGCOL(ColourTrans.FullGreen, OS.GCOLAction.Replace_FG);
        OS.PlotLine(e.Origin.X, e.Origin.Y, e.Origin.X + 2000, e.Origin.Y + 2000);
        ColourTrans.SetGCOL(ColourTrans.FullBlue, OS.GCOLAction.Replace_FG);
        OS.PlotLine(e.Origin.X, e.Origin.Y + 2000, e.Origin.X + 2000, e.Origin.Y);

        ColourTrans.SetFontColours(ColourTrans.White, ColourTrans.FullBlue, 7);
        main_font.Paint("CSharp string",
                        Font.PlotType.OSUnits,
                        e.Origin.X + 100,
                        e.Origin.Y + 1000,
                        0);          // Length ignored (paint whole string) if bit 7 of flags not set


        ColourTrans.SetFontColours(ColourTrans.White, ColourTrans.Black, 7);
        main_font.Paint("CSharp string rotated",
                        0,          // Coords are in millipoints
                        (e.Origin.X + 1000) * 400,
                        (e.Origin.Y + 1000) * 400,
                        matrix,
                        0);          // Length ignored (paint whole string) if bit 7 of flags not set
    }
示例#2
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;
            }
        }
示例#3
0
            // For a derived class, it is recommended to override the event notifier rather
            // than subscribe to the event.
            protected override void OnPaint(Wimp.RedrawEventArgs e)
            {
                if (ColourSetBy == ColourSetter.Dialogue)
                {
                    ColourTrans.SetFontColours(ColourTrans.White, font_palette_colour, 7);
                }
                else if (ColourSetBy == ColourSetter.Menu)
                {
                    Wimp.SetFontColours((int)OS.DesktopColour.White, (int)font_wimp_colour);
                }
                font.Paint(Text,
                           Font.PlotType.OSUnits,
                           e.Origin.X + 10,
                           e.Origin.Y - 100,
                           0);                  // Length ignored (paint whole string) if bit 7 of flags not set

                // Technically, we should call the base method to ensure that event subscribers
                // are also notified of this event, but I don't think that's necessary in this
                // case.

                // base.OnPaint (e);
            }