public MainWindowViewModel() { ViewPortDataSource = new ViewPortData(); _calculateCommand = new DelegateCommand(Calculate, CanCalculate); _seamFacingFrontCommand = new DelegateCommand(ChangeSeamPosition); _euroPaletteCommand = new DelegateCommand(EuroPalette); _seamFacingFront = false; }
public static void Viewport(int x, int y, int width, int height) { currentViewport = new ViewPortData(x, y, width, height); #if USE_OPENGL OpenTK.Graphics.OpenGL.GL.Viewport(x, y, width, height); #else OpenTK.Graphics.ES11.GL.Viewport(x, y, width, height); #endif }
public EditorControl(Map mapToEdit, MainWindow mainWindow) { InitializeComponent(); Map = mapToEdit; MainWnd = mainWindow; Mapping = new Mapping(50, 42); this.DataContext = Map; ViewPortData viewPort = new ViewPortData() { CentreX = 0, CentreY = 0, Height = 500, Width = 500, Zoom = 1 }; //var uriSource = new Uri(@"/WpfApplication1;component/Untitled.png", UriKind.Relative); //foo.Source = new BitmapImage(uriSource); BitmapImage img = new BitmapImage(new Uri("C:/Development/projects/Landwar/Shared/HexRed.png")); /*ImageBrush imgBrush = new ImageBrush(img); * imgBrush.Viewbox = new Rect(0, 0, 1, 1); * imgBrush.ViewboxUnits = BrushMappingMode.RelativeToBoundingBox; * imgBrush.Stretch = Stretch.Uniform;*/ SolidColorBrush redSolidColorBrush = new SolidColorBrush(); redSolidColorBrush.Color = Color.FromArgb(255, 255, 0, 0); SolidColorBrush grnSolidColorBrush = new SolidColorBrush(); grnSolidColorBrush.Color = Color.FromArgb(255, 0, 255, 0); for (int j = 0; j < mapToEdit.Height; ++j) { for (int i = 0; i < mapToEdit.Width; ++i) { Point hexTopLeft = Mapping.GetHexTopLeftCorner(viewPort, mapToEdit.Hexes[j, i]); Polygon pGon = GenerateHex(hexTopLeft.X, hexTopLeft.Y, Mapping.hexHeight, Mapping.hexWidth); pGon.Stroke = Brushes.Purple; pGon.StrokeThickness = 0; pGon.ClipToBounds = true; //pGon.Fill = imgBrush; if (((double)i) % 2 == 0) { pGon.Fill = redSolidColorBrush; } else { pGon.Fill = grnSolidColorBrush; } pGon.MouseEnter += Polygon_MouseMove; this.cnvMap.Children.Add(pGon); } } }
public void Viewport(int x, int y, int width, int height) { currentViewport = new ViewPortData(x, y, width, height); #if USE_OPENGL if (HardwareAvailable) { OpenTK.Graphics.OpenGL.GL.Viewport(x, y, width, height); } #else OpenTK.Graphics.ES11.GL.Viewport(x, y, width, height); #endif }
public static void PopAttrib() { #if USE_OPENGL OpenTK.Graphics.OpenGL.GL.PopAttrib(); #else AttribMask mask = pushedAttributStack.Pop(); if ((mask & AttribMask.ViewportBit) == AttribMask.ViewportBit) { ViewPortData top = viewportStack.Pop(); Viewport(top.x, top.y, top.width, top.height); } if (mask != AttribMask.ViewportBit) { throw new Exception(); } #endif }
public static void Viewport(int x, int y, int width, int height) { currentViewport = new ViewPortData(x, y, width, height); #if USE_OPENGL if (openGlHardwareAvailable) { OpenTK.Graphics.OpenGL.GL.Viewport(x, y, width, height); } #else OpenTK.Graphics.ES11.GL.Viewport(x, y, width, height); #endif }