Exemplo n.º 1
0
        void DoReturn(IGifValue returnValue)
        {
            if (stack.Count == 0)
            {
                halted = true;
                return;
            }
            else
            {
                GifStackFrame returnFrame = stack.Pop();
                runningRegister = returnFrame.runningRegister;

                switch (returnFrame.RHSInstruction)
                {
                case 0xCCC:     // Assign
                    bool failure;
                    returnValue.Write(returnFrame.LHSValue.Read(), out failure);
                    if (failure)
                    {
                        DoReturn(returnValue);
                    }
                    break;

                case 0xC8C:     // Call
                    stack.Push(new GifStackFrame(returnFrame.runningRegister));
                    current         = returnFrame.LHSValue;
                    runningRegister = returnValue.Read();
                    break;

                case 0xCC4:     // Retarget
                    ColorRGB lhsColor = returnFrame.LHSValue.Read();
                    ColorRGB rhsColor = returnValue.Read();
                    registerTargets[rhsColor.R16, rhsColor.G16, rhsColor.B16] = registerTargets[lhsColor.R16, lhsColor.G16, lhsColor.B16];
                    current = new GifCursor(rhsColor, GetRegisterPosition(rhsColor), GetRegisterTarget(rhsColor));
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 2
0
 void DrawGifValue(IGifValue value, Vector2 pos, Vector2 size)
 {
     if (value is GifCursor)
     {
         GifCursor cursor = (GifCursor)value;
         DrawCell(cursor.cube, cursor.position.R16, cursor.position.G16, cursor.position.B16, pos, size);
     }
     else
     {
         DrawColorBlock(value.Read(), pos, size);
     }
 }