/// <summary> /// Create a cursor with the provided image /// /// Pixels must be an array of width by height pixels /// in 32-bit RGBA format. If not, this will cause undefined behavior. /// /// If pixels is null or either width or height are 0, /// the current cursor is left unchanged and the function will /// return false. /// /// In addition to specifying the pixel data, you can also /// specify the location of the hotspot of the cursor. The /// hotspot is the pixel coordinate within the cursor image /// which will be located exactly where the mouse pointer /// position is. Any mouse actions that are performed will /// return the window/screen location of the hotspot. /// /// Warning: On Unix, the pixels are mapped into a monochrome /// bitmap: pixels with an alpha channel to 0 are /// transparent, black if the RGB channel are close /// to zero, and white otherwise. /// </summary> /// <param name="pixels">Array of pixels of the image</param> /// <param name="size">Width and height of the image</param> /// <param name="hotspot">(x,y) location of the hotspot</param> public Cursor(byte[] pixels, SFML.System.Vector2u size, SFML.System.Vector2u hotspot) : base((IntPtr)0) { unsafe { fixed(byte *ptr = pixels) { CPointer = sfCursor_createFromPixels((IntPtr)ptr, size, hotspot); } } }
public Game() { Resolution = new Sfs.Vector2u(1280, 720); #if DEBUG _window = new Sfg.RenderWindow(new Sfw.VideoMode(Resolution.X, Resolution.Y), new string(Strings.GameName)); #else _window = new Sfg.RenderWindow(new Sfw.VideoMode(1280, 720), new string(Strings.GameName), Sfw.Styles.Fullscreen); #endif var cameraView = _window.DefaultView; cameraView.Center = new Sfs.Vector2f(300f, 200f); _window.SetView(cameraView); var gameplayState = new GameplayState(); _userInputController = new UserInputController { ActualState = gameplayState, ActualViewContainer = new GameplayStateView(gameplayState) }; }
public static bool Matches(this Vector2u self, SadRoguePoint other) => self.X == other.X && self.Y == other.Y;
public static Vector2u Divide(this Vector2u self, double d) => new Vector2u((uint)Math.Round(self.X / d, MidpointRounding.AwayFromZero), (uint)Math.Round(self.Y / d, MidpointRounding.AwayFromZero));
public static Vector2u Divide(this Vector2u self, SadRoguePoint other) => new Vector2u((uint)Math.Round(self.X / (double)other.X, MidpointRounding.AwayFromZero), (uint)Math.Round(self.Y / (double)other.Y, MidpointRounding.AwayFromZero));
public static Vector2u Multiply(this Vector2u self, double d) => new Vector2u((uint)Math.Round(self.X * d, MidpointRounding.AwayFromZero), (uint)Math.Round(self.Y * d, MidpointRounding.AwayFromZero));
public static Vector2u Multiply(this Vector2u self, int i) => new Vector2u((uint)(self.X * i), (uint)(self.Y * i));
public static Vector2u Multiply(this Vector2u self, SadRoguePoint other) => new Vector2u((uint)(self.X * other.X), (uint)(self.Y * other.Y));
public static Vector2u Subtract(this Vector2u self, Direction dir) => new Vector2u((uint)(self.X - dir.DeltaX), (uint)(self.Y - dir.DeltaY));
public static Vector2u Subtract(this Vector2u self, int i) => new Vector2u((uint)(self.X - i), (uint)(self.Y - i));
public static Vector2u Subtract(this Vector2u self, SadRoguePoint other) => new Vector2u((uint)(self.X - other.X), (uint)(self.Y - other.Y));
public static Vector2u Add(this Vector2u self, Direction dir) => new Vector2u((uint)(self.X + dir.DeltaX), (uint)(self.Y + dir.DeltaY));
public static Vector2u Add(this Vector2u self, int i) => new Vector2u(self.X + (uint)i, self.Y + (uint)i);
public static Vector2u Add(this Vector2u self, SadRoguePoint other) => new Vector2u(self.X + (uint)other.X, self.Y + (uint)other.Y);
public static SadRoguePoint ToPoint(this Vector2u self) => new SadRoguePoint((int)self.X, (int)self.Y);