void OnGUI() { KitchenSink.OnGUIBack(); if (CoreXT.IsDevice) { if (_photo != null) { // figure out a scale that fits on screen float scale = (float)Screen.width / (float)_photo.width; float heightScale = ((float)Screen.height - 330.0f) / (float)_photo.height; scale = (scale < heightScale) ? scale : heightScale; // draw the filtered image GUI.DrawTexture(new Rect(0, 280, _photo.width * scale, _photo.height * scale), _photo); // draw the scrambled faces if (_faces != null) { for (int i = 0; i < _faces.Length; i++) { var face = _faces[i]; var rect = face.bounds; rect.Set(rect.x * scale * CONVERT_SCALE, rect.y * scale * CONVERT_SCALE + 280, rect.width * scale * CONVERT_SCALE, rect.height * scale * CONVERT_SCALE); GUI.DrawTexture(rect, _scrambledFaces[i]); } } } if (GUI.Button(new Rect(50, 50, 100, 100), "Photos Library")) { GUIXT.ShowImagePicker(); } if (GUI.Button(new Rect(200, 50, 100, 100), "Take Photo")) { GUIXT.ShowImagePicker(UIImagePickerControllerSourceType.Camera); } } OnGUILog(); }
void OnGUI() { KitchenSink.OnGUIBack(); if (CoreXT.IsDevice) { GUILayout.BeginArea(new Rect(50, 50, Screen.width - 100, Screen.height / 2 - 50)); GUILayout.BeginHorizontal(); if (GUILayout.Button("Show alert", GUILayout.ExpandHeight(true))) { GUIXT.ShowAlert("Alert title", "Alert message", "Cancel", new string[] { "OK", "Hi", "Hello" }); } if (GUILayout.Button("Show input", GUILayout.ExpandHeight(true))) { GUIXT.ShowAlert("Input Prompt", "Enter something", "Cancel", new string[] { "OK" }, UIAlertViewStyle.PlainTextInput); } if (GUILayout.Button("Pick image from photo library", GUILayout.ExpandHeight(true))) { GUIXT.ShowImagePicker(); } if (GUILayout.Button("Take photo from camera", GUILayout.ExpandHeight(true))) { GUIXT.ShowImagePicker(UIImagePickerControllerSourceType.Camera); } if (GUILayout.Button("Show battery info", GUILayout.ExpandHeight(true))) { ShowBatteryInfo(); } GUILayout.EndHorizontal(); GUILayout.EndArea(); } OnGUILog(); }