/// <summary>Used to get a PixyCam Frame.</summary> /// <param name="Mode">Image mode</param> /// <param name="X">X offset to use to grab image data</param> /// <param name="Y">Y offset to use to grab image data</param> /// <param name="Width">Image width</param> /// <param name="Height">Image height</param> /// <returns></returns> public byte[] GetFrame(FrameMode Mode, int X, int Y, int Width, int Height) { if (Mode == FrameMode.Size1280x800 && (Width > 1280 || Width < 1 || Height > 800 || Height < 1)) { throw new Exception("Illegal frame size for selected frame mode!"); } if (Mode == FrameMode.Size640x400 && (Width > 640 || Width < 1 || Height > 400 || Height < 1)) { throw new Exception("Illegal frame size for selected frame mode!"); } if (Mode == FrameMode.Size320x200 && (Width > 320 || Width < 1 || Height > 200 || Height < 1)) { throw new Exception("Illegal frame size for selected frame mode!"); } IntPtr current_frame; uint size = 0; pixy_cam_getFrame((int)Mode, X, Y, Width, Height, out current_frame, out size); byte[] memStorage = new byte[size]; Marshal.Copy(current_frame, memStorage, 0, Convert.ToInt32(size)); return(memStorage); }
public FrameConfig(string windowClass, string windowTitle, FrameMode frameMode, Point?windowPosition, Size?windowSize) { _windowClass = windowClass; _windowTitle = windowTitle; _frameMode = frameMode; _windowPosition = windowPosition; _windowSize = windowSize; }
public void ReqMode(FrameMode iMode) { if (iMode != 0) { switch (iMode) { case FrameMode.Hide: _clsCam.sameMask = Generics.Layers.Nothing; break; case FrameMode.Show: _clsCam.sameMask = Generics.Layers.UI2D; break; } } }
public void PlayNamedAnimation(string name, bool forceRestart, float delayFirstFrame, int pri=0) { RagePixelAnimation animation = GetCurrentRow().GetAnimationByName(name); if(animation != null) { if((playAnimation == false || forceRestart || AnimationIsDifferent(animation) || AnimationIsOver) && (pri >= currentAnimationPriority)) { currentAnimationName = name; currentAnimationPriority = pri; animationFrames = animation.frames; animationMinIndex = Mathf.Clamp(animation.startIndex, 0, GetCurrentRow().cells.Length - 1); animationMaxIndex = Mathf.Clamp(animation.endIndex, animationMinIndex, GetCurrentRow().cells.Length - 1); animationMode = animation.mode; frameMode = animation.frameMode; CheckAnimOnPlay(); nextAnimFrame = myTime + GetCurrentCell().delay / 1000f + delayFirstFrame; playAnimation = true; } } else { Debug.Log("No animation: " + name + " found in the sprite: " + (GetCurrentRow().name.Length > 0 ? GetCurrentRow().name : "empty")); } }
public void PlayAnimation(bool forceRestart, AnimationMode animMode, int[] frames, int pri=0) { if(playAnimation == false || forceRestart || pri >= currentAnimationPriority) { currentAnimationPriority = pri; currentAnimationName = null; animationMode = (AnimationMode)animMode; frameMode = FrameMode.Sequence; animationFrames = frames; CheckAnimOnPlay(); nextAnimFrame = myTime + GetCurrentCell().delay / 1000f; playAnimation = true; } }
public void PlayAnimation(bool forceRestart, AnimationMode animMode, int rangeMinIndex, int rangeMaxIndex, int pri=0) { if(playAnimation == false || forceRestart || pri >= currentAnimationPriority) { currentAnimationPriority = pri; currentAnimationName = null; animationMode = (AnimationMode)animMode; frameMode = FrameMode.Range; animationMinIndex = Mathf.Clamp(rangeMinIndex, 0, GetCurrentRow().cells.Length - 1); animationMaxIndex = Mathf.Clamp(rangeMaxIndex, animationMinIndex, GetCurrentRow().cells.Length - 1); CheckAnimOnPlay(); nextAnimFrame = myTime + GetCurrentCell().delay / 1000f; playAnimation = true; } }
void OnSceneGUI(SceneView sceneView) { if (tileRoot == null) { return; } // USER EVENTS Event e = Event.current; if (e.type == EventType.KeyDown) { switch (e.keyCode) { case KeyCode.PageUp: // select higher selectedLayer = Wrap(--selectedLayer, layerNames.Length); Selection.activeGameObject = tilemapGos[selectedLayer]; e.Use(); break; case KeyCode.PageDown: // select lower selectedLayer = Wrap(++selectedLayer, layerNames.Length); Selection.activeGameObject = tilemapGos[selectedLayer]; e.Use(); break; case KeyCode.Escape: // reset brush, TODO break; case KeyCode.G: // Toggle Frame selected and PixelPerfectZoom *Cannot override F key.. switch (frameMode) { case FrameMode.Framed: Selection.activeGameObject = tilemapGos[selectedLayer]; sceneView.FrameSelected(); frameMode = FrameMode.PixelPerfect; break; case FrameMode.PixelPerfect: if (tilemapGos[selectedLayer] != null) { // var tm = tilemapGos[selectedLayer].GetComponent<TileMap>(); // var s = tm.GetSprite(new Vector3Int(0, 0, 0)); // var tr = tilemapGos[selectedLayer].GetComponent<TileMapRenderer>(); var cam = SceneView.currentDrawingSceneView.camera; var pixelPerUnits = 16; // TODO get from sprites var orthoSize = cam.pixelHeight / pixelPerUnits / 2; Vector3 mousePosition = Event.current.mousePosition; mousePosition.y = SceneView.currentDrawingSceneView.camera.pixelHeight - mousePosition.y; var mouseWorldPos = cam.ScreenToWorldPoint(mousePosition); sceneView.LookAtDirect(mouseWorldPos, SceneView.lastActiveSceneView.rotation, orthoSize); //sceneView.LookAtDirect(SceneView.lastActiveSceneView.pivot, SceneView.lastActiveSceneView.rotation, orthoSize); } frameMode = FrameMode.HalfWay; break; case FrameMode.HalfWay: if (tilemapGos[selectedLayer] != null) { var cam = SceneView.currentDrawingSceneView.camera; var pixelPerUnits = 16; // TODO get from sprites var orthoSize = cam.pixelHeight / pixelPerUnits * 2; Vector3 mousePosition = Event.current.mousePosition; mousePosition.y = SceneView.currentDrawingSceneView.camera.pixelHeight - mousePosition.y; var mouseWorldPos = cam.ScreenToWorldPoint(mousePosition); sceneView.LookAtDirect(mouseWorldPos, SceneView.lastActiveSceneView.rotation, orthoSize); } frameMode = FrameMode.Framed; break; default: break; } e.Use(); break; default: break; } } // SCENE UI Handles.BeginGUI(); selectedLayer = GUI.SelectionGrid(new Rect(0, 32, 128, 64), selectedLayer, layerNames, 1); if (fadeOtherLayers) { SetTileMapLayerColors(); } Handles.EndGUI(); }
/// <summary> /// Sets the rendering sprite of the particle. /// </summary> /// <param name="sprite">The Sprite to render.</param> /// <param name="origin">The origin to render with.</param> /// <param name="mode">The frame mode of the particle.</param> /// <returns>The current ParticleType.</returns> public ParticleType SetSprite(SpriteDefinition sprite, Vector2 origin, FrameMode mode) { Sprite = sprite; Origin = origin; realOrigin = (OriginInPixels ? Origin : Origin * sprite.Size); Mode = mode; if (shouldSetScaleByPixels) { Size.Min = pixelMin / Sprite.Diagonal; Size.Max = pixelMax / Sprite.Diagonal; } return this; }
} // 0x00E31A60-0x00E31E50 public void NameOpen(RectangleS32 rect, int nPriority, bool bTalkWindow, FrameMode eFrameMode, bool bIsNoFrameMode) { } // 0x00E31F20-0x00E32340
public bool IsNameOpen() => default; // 0x00E319F0-0x00E31A60 public void Open(RectangleS32 rect, int nPriority, FontType eFontType, bool bOutlineMode, bool bTalkWindow, FrameMode eFrameMode, RectangleS32 clientRect, bool bIsNoFrameMode) { } // 0x00E31A60-0x00E31E50
//Start frame animation public int StartFPS(int StartVal, int EndVal, float Speed, FrameMode AnimMode) { //Check input values if (StartVal < 1) { //Start frame is less than 1 return -1; } if (EndVal > mAnimMaxFrames) { //End frame is greater then max frames return -1; } if ((Speed < 0f) || (Speed > mAnimMaxFrames)) { //FPS is negative or more than max frames return -1; } //Check value ranges if (StartVal == EndVal) { //Start and End frames are the same. No animation needed return -1; } switch (AnimMode) { case FrameMode.ForwardOneShot: if (mStartFrame > mEndFrame) { //Forward animation. Start cannot be greater than end frame return -1; } mFrameDir = 1; break; case FrameMode.ForwardLoop: if (mStartFrame > mEndFrame) { //Forward animation. Start cannot be greater than end frame return -1; } mFrameDir = 1; break; case FrameMode.BackwardOneShot: if (mStartFrame < mEndFrame) { //Backware animation. Start cannot be less than end frame return -1; } mFrameDir = -1; break; case FrameMode.BackwardLoop: if (mStartFrame < mEndFrame) { //Backware animation. Start cannot be less than end frame return -1; } mFrameDir = -1; break; case FrameMode.Bounce: if (mStartFrame > mEndFrame) { //Forward animation. Start cannot be greater than end frame return -1; } mFrameDir = 1; break; } //Setup variables mStartFrame = StartVal; mEndFrame = EndVal; mCurFrame = StartVal; mFPS = Speed; mFrameMode = AnimMode; //Show the first frame ShowFrame(mCurFrame); //Cancel and current animation CancelInvoke("FrameHandler"); //Initiate animation InvokeRepeating("FrameHandler", (1f/mFPS), (1f/mFPS)); return 0; }
/// <summary>Used to get a PixyCam Frame.</summary> /// <param name="Mode">Image mode</param> /// <param name="X">X offset to use to grab image data</param> /// <param name="Y">Y offset to use to grab image data</param> /// <param name="Width">Image width</param> /// <param name="Height">Image height</param> /// <returns></returns> public byte[] GetFrame(FrameMode Mode, int X, int Y, int Width, int Height) { if (Mode == FrameMode.Size1280x800 && (Width > 1280 || Width < 1 || Height > 800 || Height < 1)) throw new Exception("Illegal frame size for selected frame mode!"); if (Mode == FrameMode.Size640x400 && (Width > 640 || Width < 1 || Height > 400 || Height < 1)) throw new Exception("Illegal frame size for selected frame mode!"); if (Mode == FrameMode.Size320x200 && (Width > 320 || Width < 1 || Height > 200 || Height < 1)) throw new Exception("Illegal frame size for selected frame mode!"); IntPtr current_frame; uint size = 0; pixy_cam_getFrame((int)Mode, X, Y, Width, Height, out current_frame, out size); byte[] memStorage = new byte[size]; Marshal.Copy(current_frame, memStorage, 0, Convert.ToInt32(size)); return memStorage; }
} // 0x00B0A0D0-0x00B0A0E0 public void SetFrameMode(FrameMode eMode) { } // 0x00B0A0E0-0x00B0A100
private static Color32 GetUniqueColor(int nSlot) => default; // 0x00B09760-0x00B09800 public static ColorType GetDefaultTextColor(FrameMode eFrameMode, bool bForceTalkColor = false /* Metadata: 0x00613F61 */) => default; // 0x00B09800-0x00B09840
//Start frame animation public int StartFPS(int StartVal, int EndVal, float Speed, FrameMode AnimMode) { //Check input values if (StartVal < 1) { //Start frame is less than 1 return(-1); } if (EndVal > mAnimMaxFrames) { //End frame is greater then max frames return(-1); } if ((Speed < 0f) || (Speed > mAnimMaxFrames)) { //FPS is negative or more than max frames return(-1); } //Check value ranges if (StartVal == EndVal) { //Start and End frames are the same. No animation needed return(-1); } switch (AnimMode) { case FrameMode.ForwardOneShot: if (mStartFrame > mEndFrame) { //Forward animation. Start cannot be greater than end frame return(-1); } mFrameDir = 1; break; case FrameMode.ForwardLoop: if (mStartFrame > mEndFrame) { //Forward animation. Start cannot be greater than end frame return(-1); } mFrameDir = 1; break; case FrameMode.BackwardOneShot: if (mStartFrame < mEndFrame) { //Backware animation. Start cannot be less than end frame return(-1); } mFrameDir = -1; break; case FrameMode.BackwardLoop: if (mStartFrame < mEndFrame) { //Backware animation. Start cannot be less than end frame return(-1); } mFrameDir = -1; break; case FrameMode.Bounce: if (mStartFrame > mEndFrame) { //Forward animation. Start cannot be greater than end frame return(-1); } mFrameDir = 1; break; } //Setup variables mStartFrame = StartVal; mEndFrame = EndVal; mCurFrame = StartVal; mFPS = Speed; mFrameMode = AnimMode; //Show the first frame ShowFrame(mCurFrame); //Cancel and current animation CancelInvoke("FrameHandler"); //Initiate animation InvokeRepeating("FrameHandler", (1f / mFPS), (1f / mFPS)); return(0); }