public TouchScreen(InputI input) : base(input) { this.input = (Input)input; this.input.UpdateCallback += Update; Touches = new Touch[10]; touchOn = new bool[10]; touchLocations = new Vector2[10]; for (int i = 0; i != Touches.Length; ++i) { Touches[i] = new Touch(); touchLocations[i] = new Vector2(); } }
public override void Shown() { try { root = new RootDisposable(); VideoTypes videoType; //video = Video.Init(VideoTypes.D3D11 | VideoTypes.D3D9 | VideoTypes.OpenGL | VideoTypes.XNA | VideoTypes.Vita, out videoType, root, this, true); video = Video.Init(VideoTypes.D3D11, out videoType, root, this, true); DiffuseTextureMaterial.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null); DiffuseTextureMaterial.ApplyInstanceConstantsCallback = applyInstanceData; var materialTypes = new Dictionary<string,Type>(); materialTypes.Add("Material", typeof(DiffuseTextureMaterial)); materialTypes.Add("Material.001", typeof(DiffuseTextureMaterial)); var materialFieldTypes = new List<MaterialFieldBinder>(); materialFieldTypes.Add(new MaterialFieldBinder("Material", "Roxy_dds", "Diffuse")); materialFieldTypes.Add(new MaterialFieldBinder("Material.001", "Wolf_dds", "Diffuse")); var extOverrides = new Dictionary<string,string>(); #if SILVERLIGHT || VITA || (LINUX && ARM) extOverrides.Add(".dds", ".png"); #endif #if iOS extOverrides.Add(".dds", ".pvr"); #endif #if ANDROID if (((Reign.Video.OpenGL.Video)video).Caps.TextureCompression_ATC) extOverrides.Add(".dds", ".atc"); else if (((Reign.Video.OpenGL.Video)video).Caps.TextureCompression_PVR) extOverrides.Add(".dds", ".pvr"); #endif var emptyBinders = new List<MaterialFieldBinder>(); model = new Model(video, "Data/boxes.rm", "Data/", materialTypes, emptyBinders, emptyBinders, emptyBinders, emptyBinders, materialFieldTypes, extOverrides, 0, null); var frame = FrameSize; viewPort = ViewPortAPI.New(video, 0, 0, frame.Width, frame.Height); camera = new Camera(viewPort, new Vector3(5, 5, 5), new Vector3(), new Vector3(5, 5+1, 5), 1, 50, MathUtilities.DegToRad(45)); rasterizerState = RasterizerStateAPI.New(video, RasterizerStateDescAPI.New(RasterizerStateTypes.Solid_CullCW)); depthStencilState = DepthStencilStateAPI.New(video, DepthStencilStateDescAPI.New(DepthStencilStateTypes.ReadWrite_Less)); blendState = BlendStateAPI.New(video, BlendStateDescAPI.New(BlendStateTypes.None)); samplerState = SamplerStateAPI.New(video, SamplerStateDescAPI.New(SamplerStateTypes.Linear_Wrap)); InputTypes inputType; input = Input.Init(InputTypes.WinForms, out inputType, root, this); mouse = MouseAPI.New(input); keyboard = KeyboardAPI.New(input); // ----------------------- FontMaterial.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null); var fontTexture = Texture2DAPI.New(video, "Data/WhiteFont.png", null); font = new Font(video, FontMaterial.Shader, fontTexture, "Data/WhiteFont.font", null); UISolidColorMaterial.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null); UISolidTextureMaterial.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null); UISolidTexture2Material.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null); UISolidTexture3Material.Init(video, "Data/", video.FileTag, ShaderVersions.Max, null); ui = new UI(root, video, UISolidColorMaterial.Shader, UISolidTextureMaterial.Shader, UISolidTexture2Material.Shader, UISolidTexture3Material.Shader, font, 16, mouse); button = new Reign.UI.Button(ui, "Hello World!", 10, 10, 128, 32); ui.AddElement(button); var idleTexture = Texture2DAPI.New(video, "Data/PlayIdle.png", null); var rolloverTexture = Texture2DAPI.New(video, "Data/PlayRollover.png", null); var pressedTexture = Texture2DAPI.New(video, "Data/PlayPressed.png", null); buttonImage = new ButtonImage(ui, idleTexture, rolloverTexture, pressedTexture, 400, 10, 64, 64); ui.AddElement(buttonImage); // ----------------------- loaded = true; } catch (Exception e) { dispose(); Message.Show("Error", e.Message); } }