internal void begin() { if (_renderers.length == 0) { addRenderer(new DefaultRenderer()); Debug.warn("Scene has begun with no renderer. A DefaultRenderer was added automatically so that something is visible."); } Physics.reset(); // prep our render textures updateResolutionScaler(); Core.graphicsDevice.setRenderTarget(_sceneRenderTarget); if (entityProcessors != null) { entityProcessors.begin(); } Core.emitter.addObserver(CoreEvents.GraphicsDeviceReset, onGraphicsDeviceReset); _didSceneBegin = true; onStart(); }
public static bool areParametersValid(ParameterInfo[] parameters) { if (parameters.Length == 0) { return(true); } if (parameters.Length > 1) { Debug.warn($"method {parameters[0].Member.Name} has InspectorCallableAttribute but it has more than 1 parameter"); return(false); } var paramType = parameters[0].ParameterType; if (paramType == typeof(int) || paramType == typeof(float) || paramType == typeof(string) || paramType == typeof(bool)) { return(true); } Debug.warn($"method {parameters[0].Member.Name} has InspectorCallableAttribute but it has an invalid paraemter type {paramType}"); return(false); }
public static void applyChanges() { //_graphicsManager.ApplyChanges(); Debug.warn("noop. applyChanges doesnt work properly on OS X. It causes a crash with no stack trace due to a MonoGame bug."); }
/// <summary> /// gets an Inspector subclass that can handle valueType. If no default Inspector is available the memberInfo custom attributes /// will be checked for the CustomInspectorAttribute. /// </summary> /// <returns>The inspector for type.</returns> /// <param name="valueType">Value type.</param> /// <param name="memberInfo">Member info.</param> protected static Inspector getInspectorForType(Type valueType, object target, MemberInfo memberInfo) { // built-in types if (valueType == typeof(int)) { return(new IntInspector()); } if (valueType == typeof(float)) { return(new FloatInspector()); } if (valueType == typeof(bool)) { return(new BoolInspector()); } if (valueType == typeof(string)) { return(new StringInspector()); } if (valueType == typeof(Vector2)) { return(new Vector2Inspector()); } if (valueType == typeof(Color)) { return(new ColorInspector()); } if (valueType.GetTypeInfo().IsEnum) { return(new EnumInspector()); } if (valueType.GetTypeInfo().IsValueType) { return(new StructInspector()); } // check for custom inspectors before checking Nez types in case a subclass implemented one var customInspectorType = valueType.GetTypeInfo().GetCustomAttribute <CustomInspectorAttribute>(); if (customInspectorType != null) { if (customInspectorType.inspectorType.GetTypeInfo().IsSubclassOf(typeof(Inspector))) { return((Inspector)Activator.CreateInstance(customInspectorType.inspectorType)); } Debug.warn($"found CustomInspector {customInspectorType.inspectorType} but it is not a subclass of Inspector"); } // Nez types if (valueType == typeof(Material)) { return(getMaterialInspector(target)); } if (valueType.GetTypeInfo().IsSubclassOf(typeof(Effect))) { return(getEffectInspector(target, memberInfo)); } //Debug.log( $"no inspector for type {valueType}" ); return(null); }