Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Image BGImage { get { return BackgroundImage;} set {BackgroundImage = value;} }
- public static int frameindex = -1;
- protected override void OnPaint(PaintEventArgs e) {
- base.OnPaint(e);//so I can at least see if they start running this again
- if(Name.Contains("PC")) {
- System.Console.Out.WriteLine(frameindex);//so I can see if the PC TestPictureBox starts running this again even if it's covered by something
- frameindex++;//only one thing named PC and noting else includes it, so just 1 per frame.
- }
- Graphics g = Main.form.border.CreateGraphics();//Main.form.border is a regular imagebox in the middle of the screen, set to be the right size for all of the tiles to fit in it
- if(BGImage!=null) {
- Bitmap a1 = new Bitmap(BGImage, new Size(Width, Height));//Scale the Background images to the proper size (to support every possible resolution)
- //Bitmap a2 = new Bitmap(a, new Size(Width, Height));
- g.DrawImage(a1, (Location.X-Main.RenderPos.X)+Main.tilewidth, (Location.Y-Main.RenderPos.Y)+Main.tilewidth, Width, Height);//try to render the tile at the right location, RenderPos is the border's offset from the top-left corner.
- g.DrawImage(a1, 0, 0, Main.tilewidth, Main.tilewidth);//try to render the tile
- e.Graphics.DrawImage(a1, 0, 0, Width, Height);//try to render the tile again
- }
- if(Image!=null){
- ImageAttributes IAtt = new ImageAttributes();
- try {
- //IAtt.SetWrapMode(System.Drawing.Drawing2D.WrapMode.Clamp);
- ColorMatrix comat = new ColorMatrix(new float[][]
- {
- new float[] {2f, .3f, .3f, 0, 0},
- new float[] {.59f, 1f, .59f, 0, 0},
- new float[] {.11f, .11f, 1f, 0, 0},
- new float[] {1, 1, 1, 1, 1},
- new float[] {1, 1, 1, 1, 1}
- });
- IAtt.SetColorMatrix(comat);//to chech if IAtt is being used
- } catch(Exception ex) {
- Main.setText(ex.Message);
- }
- Bitmap a = (Bitmap)Image;
- a = new Bitmap(a, new Size(Width, Height));//try to fix size
- Point[] points = new Point[3];
- points[0] = new Point((Location.X-Main.RenderPos.X)+Main.tilewidth, (Location.Y-Main.RenderPos.Y)+Main.tilewidth);
- Point point = new Point(points[0].X, points[0].Y)+new BetterPoint(Width, Height);//BetterPoint is just Point, but it supports being used as a 2d vector that starts at 0,0, and it supports converting between the result of 0 seconds of neural network training and the Xna framework's almost unnecessary but usable points, all due to being programmed for a reason.
- points[1] = new Point(point.X,points[0].Y);
- points[2] = new Point(points[0].X,point.Y);//try to create a point array with the right format, probably fails due to using instructions from the exeption thrown with only 2 instead of some random person answering stackoverflow questions while listening to "Rasputin" at 2 AM.
- g.DrawImage(a, points, new Rectangle(0,0,Image.Width-1,Image.Height-1),System.Drawing.GraphicsUnit.Pixel, IAtt);//try to render the image
- e.Graphics.DrawImage(a, new Point[] {new Point(),new Point(), new Point()}, new Rectangle(0,0,Image.Width-1,Image.Height-1), GraphicsUnit.Pixel, IAtt);//just trying to see if anything was working here, it wasn't
- //e.Graphics.DrawImage(a, new Point[]{new Point(0,0),new Point(0,16),new Point(0,16)}, new Rectangle(0,0,Image.Width-1,Image.Height-1),System.Drawing.GraphicsUnit.Pixel, IAtt);//trying that again, failing it again
- //e.Graphics.Dispose();
- }
- //if(Name!=null)g.DrawImage(Main.Letter[Name.ToLower().ToCharArray()[0]], Location.X/2, Location.Y/2);//try to render first letter of Control name
- g.Dispose();
- e.Graphics.Dispose();
- }
- public class BetterPoint{//see?
- int X;
- int Y;
- public BetterPoint(int X,int Y){this.X=X; this.Y=Y;}
- public static BetterPoint operator+ (BetterPoint a, BetterPoint b){
- return new BetterPoint(a.X+b.X,a.Y+b.Y);
- }
- public static implicit operator Point(BetterPoint i){
- return new Point(i.X,i.Y);
- }
- public static implicit operator Microsoft.Xna.Framework.Point(BetterPoint i){
- return new Microsoft.Xna.Framework.Point(i.X,i.Y);
- }
- public static implicit operator BetterPoint(Point i){
- return new BetterPoint(i.X,i.Y);
- }
- public static implicit operator BetterPoint(Microsoft.Xna.Framework.Point i){
- return new BetterPoint(i.X,i.Y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement