Exemplo n.º 1
0
        /// <summary>
        /// Initialize the subsystem
        /// </summary>
        /// <param name="api">Reference to subsystem wrapper</param>
        /// <returns>True if successful</returns>
        public bool Initialize(RBAPI api)
        {
            mRetroBlitAPI = api;

            var audioSourceObj = GameObject.Find("RetroBlitAudio");

            if (audioSourceObj == null)
            {
                Debug.Log("Can't find RetroBlitAudio! Does your RetroBlit object no longer match the RetroBlit prefab?");
                return(false);
            }

            mAudioListenerObj = GameObject.Find("RetroBlitAudioListener");
            if (mAudioListenerObj == null)
            {
                Debug.Log("Can't find RetroBlitAudioListener! Does your RetroBlit object no longer match the RetroBlit prefab?");
                return(false);
            }

            InitializeChannels();

            SoundListenerPosSet(Vector2i.zero);

            previousMusicClip            = null;
            currentMusicClip             = null;
            mPreviousMusicClipVolumeFade = 0;

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initialize subsystem
        /// </summary>
        /// <param name="api">Subsystem wrapper reference</param>
        /// <returns>True if successful</returns>
        public bool Initialize(RBAPI api)
        {
            mRetroBlitAPI = api;

            if (!VerifyInputManagerSettings())
            {
                Debug.LogError("InputManager is not setup properly for RetroBlit. Please import RetroBlit project as a complete project from the Asset Manager in order to also import the RetroBlit InputManager settings. Alternatively you can copy ProjectSettings/InputManager.asset from another RetroBlit project.");
                return(false);
            }

            mButtonCount = (int)Mathf.Log(BUTTON_LAST, 2) + 1;

            for (int i = 0; i < RBHardware.HW_MAX_PLAYERS; i++)
            {
                mButtonCurrentState[i]  = new Dictionary <int, bool>();
                mButtonPreviousState[i] = new Dictionary <int, bool>();
            }

            for (int i = 0; i < MAX_TOUCHES; i++)
            {
                mPointer[i].Reset();
            }

            GetAllButtonStates(mButtonCurrentState);

            // Disable Unity mouse simulation with touches, we'll handle this ourselves.
            UnityEngine.Input.simulateMouseWithTouches = false;

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initialize the subsystem
        /// </summary>
        /// <param name="api">Reference to subsystem wrapper</param>
        /// <returns>True if successful</returns>
        public bool Initialize(RBAPI api)
        {
            for (int i = 0; i < MAX_SAMPLE_POINTS; i++)
            {
                mUpdateDeltas[i] = -1;
            }

            mRetroBlitAPI = api;
            return(true);
        }
Exemplo n.º 4
0
#pragma warning restore 0414

        /// <summary>
        /// Initialize the subsystem
        /// </summary>
        /// <param name="api">Reference to subsystem wrapper</param>
        /// <returns>True if successful</returns>
        public bool Initialize(RBAPI api)
        {
            mRetroBlitAPI = api;

            for (int i = 0; i < mParams.Length; i++)
            {
                mParams[i] = new EffectParams();
            }

            EffectReset();

            return true;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Initialize subsystem
        /// </summary>
        /// <param name="api">Subsystem wrapper reference</param>
        /// <returns>True if successful</returns>
        public bool Initialize(RBAPI api)
        {
            mRetroBlitAPI = api;

            var pixelCameraGameObj = GameObject.Find("RetroBlitPixelCamera");

            if (pixelCameraGameObj == null)
            {
                Debug.LogError("Can't find RetroBlitPixelCamera gameObject! Is your scene setup correctly for RetroBlit?");
                return(false);
            }

            mPixelCamera = pixelCameraGameObj.GetComponent <Camera>();
            if (mPixelCamera == null)
            {
                Debug.LogError("RetroBlitPixelCamera gameObject does not contain a camera! Is your scene setup correctly for RetroBlit?");
                return(false);
            }

            var presentCameraGameObj = GameObject.Find("RetroBlitPresentCamera");

            if (pixelCameraGameObj == null)
            {
                Debug.LogError("Can't find RetroBlitPresentCamera gameObject! Is your scene setup correctly for RetroBlit?");
                return(false);
            }

            mPresentCamera = presentCameraGameObj.GetComponent <Camera>();
            if (mPresentCamera == null)
            {
                Debug.LogError("RetroBlitPresentCamera gameObject does not contain a camera! Is your scene setup correctly for RetroBlit?");
                return(false);
            }

            if (RB.DisplaySize.width <= 0 || RB.DisplaySize.height <= 0)
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// Initialize subsystem
        /// </summary>
        /// <param name="api">Subsystem wrapper reference</param>
        /// <returns>True if successful</returns>
        public bool Initialize(RBAPI api)
        {
            mPropIDPixelTexture          = Shader.PropertyToID("_PixelTexture");
            mPropIDPixelTextureSize      = Shader.PropertyToID("_PixelTextureSize");
            mPropIDPresentSize           = Shader.PropertyToID("_PresentSize");
            mPropIDSystemTexture         = Shader.PropertyToID("_SystemTexture");
            mPropIDSampleFactor          = Shader.PropertyToID("_SampleFactor");
            mPropIDScanlineIntensity     = Shader.PropertyToID("_ScanlineIntensity");
            mPropIDScanlineOffset        = Shader.PropertyToID("_ScanlineOffset");
            mPropIDScanlineLength        = Shader.PropertyToID("_ScanlineLength");
            mPropIDNearestEvenScanHeight = Shader.PropertyToID("_NearestEvenScanHeight");
            mPropIDDesaturationIntensity = Shader.PropertyToID("_DesaturationIntensity");
            mPropIDNoiseIntensity        = Shader.PropertyToID("_NoiseIntensity");
            mPropIDNoiseSeed             = Shader.PropertyToID("_NoiseSeed");
            mPropIDCurvatureIntensity    = Shader.PropertyToID("_CurvatureIntensity");
            mPropIDColorFade             = Shader.PropertyToID("_ColorFade");
            mPropIDColorFadeIntensity    = Shader.PropertyToID("_ColorFadeIntensity");
            mPropIDColorTint             = Shader.PropertyToID("_ColorTint");
            mPropIDColorTintIntensity    = Shader.PropertyToID("_ColorTintIntensity");
            mPropIDFizzleColor           = Shader.PropertyToID("_FizzleColor");
            mPropIDFizzleIntensity       = Shader.PropertyToID("_FizzleIntensity");
            mPropIDNegativeIntensity     = Shader.PropertyToID("_NegativeIntensity");
            mPropIDPixelateIntensity     = Shader.PropertyToID("_PixelateIntensity");

            mRetroBlitAPI = api;

            var pixelCameraGameObj = GameObject.Find("RetroBlitPixelCamera");

            if (pixelCameraGameObj == null)
            {
                Debug.LogError("Can't find RetroBlitPixelCamera gameObject! Is your scene setup correctly for RetroBlit?");
                return(false);
            }

            mPixelCamera = pixelCameraGameObj.GetComponent <Camera>();
            if (mPixelCamera == null)
            {
                Debug.LogError("RetroBlitPixelCamera gameObject does not contain a camera! Is your scene setup correctly for RetroBlit?");
                return(false);
            }

            var presentCameraGameObj = GameObject.Find("RetroBlitPresentCamera");

            if (pixelCameraGameObj == null)
            {
                Debug.LogError("Can't find RetroBlitPresentCamera gameObject! Is your scene setup correctly for RetroBlit?");
                return(false);
            }

            mPresentCamera = presentCameraGameObj.GetComponent <Camera>();
            if (mPresentCamera == null)
            {
                Debug.LogError("RetroBlitPresentCamera gameObject does not contain a camera! Is your scene setup correctly for RetroBlit?");
                return(false);
            }

            if (RB.DisplaySize.width <= 0 || RB.DisplaySize.height <= 0)
            {
                return(false);
            }

            var material = mRetroBlitAPI.ResourceBucket.LoadMaterial("PresentMaterial");

            mPresentMaterial = new Material(material);

            material = mRetroBlitAPI.ResourceBucket.LoadMaterial("PresentRetroMaterial");
            mPresentRetroMaterial = new Material(material);

            material = mRetroBlitAPI.ResourceBucket.LoadMaterial("PresentRetroNoiseMaterial");
            mPresentRetroNoiseMaterial = new Material(material);

            mCurrentPresentMaterial = mPresentMaterial;

            return(true);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initialize the subsystem wrapper
        /// </summary>
        /// <param name="settings">Hardware settings to initialize with</param>
        /// <returns>True if successful</returns>
        public bool Initialize(RB.HardwareSettings settings)
        {
            // Store the main thread for later reference
            mainThread = System.Threading.Thread.CurrentThread;

            ResourceBucket = gameObject.GetComponent <RBResourceBucket>();
            if (ResourceBucket == null)
            {
                return(false);
            }

            HW = new RBHardware();
            if (HW == null || !HW.Initialize(settings))
            {
                return(false);
            }

            var pixelCameraObj = GameObject.Find("RetroBlitPixelCamera");

            if (pixelCameraObj == null)
            {
                Debug.Log("Can't find RetroBlitPixelCamera game object, is your RetroBlit scene setup correctly?");
                return(false);
            }

            PixelCamera = pixelCameraObj.GetComponent <RBPixelCamera>();
            if (PixelCamera == null || !PixelCamera.Initialize(this))
            {
                return(false);
            }

            var presentCameraObj = GameObject.Find("RetroBlitPresentCamera");

            if (presentCameraObj == null)
            {
                Debug.Log("Can't find RetroBlitPresentCamera game object, is your RetroBlit scene setup correctly?");
                return(false);
            }

            PresentCamera = presentCameraObj.GetComponent <RBPresentCamera>();
            if (PresentCamera == null || !PresentCamera.Initialize(this))
            {
                return(false);
            }

            AssetManager = new RBAssetManager();
            if (AssetManager == null)
            {
                return(false);
            }

            Renderer = new RBRenderer();
            if (Renderer == null || !Renderer.Initialize(this))
            {
                return(false);
            }

            Font = new RBFont();
            if (Font == null || !Font.Initialize(this))
            {
                return(false);
            }

            Tilemap = new RBTilemapTMX();
            if (Tilemap == null || !Tilemap.Initialize(this))
            {
                return(false);
            }

            Input = new RBInput();
            if (Input == null || !Input.Initialize(this))
            {
                return(false);
            }

            var audioObj = GameObject.Find("RetroBlitAudio");

            if (audioObj == null)
            {
                Debug.Log("Can't find RetroBlitAudio game object");
                return(false);
            }

            Audio = audioObj.GetComponent <RBAudio>();
            if (Audio == null || !Audio.Initialize(this))
            {
                return(false);
            }

            Effects = new RBEffects();
            if (Effects == null || !Effects.Initialize(this))
            {
                return(false);
            }

            Perf = new RBPerf();
            if (Perf == null || !Perf.Initialize(this))
            {
                return(false);
            }

            // Unload all assets that were waiting for main thread to get unloaded. These could be from a previously
            // initialized game.
            AssetManager.UnloadAllMainThread();

            instance = this;

            // Collect garbage
            System.GC.Collect();

            return(true);
        }