예제 #1
0
        void Update()
        {
            if (Input.GetKeyDown(triggerBypass))
            {
                bypass = !bypass;
            }

            if (Input.GetKeyDown(triggerNext))
            {
                int blendModeIndex = (int)blendMode + 1;
                if (blendModeIndex >= blendModesCount)
                {
                    blendModeIndex = 0;
                }
                blendMode = (BlendModes)blendModeIndex;
                SendBlendmodeChange(blendMode);
            }

            if (Input.GetKeyDown(triggerPrevious))
            {
                int blendModeIndex = (int)blendMode - 1;
                if (blendModeIndex < 0)
                {
                    blendModeIndex = blendModesCount - 1;
                }
                blendMode = (BlendModes)blendModeIndex;
                SendBlendmodeChange(blendMode);
            }

            if (deltaBlendMode != blendMode)
            {
                material.SetFloat("blendMode", (int)blendMode);
            }
            deltaBlendMode = blendMode;
        }
예제 #2
0
 /// <summary>
 /// Draws an image on screen.
 /// </summary>
 /// <param name="image">Image to draw.</param>
 /// <param name="position">Drawing position.</param>
 /// <param name="size">Drawing size.</param>
 /// <param name="blend">Blend mode.</param>
 /// <param name="sourceRect">Source rectangle to draw.</param>
 /// <param name="origin">Rotation and source position origin (relative to size).</param>
 /// <param name="rotation">Rotation, in degrees.</param>
 /// <param name="color">Tint color.</param>
 public void DrawImage(ImageAsset image, PointF position, PointI size, BlendModes blend, RectangleI sourceRect, PointF origin, float rotation, Color color)
 {
     if (!image.HaveHandle)
     {
         throw new Exception("Tried to render an image without handle!");
     }
     _BonEngineBind.BON_Gfx_DrawImageEx(image._handle, position.X, position.Y, size.X, size.Y, (int)blend, sourceRect.X, sourceRect.Y, sourceRect.Width, sourceRect.Height, origin.X, origin.Y, rotation, color.R, color.G, color.B, color.A);
 }
예제 #3
0
 /// <summary>
 /// Draws an image on screen.
 /// </summary>
 /// <param name="image">Image to draw.</param>
 /// <param name="position">Drawing position.</param>
 /// <param name="size">Drawing size.</param>
 /// <param name="blend">Blend mode.</param>
 public void DrawImage(ImageAsset image, PointF position, PointI size, BlendModes blend = BlendModes.AlphaBlend)
 {
     if (!image.HaveHandle)
     {
         throw new Exception("Tried to render an image without handle!");
     }
     _BonEngineBind.BON_Gfx_DrawImage(image._handle, position.X, position.Y, size.X, size.Y, (int)blend);
 }
예제 #4
0
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.M))
            {
                bypass = !bypass;
            }

            if (Input.GetKeyDown(KeyCode.RightBracket))
            {
                int blendModeIndex = (int)blendMode + 1;
                if (blendModeIndex >= blendModesCount)
                {
                    blendModeIndex = 0;
                }
                blendMode = (BlendModes)blendModeIndex;
                SendBlendmodeChange(blendMode);
            }

            if (Input.GetKeyDown(KeyCode.LeftBracket))
            {
                int blendModeIndex = (int)blendMode - 1;
                if (blendModeIndex < 0)
                {
                    blendModeIndex = blendModesCount - 1;
                }
                blendMode = (BlendModes)blendModeIndex;
                SendBlendmodeChange(blendMode);
            }

            if (deltaBlendMode != blendMode)
            {
                material.SetFloat("blendMode", (int)blendMode);
            }
            deltaBlendMode = blendMode;
        }
예제 #5
0
 void SendBlendmodeChange(BlendModes b)
 {
     if (OnSwitched != null)
         OnSwitched(b);
 }
예제 #6
0
파일: lwf_core.cs 프로젝트: rayyee/lwf
	public LWF(Data lwfData, IRendererFactory r)
#endif
	{
		m_data = lwfData;

		interactive = m_data.buttonConditions.Length > 0;
		m_frameRate = m_data.header.frameRate;
		m_execLimit = 3;
		m_frameSkip = true;
		m_tick = 1.0f / m_frameRate;
		m_roundOffTick = m_tick * ROUND_OFF_TICK_RATE;
		m_attachVisible = true;
		m_interceptByNotAllowOrDenyButtons = true;
		m_intercepted = false;
		scaleByStage = 1.0f;
		m_needsUpdate = false;
		m_needsUpdateForAttachLWF = false;
		m_pointX = Single.MinValue;
		m_pointY = Single.MinValue;
		m_pressing = false;
		m_instanceId = ++m_instanceOffset;
		m_alive = true;
#if LWF_USE_LUA
		m_luaState = l;
		m_instanceIdString = instanceId.ToString();
		InitLua();
#endif

		if (!interactive && m_data.frames.Length == 1)
			DisableExec();

		m_property = new Property(this);
		m_instances = new IObject[m_data.instanceNames.Length];
		InitEvent();
		m_movieCommands = new MovieCommands();
		m_programObjectConstructors =
			new ProgramObjectConstructor[m_data.programObjects.Length];
		m_textDictionary = new TextDictionary();

		m_matrix = new Matrix();
		m_matrixIdentity = new Matrix();
		m_execMatrix = new Matrix();
		m_colorTransform = new ColorTransform();
		m_colorTransformIdentity = new ColorTransform();
		m_execColorTransform = new ColorTransform();
		m_blendModes = new BlendModes();
		m_maskModes = new MaskModes();

		Init();

		SetRendererFactory(r);
	}
예제 #7
0
 public void SetBlendMode(int mode)
 {
     _mode = (BlendModes)mode;
     switch (_mode)
     {
         case BlendModes.Blend:
             _states.BlendMode = BlendMode.Alpha;
             break;
         case BlendModes.Replace:
             _states.BlendMode = BlendMode.None;
             break;
         case BlendModes.Add:
             _states.BlendMode = BlendMode.Add;
             break;
         case BlendModes.Multiply:
             _states.BlendMode = BlendMode.Multiply;
             break;
     }
     _batch.Flush();
     _batch.SetBlendMode(_states.BlendMode);
 }
예제 #8
0
    void Update()
    {
        #if UNITY_EDITOR
        if (Application.isPlaying!=true)
        {
            SCShader = Shader.Find("Custom/MomoMirror");
        }

        #endif

        if (Input.GetKeyDown(KeyCode.M))
        {
            bypass = !bypass;
        }

        if (Input.GetKeyDown(KeyCode.RightBracket))
        {
            int blendModeIndex = (int)blendMode + 1;
            if (blendModeIndex >= blendModesCount) {
                blendModeIndex = 0;
            }
            blendMode = (BlendModes)blendModeIndex;
        }

        if (Input.GetKeyDown(KeyCode.LeftBracket))
        {
            int blendModeIndex = (int)blendMode - 1;
            if (blendModeIndex < 0)
            {
                blendModeIndex = blendModesCount - 1;
            }
            blendMode = (BlendModes)blendModeIndex;
        }

        if (deltaBlendMode != blendMode)
        {
            material.SetFloat("blendMode", (int)blendMode);
            UpdateLabel();
        }
        deltaBlendMode = blendMode;
    }
예제 #9
0
        private void Init()
        {
            PopulateFunctions();
            _tex = new Texture((uint)_width, (uint)_height);
            _tex.Smooth = GlobalProps.SmoothTextures;

            Update();
            _mode = BlendModes.Blend;

            DefineProperty("width", new PropertyDescriptor((int)_width, PropertyAttributes.Sealed), true);
            DefineProperty("height", new PropertyDescriptor((int)_height, PropertyAttributes.Sealed), true);
        }
예제 #10
0
 public void SetBlendMode(int mode)
 {
     _mode = (BlendModes)mode;
 }
예제 #11
0
        public static void SetPixelFast(byte* buffer, int offset, int c2, BlendModes m)
        {
            int* p = (int*)buffer + offset;

            if (m == BlendModes.Blend)
            {
                int c1 = *p;
                float w = (float)(c2 >> 24 & 0xff) / 255;

                int a1 = (c1 >> 24 & 0xff);
                int b1 = ((c1 & 0xff0000) >> 16);
                int g1 = ((c1 & 0xff00) >> 8);
                int r1 = (c1 & 0xff);

                int a2 = (c2 >> 24 & 0xff);
                int b2 = ((c2 & 0xff0000) >> 16);
                int g2 = ((c2 & 0xff00) >> 8);
                int r2 = (c2 & 0xff);

                int a = a1 > a2 ? a1 : a2;
                int b = (int)(w * (b2 - b1) + b1);
                int g = (int)(w * (g2 - g1) + g1);
                int r = (int)(w * (r2 - r1) + r1);

                *p = a << 24 | b << 16 | g << 8 | r;
            }
            else
                *p = c2;
        }
예제 #12
0
 /// <summary>
 /// Draws an image on screen.
 /// </summary>
 /// <param name="image">Image to draw.</param>
 /// <param name="position">Drawing position.</param>
 /// <param name="size">Drawing size.</param>
 /// <param name="blend">Blend mode.</param>
 /// <param name="sourceRect">Source rectangle to draw.</param>
 public void DrawImage(ImageAsset image, PointF position, PointI size, BlendModes blend, RectangleI sourceRect)
 {
     DrawImage(image, position, size, blend, sourceRect, PointF.Zero, 0.0f, Color.White);
 }
예제 #13
0
 /// <summary>
 /// Draws an image on screen.
 /// </summary>
 /// <param name="image">Image to draw.</param>
 /// <param name="position">Drawing position.</param>
 /// <param name="size">Drawing size.</param>
 /// <param name="blend">Blend mode.</param>
 public void DrawImage(ImageAsset image, PointF position, PointI size, BlendModes blend = BlendModes.AlphaBlend)
 {
     _BonEngineBind.BON_Gfx_DrawImage(image._handle, position.X, position.Y, size.X, size.Y, (int)blend);
 }
예제 #14
0
 /// <summary>
 /// Draws a circle.
 /// </summary>
 /// <param name="center">Circle center.</param>
 /// <param name="radius">Circle radius.</param>
 /// <param name="color">Drawing color.</param>
 /// <param name="filled">Draw filled / hollow circle.</param>
 /// <param name="blend">Blend mode.</param>
 public void DrawCircle(PointI center, int radius, Color color, bool filled, BlendModes blend = BlendModes.AlphaBlend)
 {
     _BonEngineBind.BON_Gfx_DrawCircle(center.X, center.Y, radius, color.R, color.G, color.B, color.A, filled, (int)blend);
 }
예제 #15
0
 /// <summary>
 /// Draws a rectangle.
 /// </summary>
 /// <param name="rectangle">Rectangle to draw.</param>
 /// <param name="color">Drawing color.</param>
 /// <param name="filled">Draw filled / hollow rectangle.</param>
 /// <param name="blend">Blend mode.</param>
 public void DrawRectangle(RectangleI rectangle, Color color, bool filled, BlendModes blend = BlendModes.AlphaBlend)
 {
     _BonEngineBind.BON_Gfx_DrawRectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, color.R, color.G, color.B, color.A, filled, (int)blend);
 }
예제 #16
0
 /// <summary>
 /// Draws an image on screen.
 /// </summary>
 /// <param name="image">Image to draw.</param>
 /// <param name="position">Drawing position.</param>
 /// <param name="blend">Blend mode.</param>
 public void DrawImage(ImageAsset image, PointF position, BlendModes blend = BlendModes.AlphaBlend)
 {
     DrawImage(image, position, PointI.Zero, blend);
 }