static void Main () { Application.Init (); Gtk.Window w = new Gtk.Window ("System.Drawing and Gtk#"); // Custom widget sample a = new PrettyGraphic (); // Event-based drawing b = new DrawingArea (); b.ExposeEvent += new ExposeEventHandler (ExposeHandler); b.SizeAllocated += new SizeAllocatedHandler (SizeAllocatedHandler); Button c = new Button ("Quit"); c.Clicked += new EventHandler (quit); MovingText m = new MovingText (); Box box = new HBox (true, 0); box.Add (a); box.Add (b); box.Add (m); box.Add (c); w.Add (box); w.ShowAll (); Application.Run (); }
static void Main() { Application.Init(); Gtk.Window w = new Gtk.Window("System.Drawing and Gtk#"); // Custom widget sample a = new PrettyGraphic(); // Event-based drawing b = new DrawingArea(); b.ExposeEvent += new ExposeEventHandler(ExposeHandler); b.SizeAllocated += new SizeAllocatedHandler(SizeAllocatedHandler); Button c = new Button("Quit"); c.Clicked += new EventHandler(quit); MovingText m = new MovingText(); Box box = new HBox(true, 0); box.Add(a); box.Add(b); box.Add(m); box.Add(c); w.Add(box); w.ShowAll(); Application.Run(); }
public void BeStomped() { State.BeStomped(); game.HUD.GetScore(100); MovingText score = new MovingText(game, "100", Position); game.WorldLoader.MovingTexts.Add(score); }
public void ShowMessage(string msg, Vector2 location, Color color) { location = new Vector2( location.x + Random.Range(-0.5f, 0.5f), location.y + Random.Range(-0.5f, 0.5f) ); MovingText movingText = Instantiate(movingTextPrefab, location, Quaternion.identity).GetComponent <MovingText>(); movingText.Initilize(msg, textSpeed, new Vector2(Random.Range(-0.2f, 0.2f), 1.0f), color, fadeTime); }
void CreateMovingText(Color textColor, string operation, int amount) { display.text = string.Format(textFormat, alignment, divinity); scores[alignment] = divinity; MovingText movText = Instantiate(movingTextPrefab, canvas.transform, false).GetComponent <MovingText>(); movText.Setup( string.Format("{0} {1}{2}", alignment, operation, amount.ToString()), textColor, transform.position); }
/// <summary> /// The MovingTextOptionsWindow nees a <see cref="RgbLibrary.MovingText"/> object. /// <para> /// <list type="bullet"> /// <listheader> /// <description>The user can change the properties:</description> /// </listheader> /// <item> /// <description> /// Color /// </description> /// </item> /// <item> /// <description> /// Text /// </description> /// </item> /// <item> /// <description> /// FontSize /// </description> /// </item> /// <item> /// <description> /// Position in x-achses /// </description> /// </item> /// <item> /// <description> /// Position in y-achses /// </description> /// <item> /// <description> /// Scroll Mode /// </description> /// </item> /// </item> /// </list> /// </para> /// </summary> /// <param name="movingText"></param> public MovingTextOptionsWindow(MovingText movingText) { InitializeComponent(); this.movingText = movingText; this.SizeToContent = System.Windows.SizeToContent.WidthAndHeight; this.Topmost = true; Binding ColorBinding = new Binding("ColorPalette"); ColorBinding.Source = this.movingText; ColorBinding.Mode = BindingMode.TwoWay; Palettes.SetBinding(ComboBox.TextProperty, ColorBinding); Binding TextBinding = new Binding("Text"); TextBinding.Source = this.movingText; TextBinding.Mode = BindingMode.TwoWay; TextBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; Text.SetBinding(TextBox.TextProperty, TextBinding); Binding FontSizeBinding = new Binding("FontSize"); FontSizeBinding.Source = this.movingText; FontSizeBinding.Mode = BindingMode.TwoWay; FontSize.SetBinding(Slider.ValueProperty, FontSizeBinding); Binding ModeBinding = new Binding("Mode"); ModeBinding.Source = this.movingText; ModeBinding.Mode = BindingMode.TwoWay; Selected_Objects.SetBinding(ComboBox.SelectedValueProperty, ModeBinding); Binding PosYBinding = new Binding("PosY"); PosYBinding.Source = this.movingText; PosYBinding.Mode = BindingMode.TwoWay; PosY.SetBinding(Slider.ValueProperty, PosYBinding); Binding PosXBinding = new Binding("PosX"); PosXBinding.Source = this.movingText; PosXBinding.Mode = BindingMode.TwoWay; PosX.SetBinding(Slider.ValueProperty, PosXBinding); }
/// <summary> /// <list type="bullet"> /// <item> /// <description>AuroraWindow size is suitet to the user display</description> /// </item> /// <item> /// <description>The rgb mask and brigthness is set to 256 default</description> /// </item> /// <item> /// <description>The monitorImg <see cref=""/> gets initialised in proportion to the AuroraWindow </description> /// </item> /// <item> /// <description>The portWindow <seealso cref=""/> is initialised and the eventhandler data changed add, which is interrupted if the connection /// is cancelated or startet</description> /// </item> /// <item> /// <description>A very important point in InitMainWindow is to set the monitorImg.Source to monitor, otherwise nothing appears on the surface</description> /// </item> /// <item> /// <description>The RenderOptions.SetEdgeMode(monitorImg, EdgeMode.Aliased) EdgeMode property squares the pixel and guarantes clear edges on the 68 x 42 resolution</description> /// </item> /// <item> /// <description>The monitorTimer.Tick event has a frequence of 40 Hz</description> /// </item> /// </list> /// </summary> public void InitMainWindow() { Point screenSize = new Point(System.Windows.SystemParameters.FullPrimaryScreenWidth, System.Windows.SystemParameters.FullPrimaryScreenHeight); AuroraWindow.Width = screenSize.X * 0.4; AuroraWindow.Height = screenSize.Y * 0.9; redMask = 255; greenMask = 255; blueMask = 255; bright = 255; monitorImg.Width = AuroraWindow.Width * 0.85; monitorImg.Height = monitorImg.Width / 1.618; //Das SerialportWindow initialisiern portWindow = new PortWindow(); portWindow.data.Changed += new ChangedEventhandler(StatusChanged); //Das Rechteck für die Blit funktion festlegen r = new Rect(0, 0, 68, 42); //Writeable Bitmaps initialisiern monitor = BitmapFactory.New(68, 42); drawlayer = BitmapFactory.New(68, 42); monitorImg.Source = monitor; RenderOptions.SetBitmapScalingMode(monitorImg, BitmapScalingMode.NearestNeighbor); RenderOptions.SetEdgeMode(monitorImg, EdgeMode.Aliased); monitorTimer = new DispatcherTimer(DispatcherPriority.Render); monitorTimer.Interval = new TimeSpan(0, 0, 0, 0, 25); monitorTimer.Tick += monitorTimer_Tick; monitorTimer.Start(); bitmapbuffer = new Byte[monitor.ToByteArray().Length]; CentralMonitor.IsEnabled = false; runningTask = RunningTask.Effect; filterBitmap = BitmapFactory.New(68, 42); //Init Objects and Options Windows expandingObjects = new ExpandingObjects(monitor); expandingObjectsWindow = new ExpandingObjectsOptionsWindow(expandingObjects); movingText = new MovingText(monitor); movingTextOptionWindow = new MovingTextOptionsWindow(movingText); plasma = new Plasma(monitor); plasmaOptionWindow = new PlasmaOptionsWindow(plasma); colorGradient = new ColorGradient(monitor); gradientOptionWindow = new GradientColorOptionsWindow(colorGradient); StickyWindow.RegisterExternalReferenceForm(this); //Bluetooth Event listening RgbLibrary.Bluetooth.Instance.CommandControlChange += new Bluetooth.PropertyChangeHandler(Bluetooth_Command_Listener); }