void Initialize(WriteableBitmap wbm) { Console.WriteLine("Initializing..."); display = new FakeDisplay(width: displayWidth, height: displayHeight, bitmap: wbm); display.IgnoreOutOfBoundsPixels = true; graphics = new GraphicsLibrary(display); graphics.Rotation = GraphicsLibrary.RotationType.Default; graphics.Clear(true); }
internal unsafe void UniformMatrix(GraphicsLibrary gl, int uniform, Matrix4x4 matrix) { var t = stackalloc float[16]; t[0] = matrix.M11; t[1] = matrix.M12; t[2] = matrix.M13; t[3] = matrix.M14; t[4] = matrix.M21; t[5] = matrix.M22; t[6] = matrix.M23; t[7] = matrix.M24; t[8] = matrix.M31; t[9] = matrix.M32; t[10] = matrix.M33; t[11] = matrix.M34; t[12] = matrix.M41; t[13] = matrix.M42; t[14] = matrix.M43; t[15] = matrix.M44; gl.UniformMatrix4fv(uniform, 1, Boolean.False, t); }
internal unsafe int GetUniformLocation(GraphicsLibrary gl, string name) { var byteCount = Encoding.UTF8.GetBytes(name, 0, name.Length, byteBuffer, 0); byteBuffer[byteCount] = 0; fixed(byte *p = byteBuffer) { return(gl.GetUniformLocation(program, p)); } }
internal ShaderProgram(GraphicsLibrary gl, string vertexShaderSource, string fragmentShaderSource) { program = gl.CreateProgram(); var vertexShader = CompileShader(gl, ShaderType.Vertex, vertexShaderSource); var fragmentShader = CompileShader(gl, ShaderType.Fragment, fragmentShaderSource); LinkProgram(gl); gl.DeleteShader(vertexShader); gl.DeleteShader(fragmentShader); }
void Initialize() { Console.WriteLine("Initialize hardware..."); onboardLed = new RgbPwmLed(device: Device, redPwmPin: Device.Pins.OnboardLedRed, greenPwmPin: Device.Pins.OnboardLedGreen, bluePwmPin: Device.Pins.OnboardLedBlue, 3.3f, 3.3f, 3.3f, Meadow.Peripherals.Leds.IRgbLed.CommonType.CommonAnode); Console.WriteLine("Create Display with SPI..."); var config = new SpiClockConfiguration(12000, SpiClockConfiguration.Mode.Mode0); var bus = Device.CreateSpiBus(Device.Pins.SCK, Device.Pins.MOSI, Device.Pins.MISO, config); ssd1309 = new Ssd1309 ( device: Device, spiBus: bus, chipSelectPin: Device.Pins.D02, dcPin: Device.Pins.D01, resetPin: Device.Pins.D00 ); Console.WriteLine("Create GraphicsLibrary..."); graphics = new GraphicsLibrary(ssd1309) { CurrentFont = new Font8x12(), }; graphics.Clear(); graphics.DrawText(0, 0, "Loading Menu"); graphics.Show(); CreateMenu(graphics); Console.WriteLine("Create buttons..."); up = new PushButton(Device, Device.Pins.D14, ResistorMode.Disabled); up.Clicked += Up_Clicked; left = new PushButton(Device, Device.Pins.D11, ResistorMode.Disabled); left.Clicked += Left_Clicked; right = new PushButton(Device, Device.Pins.D10, ResistorMode.Disabled); right.Clicked += Right_Clicked; down = new PushButton(Device, Device.Pins.D12, ResistorMode.Disabled); down.Clicked += Down_Clicked; menu.Enable(); }
void Init() { Console.WriteLine("Init"); display = new Max7219(Device, Device.CreateSpiBus(), Device.Pins.D01, 4, Max7219.Max7219Type.Display); graphics = new GraphicsLibrary(display); graphics.CurrentFont = new Font4x8(); joystick = new AnalogJoystick(Device, Device.Pins.A01, Device.Pins.A02, null, true); }
void TestDisplayGraphicsAPI() { graphics = new GraphicsLibrary(display); graphics.Clear(); graphics.CurrentFont = new Font8x12(); graphics.DrawText(0, 0, "Meadow F7"); graphics.DrawRectangle(5, 14, 30, 10, true); graphics.Show(); }
void Initialize() { onboardLed = new RgbPwmLed(device: Device, redPwmPin: Device.Pins.OnboardLedRed, greenPwmPin: Device.Pins.OnboardLedGreen, bluePwmPin: Device.Pins.OnboardLedBlue, 3.3f, 3.3f, 3.3f, Meadow.Peripherals.Leds.IRgbLed.CommonType.CommonAnode); onboardLed.SetColor(Color.Red); var config = new SpiClockConfiguration( speedKHz: 12000, mode: SpiClockConfiguration.Mode.Mode3); var spiBus = Device.CreateSpiBus( clock: Device.Pins.SCK, mosi: Device.Pins.MOSI, miso: Device.Pins.MISO, config: config); st7789 = new St7789 ( device: Device, spiBus: spiBus, chipSelectPin: null, dcPin: Device.Pins.D01, resetPin: Device.Pins.D00, width: 240, height: 240 ); graphics = new GraphicsLibrary(st7789) { CurrentFont = new Font12x20(), }; graphics.Clear(); var menuData = LoadFromJson("menu.json"); //var menuData = LoadFromCode(); menu = new Menu(graphics, menuData, false); next = new PushButton(Device, Device.Pins.D03, ResistorMode.InternalPullUp); next.Clicked += (s, e) => { menu.Next(); }; select = new PushButton(Device, Device.Pins.D04, ResistorMode.InternalPullUp); select.Clicked += (s, e) => { menu.Select(); }; previous = new PushButton(Device, Device.Pins.D02, ResistorMode.InternalPullUp); previous.Clicked += (s, e) => { menu.Previous(); }; onboardLed.SetColor(Color.Green); menu.Enable(); }
void Initialize() { Console.WriteLine("Initialize hardware..."); charlieWing = new CharlieWing(Device.CreateI2cBus()); charlieWing.Clear(); charlieWing.Brightness = 128; graphics = new GraphicsLibrary(charlieWing); graphics.CurrentFont = new Font4x8(); }
public MeadowApp() { Console.WriteLine("Start..."); var rgbLed = new RgbLed( Device, Device.Pins.OnboardLedRed, Device.Pins.OnboardLedGreen, Device.Pins.OnboardLedBlue); rgbLed.SetColor(RgbLed.Colors.Red); Console.Write("Initializing I2C..."); displayI2C = new Ssd1306(Device.CreateI2cBus(), 60, Ssd1306.DisplayType.OLED128x32); graphicsI2C = new GraphicsLibrary(displayI2C); graphicsI2C.CurrentFont = new Font8x12(); graphicsI2C.Clear(); graphicsI2C.Stroke = 1; graphicsI2C.DrawRectangle(0, 0, 128, 32); graphicsI2C.DrawText(5, 12, "I2C WORKING"); graphicsI2C.Show(); Console.WriteLine("done"); Console.Write("Initializing SPI..."); displaySPI = new Ili9163( device: Device, spiBus: Device.CreateSpiBus(), chipSelectPin: Device.Pins.D14, dcPin: Device.Pins.D11, resetPin: Device.Pins.D10, width: 128, height: 160); graphicsSPI = new GraphicsLibrary(displaySPI); graphicsSPI.Rotation = GraphicsLibrary.RotationType._90Degrees; graphicsSPI.Clear(); graphicsSPI.Stroke = 1; graphicsSPI.DrawRectangle(0, 0, 160, 128); graphicsSPI.CurrentFont = new Font8x12(); graphicsSPI.DrawText(7, 7, "SPI WORKING!", Color.White); graphicsSPI.Show(); Console.WriteLine("done"); temperatures = new List <AnalogTemperature> { new AnalogTemperature(Device, Device.Pins.A00, AnalogTemperature.KnownSensorType.LM35), new AnalogTemperature(Device, Device.Pins.A01, AnalogTemperature.KnownSensorType.LM35), new AnalogTemperature(Device, Device.Pins.A02, AnalogTemperature.KnownSensorType.LM35), new AnalogTemperature(Device, Device.Pins.A03, AnalogTemperature.KnownSensorType.LM35), new AnalogTemperature(Device, Device.Pins.A04, AnalogTemperature.KnownSensorType.LM35), new AnalogTemperature(Device, Device.Pins.A05, AnalogTemperature.KnownSensorType.LM35), }; rgbLed.SetColor(RgbLed.Colors.Green); TestTemperatures(); }
/// <summary> /// Initializes a new instance of the AsyncGraphics class. /// </summary> /// <param name="graphicsLibrary">Reference to a Meadow graphics library object</param> public AsyncGraphics(GraphicsLibrary graphicsLibrary) { this.graphics = graphicsLibrary; this.Clear(); this.graphics.Stroke = Paddle.HEIGHT; this.graphics.CurrentFont = new Font12x16(); this.showThread = new Thread(this.ShowLoop); this.showThread.Start(); }
void TestDisplayGraphicsAPI() { graphics = new GraphicsLibrary(display); graphics.Clear(); graphics.CurrentFont = new Font12x16(); graphics.DrawText(0, 0, "MeadowB3.7"); graphics.DrawText(0, 24, "4-8x faster"); graphics.DrawText(0, 48, "86x IO perf"); graphics.Show(); }
public MeadowApp() { Console.WriteLine("Initializing..."); this.red = new Led(Device.CreateDigitalOutputPort(Device.Pins.OnboardLedRed)); this.green = new Led(Device.CreateDigitalOutputPort(Device.Pins.OnboardLedGreen)); this.red.IsOn = true; this.buttonNext = new PushButton( Device.CreateDigitalInputPort( Device.Pins.D03, InterruptMode.EdgeBoth, ResistorMode.Disabled )); this.buttonNext.Clicked += this.ButtonNextClicked; this.buttonPrevious = new PushButton( Device.CreateDigitalInputPort( Device.Pins.D04, InterruptMode.EdgeBoth, ResistorMode.Disabled )); this.buttonPrevious.Clicked += this.ButtonPreviousClicked; var config = new SpiClockConfiguration( speedKHz: 6000, mode: SpiClockConfiguration.Mode.Mode3); this.display = new St7789 ( device: Device, spiBus: Device.CreateSpiBus( clock: Device.Pins.SCK, mosi: Device.Pins.MOSI, miso: Device.Pins.MISO, config: config), chipSelectPin: null, dcPin: Device.Pins.D01, resetPin: Device.Pins.D00, width: 240, height: 240 ); this.display.IgnoreOutOfBoundsPixels = true; this.graphics = new GraphicsLibrary(display); this.graphics.Rotation = GraphicsLibrary.RotationType._270Degrees; this.ShowJpeg(); this.red.IsOn = false; this.green.IsOn = true; }
public static void Main() { // SPI constructor var oled = new ST7565(chipSelectPin: Pins.GPIO_PIN_D10, dcPin: Pins.GPIO_PIN_D8, resetPin: Pins.GPIO_PIN_D9, spiModule: SPI.SPI_module.SPI1, speedKHz: 10000); oled.SetContrast(24); oled.SetContrast(12); oled.SetContrast(0); oled.Clear(true); oled.InvertDisplay(true); oled.Clear(true); oled.InvertDisplay(false); oled.IgnoreOutOfBoundsPixels = true; var display = new GraphicsLibrary(oled); display.Clear(true); display.DrawLine(0, 0, 60, 28, true); display.Show(); Thread.Sleep(1000); display.Clear(true); display.DrawCircle(63, 31, 20, true, true); display.Show(); Thread.Sleep(1000); display.Clear(true); display.DrawRectangle(20, 20, 60, 40); display.Show(); Thread.Sleep(1000); display.Clear(true); display.DrawRectangle(30, 10, 50, 40, true, true); display.Show(); Thread.Sleep(1000); display.Clear(true); display.CurrentFont = new Font8x8(); display.DrawText(4, 0, "NETDUINO 3 WiFi"); display.DrawCircle(64, 32, 16, true, true); display.Show(); Thread.Sleep(Timeout.Infinite); }
void Initialize() { Console.WriteLine("Initialize hardware..."); var i2cBus = Device.CreateI2cBus(I2cBusSpeed.FastPlus); oledWing = new OLED128x32Wing(i2cBus, Device, Device.Pins.D11, Device.Pins.D10, Device.Pins.D09); oledWing.ButtonB.Clicked += (sender, e) => pongGame?.PlayerUp(); oledWing.ButtonC.Clicked += (sender, e) => pongGame?.PlayerDown(); graphics = new GraphicsLibrary(oledWing.Display); graphics.CurrentFont = new Font8x12(); }
private void CreateShader() { GraphicsLibrary graphicsLibrary = AlkaronCoreGame.Core.GraphicsLibrary; EffectCode effectCode = GetEffectCode(graphicsLibrary, CodeType.XNAEffect); if (effectCode == null) { Log.Error("Could not load Shader for platform: " + graphicsLibrary + " in Material: " + this.Name); return; } Effect = new Effect(AlkaronCoreGame.Core.GraphicsDevice, effectCode.ByteCode); }
public MeadowApp() { Console.WriteLine("ePaper sample"); Console.WriteLine("Create Spi bus"); var spiBus = Device.CreateSpiBus();// Device.Pins.SCK, Device.Pins.MOSI, Device.Pins.MISO, 2000); Console.WriteLine("Create display driver instance"); display = new Il91874(device: Device, spiBus: spiBus, chipSelectPin: Device.Pins.D14, dcPin: Device.Pins.D13, resetPin: Device.Pins.D15, busyPin: Device.Pins.D12, width: 176, height: 264); var graphics = new GraphicsLibrary(display); graphics.Rotation = GraphicsLibrary.RotationType._270Degrees; graphics.CurrentFont = new Font12x16(); graphics.Clear(); graphics.DrawText(2, 2, "IL91874"); graphics.DrawText(2, 20, "Meadow B3.12"); /* int ySpacing = 12; * * for (int i = 0; i < 3; i++) * { * graphics.DrawLine(2, 70 + ySpacing * i, 22, 50 + ySpacing * i, true); * graphics.DrawLine(22, 50 + ySpacing * i, 42, 70 + ySpacing * i, true); * graphics.DrawLine(44, 70 + ySpacing * i, 64, 50 + ySpacing * i, true); * graphics.DrawLine(64, 50 + ySpacing * i, 84, 70 + ySpacing * i, true); * graphics.DrawLine(86, 70 + ySpacing * i, 106, 50 + ySpacing * i, true); * graphics.DrawLine(106, 50 + ySpacing * i, 126, 70 + ySpacing * i, true); * }*/ graphics.DrawCircle(50, 100, 20, Color.Red, false); graphics.DrawCircle(100, 100, 20, Color.White, false); graphics.DrawCircle(150, 100, 20, Color.Red, true); graphics.DrawCircle(200, 100, 20, Color.White, true); Console.WriteLine("Show"); graphics.Show(); Console.WriteLine("Show complete"); }
async Task Initialize() { RgbPwmLed onboardLed = new RgbPwmLed(device: Device, redPwmPin: Device.Pins.OnboardLedRed, greenPwmPin: Device.Pins.OnboardLedGreen, bluePwmPin: Device.Pins.OnboardLedBlue, 3.3f, 3.3f, 3.3f, Meadow.Peripherals.Leds.IRgbLed.CommonType.CommonAnode); onboardLed.StartPulse(Color.Red); display = new Max7219( device: Device, spiBus: Device.CreateSpiBus(), csPin: Device.Pins.D01, deviceCount: 4, maxMode: Max7219.Max7219Type.Display); graphics = new GraphicsLibrary(display); graphics.CurrentFont = new Font4x8(); graphics.Rotation = GraphicsLibrary.RotationType._180Degrees; graphics.Clear(); graphics.DrawText(0, 1, "WI"); graphics.DrawText(0, 9, "FI"); graphics.DrawText(0, 17, "TI"); graphics.DrawText(0, 25, "ME"); graphics.Show(); pushButton = new PushButton(Device, Device.Pins.D04, ResistorMode.InternalPullUp); pushButton.Clicked += PushButtonClicked; analogTemperature = new AnalogTemperature( device: Device, analogPin: Device.Pins.A00, sensorType: AnalogTemperature.KnownSensorType.LM35 ); Device.InitWiFiAdapter().Wait(); onboardLed.StartPulse(Color.Blue); var result = await Device.WiFiAdapter.Connect(Secrets.WIFI_NAME, Secrets.WIFI_PASSWORD); if (result.ConnectionStatus != ConnectionStatus.Success) { onboardLed.StartPulse(Color.Magenta); throw new Exception($"Cannot connect to network: {result.ConnectionStatus}"); } onboardLed.StartPulse(Color.Green); }
void Initialize() { Console.WriteLine("Initialize hardware..."); Console.WriteLine("Create Display with SPI..."); var config = new Meadow.Hardware.SpiClockConfiguration(6000, SpiClockConfiguration.Mode.Mode0); var bus = Device.CreateSpiBus(Device.Pins.SCK, Device.Pins.MOSI, Device.Pins.MISO, config); display = new Ssd1309 ( device: Device, spiBus: bus, chipSelectPin: Device.Pins.D02, dcPin: Device.Pins.D01, resetPin: Device.Pins.D00 ); Console.WriteLine("Create Graphics Library..."); graphics = new GraphicsLibrary(display); graphics.Rotation = GraphicsLibrary.RotationType._270Degrees; graphics.CurrentFont = new Font8x12(); graphics.Clear(); graphics.DrawText(0, 0, "Hello"); graphics.Show(); Console.WriteLine("Create buttons..."); portLeft = Device.CreateDigitalInputPort(Device.Pins.D12, InterruptMode.EdgeFalling, ResistorMode.InternalPullDown); portUp = Device.CreateDigitalInputPort(Device.Pins.D13, InterruptMode.EdgeFalling, ResistorMode.InternalPullDown); portRight = Device.CreateDigitalInputPort(Device.Pins.D07, InterruptMode.EdgeFalling, ResistorMode.InternalPullDown); portDown = Device.CreateDigitalInputPort(Device.Pins.D11, InterruptMode.EdgeFalling, ResistorMode.InternalPullDown); portRight.Changed += PortRight_Changed; portLeft.Changed += PortLeft_Changed; portUp.Changed += PortUp_Changed; portDown.Changed += PortDown_Changed; /* btnUp = new PushButton(Device, Device.Pins.D13); * btnLeft = new PushButton(Device, Device.Pins.D12); * btnDown = new PushButton(Device, Device.Pins.D11); * btnRight = new PushButton(Device, Device.Pins.D10); * * btnUp.Clicked += BtnUp_Clicked; * btnLeft.Clicked += BtnLeft_Clicked; * btnDown.Clicked += BtnDown_Clicked; * btnRight.Clicked += BtnRight_Clicked; */ }
public static void Main() { Debug.Print(Resources.GetString(Resources.StringResources.String1)); var display = new PCD8544(chipSelectPin: Pins.GPIO_PIN_D9, dcPin: Pins.GPIO_PIN_D8, resetPin: Pins.GPIO_PIN_D10, spiModule: SPI.SPI_module.SPI1); gl = new GraphicsLibrary(display); gl.CurrentFont = new Font8x8(); InitGPS(); Thread.Sleep(-1); }
void Init() { Console.WriteLine("Init..."); var spiBus = Device.CreateSpiBus(Max7219.SpiClockFrequency); display = new Max7219(Device, Device.CreateSpiBus(), Device.Pins.D01, 4, Max7219.Max7219Type.Display); graphics = new GraphicsLibrary(display); graphics.Rotation = GraphicsLibrary.RotationType._90Degrees; Console.WriteLine("Max7219 instantiated"); }
/// <remarks>NOTE: The dotstar feather by default is not connected to the SPI MOSI or SCK pins. /// https://learn.adafruit.com/adafruit-dotstar-featherwing-adafruit/pinouts /// </remarks> void Initialize() { Console.WriteLine("Initialize hardware..."); ISpiBus spiBus = Device.CreateSpiBus(); IDigitalOutputPort spiPeriphChipSelect = Device.CreateDigitalOutputPort(Device.Pins.D04); dotStarWing = new DotstarWing(spiBus, spiPeriphChipSelect); graphics = new GraphicsLibrary(dotStarWing); graphics.CurrentFont = new Font4x8(); dotStarWing.SetPenColor(Color.Blue); dotStarWing.Brightness = 0.1f; }
void Initialize() { Console.WriteLine("Initialize hardware..."); Console.WriteLine("Onboard LED"); onboardLed = new RgbPwmLed(device: Device, redPwmPin: Device.Pins.OnboardLedRed, greenPwmPin: Device.Pins.OnboardLedGreen, bluePwmPin: Device.Pins.OnboardLedBlue, 3.3f, 3.3f, 3.3f, Meadow.Peripherals.Leds.IRgbLed.CommonType.CommonAnode); // configure our BME280 on the I2C Bus Console.WriteLine("BME280"); var i2c = Device.CreateI2cBus(); bme280 = new Bme280( i2c, Bme280.I2cAddress.Adddress0x76 ); // configure our AnalogTemperature sensor Console.WriteLine("Analog Temp"); anlgTemp = new AnalogTemperature( device: Device, analogPin: Device.Pins.A02, sensorType: AnalogTemperature.KnownSensorType.TMP35 ); //a02 = Device.CreateAnalogInputPort(Device.Pins.A02); Console.WriteLine("Relays"); relays[0] = new Relay(Device, Device.Pins.D04); // Fan relays[1] = new Relay(Device, Device.Pins.D09); // Heat 1 relays[2] = new Relay(Device, Device.Pins.D10); // Heat 2 relays[3] = new Relay(Device, Device.Pins.D06); // Cool 1 relays[4] = new Relay(Device, Device.Pins.D05); // Cool 2 Console.WriteLine("Display"); var config = new SpiClockConfiguration(48000, SpiClockConfiguration.Mode.Mode3); var spiBus = Device.CreateSpiBus(Device.Pins.SCK, Device.Pins.MOSI, Device.Pins.MISO, config); display = new St7789( device: Device, spiBus: spiBus, chipSelectPin: null, dcPin: Device.Pins.D00, resetPin: Device.Pins.D02, width: 240, height: 240); canvas = new GraphicsLibrary(display); }
void Initialize() { Console.WriteLine("Initialize hardware..."); display = new Apa102(Device.CreateSpiBus(), Apa102.PixelOrder.BGR, false, 32, 8); graphics = new GraphicsLibrary(display); graphics.CurrentFont = new Font4x8(); graphics.Clear(); graphics.DrawText(0, 1, "MEADOW", Color.FromRgb(0, 0.1, 0.1)); graphics.DrawText(24, 1, "F7", Color.FromRgb(0.1, 0, 0)); graphics.Show(); }
void Initialize() { Console.WriteLine("Creating output ports..."); var spiBus = Device.CreateSpiBus(); camera = new ArducamMini(Device, spiBus, Device.Pins.D00, Device.CreateI2cBus()); // display = new ST7789(Device, spiBus, // Device.Pins.D04, Device.Pins.D03, Device.Pins.D02, 135, 240); graphics = new GraphicsLibrary(display); graphics.CurrentFont = new Font12x20(); graphics.Rotation = GraphicsLibrary.RotationType._90Degrees; }
void InitializeHardware() { Console.WriteLine("Configuring hardware"); Console.WriteLine("Create display driver instance"); var spiBus = Device.CreateSpiBus(); display = new EPD2i9b(device: Device, spiBus: spiBus, chipSelectPin: Device.Pins.D02, dcPin: Device.Pins.D01, resetPin: Device.Pins.D00, busyPin: Device.Pins.D03); graphics = new GraphicsLibrary(display); graphics.CurrentFont = new Font8x12(); }
public void InitHardware() { Console.WriteLine("Initialize hardware..."); blueLed = Device.CreateDigitalOutputPort(Device.Pins.OnboardLedBlue); sensor = new SHT31D(Device.CreateI2cBus()); sensor.Updated += Sensor_Updated; var st7789 = new ST7789(Device, Device.CreateSpiBus(), Device.Pins.D02, Device.Pins.D01, Device.Pins.D00, 135, 240); display = new GraphicsLibrary(st7789); display.CurrentFont = new Font12x20(); display.Rotation = GraphicsLibrary.RotationType._90Degrees; }
public RPSLSView(DisplayTftSpiBase controller) { this.controller = controller; Console.WriteLine("Load images"); LoadImages(); Console.WriteLine("Init graphics lib"); display = new GraphicsLibrary(controller); display.CurrentFont = new Font12x16(); //Draw static content display.Clear(); //black background display.DrawText(60, 10, "R.P.S.L.S.", White); display.DrawText(48, 290, "aka.ms/rpsls", White); }
private static unsafe string GetShaderHeader(GraphicsLibrary gl) { if (shaderHeader == null) { string?s = Marshal.PtrToStringAnsi(new IntPtr(gl.GetString(StringParameter.ShadingLanguageVersion))); if (s != null && s.StartsWith("4.")) { shaderHeader = "#version 4" + s.Substring(2, 2) + " core\n"; } else { shaderHeader = "#version 300 es\nprecision mediump float;\n"; } } return(shaderHeader); }
public void Draw(Panels panel, System.Windows.Forms.PaintEventArgs e, GraphicsLibrary image, int x, int y) { switch (panel) { case Panels.MINEFIELD: e.Graphics.DrawImage(sheet, new RectangleF(x * 16 * scaleFactor, y * 16 * scaleFactor, 16 * scaleFactor, 16 * scaleFactor), rectangles[image], GraphicsUnit.Pixel); break; case Panels.FACE: e.Graphics.DrawImage(sheet, new Rectangle(0, 0, scaleFactor * 26, scaleFactor * 26), rectangles[image], GraphicsUnit.Pixel); break; case Panels.MINES: e.Graphics.DrawImage(sheet, new Rectangle(x * scaleFactor * 12, 0, scaleFactor * 13, scaleFactor * 26), rectangles[image], GraphicsUnit.Pixel); break; } }