Esempio n. 1
0
        bool keyboardHook_KeyUp(RamGecTools.KeyboardHook.VKeys key)
        {
            if (DEV)
            {
                if (key == RamGecTools.KeyboardHook.VKeys.KEY_F)
                {
                    for (int i = 0; i < FriedChiken.nParticles; i++)
                    {
                        FriedChiken.x[i * 3 + 0] += (rand.NextDouble() - 0.5) * 50d;
                        FriedChiken.x[i * 3 + 1] += (rand.NextDouble() - 0.5) * 50d;
                        FriedChiken.x[i * 3 + 2] += (rand.NextDouble() - 0.5) * 50d;
                    }
                    return(true);
                }

                if (key == RamGecTools.KeyboardHook.VKeys.KEY_E)
                {
                    if (_IF)
                    {
                        _IF = false;
                        full.offIF();
                    }
                    else
                    {
                        _IF = true;
                        full.onIF();
                    }
                    return(true);
                }
                if (key == RamGecTools.KeyboardHook.VKeys.KEY_R)
                {
                    if (_RP)
                    {
                        _RP = false;
                        full.offRF();
                    }
                    else
                    {
                        _RP = true;
                        full.onRF();
                    }
                    return(true);
                }

                if (key == RamGecTools.KeyboardHook.VKeys.KEY_N)
                {
                    if (_normalize)
                    {
                        _normalize = false;
                        full.offNorm();
                    }
                    else
                    {
                        _normalize = true;
                        full.onNorm();
                    }
                    return(true);
                }

                if (key == RamGecTools.KeyboardHook.VKeys.KEY_H)
                {
                    if (_geodesic)
                    {
                        _geodesic = false;
                        full.offGeo();
                    }
                    else
                    {
                        _geodesic = true;
                        full.onGeo();
                    }
                    return(true);
                }

                if (key == RamGecTools.KeyboardHook.VKeys.KEY_A)
                {
                    if (_drift1)
                    {
                        _drift1 = false;
                        _drift2 = true;
                        _drift3 = false;
                        full.drift2();
                        full.renewPlot(Drift2);
                    }
                    else if (_drift2)
                    {
                        _drift1 = false;
                        _drift2 = false;
                        _drift3 = true;
                        full.drift3();
                        full.renewPlot(Drift3);
                    }
                    else if (_drift3)
                    {
                        _drift1 = false;
                        _drift2 = false;
                        _drift3 = false;
                        full.drift0();
                        full.renewPlot(Drift0);
                    }
                    else
                    {
                        _drift1 = true;
                        _drift2 = false;
                        _drift3 = false;
                        full.drift1();
                        full.renewPlot(Drift1);
                    }
                    return(true);
                }
            }

            if (key == RamGecTools.KeyboardHook.VKeys.ESCAPE)
            {
                full.resetGo();
                full.clearNorm();
                _go           = false;
                timer.Enabled = false;
                if (t != 0 && refX != null)
                {
                    t = 0;
                    for (int i = 0; i < FriedChiken.x.rawData.Length; i++)
                    {
                        FriedChiken.x.rawData[i] = refX[i];
                    }
                    FriedChiken.Tick(t); //要素アップデート、勾配の計算
                    FriedChiken.Tack(t); //マスク等後処理
                    refX = null;
                }
                ExpireSolution(true);
                return(true);
            }
            if (key == RamGecTools.KeyboardHook.VKeys.KEY_G)
            {
                if (_go)
                {
                    full.pauseGo();

                    _go           = false;
                    timer.Enabled = false;
                }
                else
                {
                    full.onGo();

                    _go           = true;
                    timer.Enabled = true;
                }
                return(true);
            }
            if (key == RamGecTools.KeyboardHook.VKeys.KEY_T)
            {
                if (_VN)
                {
                    _VN = false;
                    full.offVN();
                }
                else
                {
                    _VN = true;
                    full.onVN();
                }
                return(true);
            }
            return(false);
        }