using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.Linq; using System.Text; using System.Threading.Tasks; using PixelEngine; using Point = PixelEngine.Point; namespace RAYLAND { class Program : Game { public static Program program; static void Main(string[] args) { program = new Program(); program.Construct(500, 500, 1, 1,55); program.Start(); } //fake 3d rendering (no linear algebra) public List pts = new List() { new Point(5, 5), new Point(15, 5), }; Random rnd = new Random(); int time; // Sprite sprite = new Sprite(55, 55); Bitmap sprite = new Bitmap("textures.png"); // bool loaded =false; public static float perspectiveEffect(float x, float y) { float check = y * 0.8f; float perspective = -80.0f - x; if (check > -30.0f - x) { perspective = check; } else { perspective = -30.0f - x; } // if() //Console.WriteLine(perspective); return perspective; } public override void OnUpdate(float elapsed) { time++; Clear(Pixel.Presets.Black); /*if(loaded == false) { sprite = Sprite.Load("textures.png"); loaded = true; } */ // MainEngine.drawMap2D(); float angle = MouseX; for (int x = 0; x < sprite.Width; x++) { for (int y = 0; y < sprite.Height; y++) { int brightness = (int)(sprite.GetPixel(x, y).GetBrightness()*150); // Console.WriteLine(brightness); try { // program.DrawRect(new Point(350 + x+(y+(int)angle), 350), new Point(350 + x+5 + (y - (int)angle), 350 +5), new Pixel((byte)(sprite.GetPixel(x, y).R), (byte)(sprite.GetPixel(x, y).G), (byte)(sprite.GetPixel(x, y).B))); //perspectiveEffect( program.FillRect(new Point((350 + x)- (int)(y+angle) , (350 + 0+brightness)-55 ), new Point((350 + x+5) - (int)(y + angle), (350 + 0 + 5+brightness)-55), new Pixel((byte)(sprite.GetPixel(x, y).R), (byte)(sprite.GetPixel(x, y).G), (byte)(sprite.GetPixel(x, y).B))); } catch (DivideByZeroException) { //throw; } } } //program.DrawText(new Point((int)(Math.Cos(time) * 155), (int)(Math.Cos(time) * 15)), "Conecting to Servers", Pixel.Random(), 1); } } }