Beispiel #1
0
        private void DrawItem(Point screenpos, Item item, Point?drawsize)
        {
            if (item == null)
            {
                return;
            }
            Point size = dataItems.ItemSize(item);

            if (drawsize == null)
            {
                drawsize = new Point(CellDrawSize * size.X, CellDrawSize * size.Y);
            }
            if (item.ItemClass == ItemClass.Block)
            {
                the3d.Draw2dTexture(TerrainTexture, screenpos.X, screenpos.Y,
                                    drawsize.Value.X, drawsize.Value.Y, dataItems.TextureIdForInventory[item.BlockId]);
                if (item.BlockCount > 1)
                {
                    the3d.Draw2dText(item.BlockCount.ToString(), screenpos.X, screenpos.Y, 8, Color.White);
                }
            }
            else
            {
                the3d.Draw2dBitmapFile(dataItems.ItemGraphics(item), screenpos.X, screenpos.Y,
                                       drawsize.Value.X, drawsize.Value.Y);
            }
        }
Beispiel #2
0
 public override void OnRenderFrame(OpenTK.FrameEventArgs e)
 {
     GL.ClearColor(Color.Green);
     GL.Clear(ClearBufferMask.ColorBufferBit);
     the3d.OrthoMode(window.Width, window.Height);
     for (int i = 0; i < 7; i++)
     {
         the3d.Draw2dText("Hello!", 50, 100 + i * 50, 8 + i * 6, colors[i]);
     }
     for (int i = 0; i < 16; i++)
     {
         the3d.Draw2dText(colorCodes[i] + "Color" + "&f & " + colorCodes[i][1], 300, 100 + i * 30, 14, null);
     }
 }
Beispiel #3
0
 void DrawWidgets(IForm form)
 {
     for (int i = 0; i < form.Widgets.Count; i++)
     {
         Widget b = form.Widgets[i];
         if (!b.Visible)
         {
             continue;
         }
         if (b.BackgroundSingleColor != null)
         {
             d_The3d.Draw2dTexture(d_The3d.WhiteTexture(), b.Rect.X, b.Rect.Y, b.Rect.Width, b.Rect.Height,
                                   null, b.BackgroundSingleColor.Value);
         }
         if (b.IsScrollbar)
         {
             d_The3d.Draw2dTexture(d_The3d.WhiteTexture(), b.Rect.X, b.Rect.Y, b.Rect.Width, b.Rect.Height,
                                   null, Color.Gray);
             float scrollpos    = b.Rect.Y + ((float)b.ScrollbarValue / (b.ScrollbarMax + 1)) * (b.Rect.Height - 40 * 2) + 40;
             float scrollheight = (b.Rect.Height - (40 * 2)) / (b.ScrollbarMax + 1);
             d_The3d.Draw2dTexture(d_The3d.WhiteTexture(), b.Rect.X, scrollpos,
                                   b.Rect.Width, scrollheight, null, Color.Black);
             d_The3d.Draw2dText("^", b.Rect.X, b.Rect.Y, b.FontSize, Color.White);
             d_The3d.Draw2dText("v", b.Rect.X, b.Rect.Y + b.Rect.Height - 40, b.FontSize, Color.White);
         }
         string img = ((selectedWidget == i || b.selected) &&
                       b.BackgroundImageSelected != null)
             ? b.BackgroundImageSelected : b.BackgroundImage;
         if (img != null)
         {
             d_The3d.Draw2dBitmapFile(img, b.Rect.X, b.Rect.Y, b.Rect.Width, b.Rect.Height);
         }
         if (b.Text != null)
         {
             int    dx   = b.FontSize > 20 ? 49 : 20;
             string text = b.IsPassword ? PassString(b.Text) : b.Text;
             if (typingfield == i)
             {
                 text += "&7|";
             }
             d_The3d.Draw2dText(text, b.Rect.X + dx, b.Rect.Y + dx, b.FontSize,
                                (b.BackgroundImage == null && b.selected) ? Color.Red : b.TextColor);
         }
     }
 }
Beispiel #4
0
        public override void OnRenderFrame(FrameEventArgs e)
        {
            Point mouse_current = System.Windows.Forms.Cursor.Position;

            mouse_current.Offset(-window.X, -window.Y);
            mouse_current.Offset(0, -20);

            OrthoMode();
            int selectedTest = (mouse_current.Y - 100) / 40;

            selectedTest = MyMath.Clamp(selectedTest, 0, tests.Count - 1);
            for (int i = 0; i < tests.Count; i++)
            {
                the3d.Draw2dText(i.ToString() + ". " + tests[i].name, 100, 100 + i * 40, 14, i == selectedTest ? Color.Red : Color.White);
            }
            if (Mouse.GetState().LeftButton == ButtonState.Pressed)
            {
                StartTest(selectedTest);
            }
        }