public Button(EventHandler onPressEvent, Text label) { _onPressEvent = onPressEvent; _label = label; _label.SetColor(new Color(0, 0, 0, 1)); UpdatePosition(); }
public MainMenuState(Input input, FontManager fontManager, StateSystem system) { _input = input; _fontManager = fontManager; _system = system; _title = new Text("Value Emblem", fontManager.Get("title_font")); _title.SetColor(new Color(0, 0, 0, 1)); _title.SetPosition(-_title.Width / 2, 300); InitializeVMenu(); }
public Platform(char id) { Id = id; text = new Text( id.ToString(), new Vec2F( boundingBox.Position.X + boundingBox.Extent.X / 2 - Constants.EXTENT_X / 2, boundingBox.Position.Y), new Vec2F(Constants.EXTENT_X, Constants.EXTENT_Y)); text.SetFontSize(400); text.SetColor(Color.Black); }
public StartMenuState(Engine.Font titleFont, Engine.Font generalFont, Input input, StateSystem system) { _system = system; _generalFont = generalFont; _input = input; InitializeMenu(); _title = new Text("Shooter", titleFont); _title.SetColor(new Color(0, 0, 0, 1)); // Centerre on the x and place somewhere near the top _title.SetPosition(-_title.Width / 2, 300); }
public void InitializeGameState() { help = new Text( " Game Paused\n\n" + " To quit press \"Q\"\n" + " and to play pres \"P\"\n" + " For new game press \"N\"", new Vec2F(0f, 0f), new Vec2F(1f, 0.5f)); help.SetColor(new Vec3I(255, 165, 0)); help.SetFontSize(20); }
void ShowReady() //fungsi menampilkan keterangan ready/fire { readyText = new Text(Context); readyText.Value = "READY"; readyText.HorizontalAlignment = HorizontalAlignment.Right; readyText.VerticalAlignment = VerticalAlignment.Top; readyText.Position = new IntVector2(-200, 150); readyText.SetColor(Color.White); readyText.SetFont(CoreAssets.Fonts.AnonymousPro, 30); UI.Root.AddChild(readyText); }
void ShowHeading() //fungsi menampilkan sudut heading { headingText = new Text(Context); headingText.Value = "Heading :" + rmq.GetMessage_Raspi(); headingText.HorizontalAlignment = HorizontalAlignment.Right; headingText.VerticalAlignment = VerticalAlignment.Bottom; headingText.SetColor(Color.White); headingText.Position = new IntVector2(-200, -200); headingText.SetFont(CoreAssets.Fonts.AnonymousPro, 30); UI.Root.AddChild(headingText); }
public StartMenuState(FontManager fontManager, Input input, StateSystem system) { _input = input; _fontManager = fontManager; _system = system; _title = new Text("Value Shmup", _fontManager.Get("title_font")); _title.SetColor(new Color(0, 0, 0, 1)); //Center on the x and place somewhere near the top _title.SetPosition(-_title.Width / 2, 300); InitializeMenu(); }
public static Text CreateText(UIElement parent, ScreenInfoRatio screenInfo, Font font, int fontSize, int xPos, int yPos, HorizontalAlignment hAlign, VerticalAlignment vAlign) { var text = new Text(); parent.AddChild(text); text.SetAlignment(hAlign, vAlign); text.SetPosition(screenInfo.SetX(xPos), screenInfo.SetY(yPos)); text.SetFont(font, screenInfo.SetX(fontSize)); text.SetColor(Color.Black); return(text); }
public LoadingScenePage(ResourceCache cache) { CreateSimpleScene(100); _text = new Text(); _text.Value = "Loading"; _text.SetColor(Color.White); _text.HorizontalAlignment = HorizontalAlignment.Center; _text.VerticalAlignment = VerticalAlignment.Center; //_text.SetStyleAuto(null); _text.SetFont("Fonts/Anonymous Pro.ttf", 32); _text.TextEffect = TextEffect.Stroke; UI.AddChild(_text); }
void ShowYaw() //fungsi menampilkan yaw { //Menampilkan yaw yawText = new Text(Context); yawText.Value = "0"; yawText.HorizontalAlignment = HorizontalAlignment.Center; yawText.VerticalAlignment = VerticalAlignment.Top; yawText.Position = new IntVector2(0, 100); yawText.SetColor(Color.White); yawText.SetFont(CoreAssets.Fonts.AnonymousPro, 30); UI.Root.AddChild(yawText); }
void ShowPitch() //fungsi menampilkan pitch { //Menampilkan pitch pitchText = new Text(Context); pitchText.Value = "0.0"; pitchText.HorizontalAlignment = HorizontalAlignment.Left; pitchText.VerticalAlignment = VerticalAlignment.Center; pitchText.Position = new IntVector2(300, 0); pitchText.SetColor(Color.White); pitchText.SetFont(CoreAssets.Fonts.AnonymousPro, 30); UI.Root.AddChild(pitchText); }
public void InitializeGameState() { eventBus = SpaceTaxiBus.GetBus(); imageContainer = ImageContainer.GetInstance(); backgroundImg = new Entity(new StationaryShape(0, 0, 1, 1), imageContainer.GetImageByName("SpaceBackground.png")); pausedText = new Text( "Game paused. \n\nPress P to continue \nPress ESC to quit", new Vec2F(0.23f, 0.1f), new Vec2F(0.6f, 0.6f)); pausedText.SetColor(Color.White); pausedText.SetFontSize(40); }
void ShowPosition() //fungsi menampilkan posisi turret { positionText = new Text(); positionText.Value = "0" + " X; " + "0" + " Y; " + "0" + " Z; "; positionText.HorizontalAlignment = HorizontalAlignment.Right; positionText.VerticalAlignment = VerticalAlignment.Top; positionText.Position = new IntVector2(-100, 200); // 0, 50 positionText.SetColor(Color.White); positionText.SetFont(CoreAssets.Fonts.AnonymousPro, 30); UI.Root.AddChild(positionText); }
protected override void Start() { // UI text var helloText = new Text(Context); helloText.Value = "UrhoSharp face detection"; helloText.HorizontalAlignment = Urho.Gui.HorizontalAlignment.Center; helloText.VerticalAlignment = Urho.Gui.VerticalAlignment.Top; helloText.SetColor(new Color(r: 0f, g: 0f, b: 1f)); helloText.SetFont(font: CoreAssets.Fonts.AnonymousPro, size: 30); UI.Root.AddChild(helloText); // 3D scene with Octree scene = new Scene(Context); scene.CreateComponent <Octree>(); // Mask maskNode = scene.CreateChild(); maskNode.Position = new Vector3(x: 1, y: 0, z: 5); maskNode.Scale = new Vector3(1, 1, 1) / 3f; var leftEye = maskNode.CreateChild(); var leftEyeModel = leftEye.CreateComponent <Urho.Shapes.Sphere>(); var rightEye = maskNode.CreateChild(); var rightEyeModel = rightEye.CreateComponent <Urho.Shapes.Sphere>(); leftEye.Position = new Vector3(-0.6f, 0, 0); rightEye.Position = new Vector3(0.6f, 0, 0); leftEye.RunActions(new TintTo(1f, Randoms.Next(), Randoms.Next(), Randoms.Next())); rightEye.RunActions(new TintTo(1f, Randoms.Next(), Randoms.Next(), Randoms.Next())); // Light Node lightNode = scene.CreateChild(); lightNode.Position = new Vector3(-2, 0, 0); var light = lightNode.CreateComponent <Light>(); light.Range = 20; light.Brightness = 1f; // Camera Node cameraNode = scene.CreateChild(); camera = cameraNode.CreateComponent <Camera>(); // Viewport var vp = new Viewport(Context, scene, camera, null); Renderer.SetViewport(0, vp); vp.SetClearColor(new Color(1, 1, 1, 1)); }
public Collision(string activelevel) { Activeplatforms = new Parser(CollisionPlatforms.GetPlatform(activelevel)); Activeplatforms.CreateEntityList(); explosionStrides = ImageStride.CreateStrides(8, Path.Combine("Assets", "Images", "Explosion.png")); explosions = new AnimationContainer(500); explosionLength = 500; GameOver = new Text("Game's Over", new Vec2F(0.42f, 0.5f), new Vec2F(0.3f, 0.3f)); GameOver.SetText("Game's Over\nPress Space"); GameOver.SetColor(new Vec3I(0, 255, 0)); }
private async void CreateScene() { // UI text var helloText = new Text(Context); helloText.Value = "Hello World from UrhoSharp"; helloText.HorizontalAlignment = HorizontalAlignment.Center; helloText.VerticalAlignment = VerticalAlignment.Top; helloText.SetColor(new Color(r: 0f, g: 1f, b: 1f)); helloText.SetFont(font: ResourceCache.GetFont("Fonts/Font.ttf"), size: 30); UI.Root.AddChild(helloText); // 3D scene with Octree var scene = new Scene(Context); scene.CreateComponent <Octree>(); // Box Node boxNode = scene.CreateChild(name: "Box node"); boxNode.Position = new Vector3(x: 0, y: 0, z: 5); boxNode.SetScale(0f); boxNode.Rotation = new Quaternion(x: 60, y: 0, z: 30); StaticModel boxModel = boxNode.CreateComponent <StaticModel>(); boxModel.Model = ResourceCache.GetModel("Models/Box.mdl"); // boxModel.SetMaterial(ResourceCache.GetMaterial("Materials/BoxMaterial.xml")); // Light Node lightNode = scene.CreateChild(name: "light"); var light = lightNode.CreateComponent <Light>(); light.Range = 10; light.Brightness = 1.5f; light.Color = Color.FromHex("00FF00"); // Camera Node cameraNode = scene.CreateChild(name: "camera"); Camera camera = cameraNode.CreateComponent <Camera>(); // Viewport Renderer.SetViewport(0, new Viewport(Context, scene, camera, null)); // Do actions await boxNode.RunActionsAsync(new EaseBounceOut(new ScaleTo(duration: 1f, scale: 1))); await boxNode.RunActionsAsync(new RepeatForever( new RotateBy(duration: 1, deltaAngleX: 90, deltaAngleY: 0, deltaAngleZ: 0))); }
public InnerMenuState(Input input, FontManager fontManager, StateSystem system) { _input = input; _fontManager = fontManager; _system = system; _title = new Text("Paused", fontManager.Get("general_font")); _title.SetColor(new Color(0, 0, 0, 1)); _title.SetPosition(-_title.Width / 2, 300); _vmenu = new VerticalMenu(0, 150, _input); InitializeVerticalMenu(); }
public StartMenuState(Killer1.Font titleFont, Killer1.Font generalFont, Killer1.Font computerFont, Input input, StateSystem system, PersistantGameData gameData) { _system = system; _generalFont = generalFont; _computerFont = computerFont; _input = input; _gameData = gameData; InitializeMenu(); _title = new Text("Shooter", _computerFont); _title.SetColor(new Color(0, 0, 0, 1)); _title.SetPosition(_title.Width + 340, 300); }
protected override void Start() { var cache = ResourceCache; var helloText = new Text { Value = "Hello World from UrhoSharp", HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; helloText.SetColor(new Color(0f, 1f, 0f)); helloText.SetFont(cache.GetFont("Fonts/Anonymous Pro.ttf"), 30); UI.Root.AddChild(helloText); }
public StartMenuState(PotatoEngine.Font font, PotatoEngine.Font titleFont, PotatoEngine.Font generalFont, Input input, StateSystem system, SoundManager soundManager) { _input = input; _generalFont = generalFont; _system = system; _soundManager = soundManager; _fps = new FPS(font, new Color(0, 0, 0, 1)); InitializeMenu(); _title = new Text("The Darkest Matter", titleFont); _title.SetColor(new Color(0, 0, 0, 1)); // Center on the x and place somewhere near the top _title.SetPosition(-_title.Width / 2, 300); }
/// <summary> /// función demo de como crear un texto en la vista de urhosharp /// </summary> private void CreateText() { // Create Text Element var text = new Text() { Value = "UrhoSharp \n Comunidad Xamarin en español", HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; text.SetColor(Color.Green); text.SetFont(font: ResourceCache.GetFont("Fonts/Anonymous Pro.ttf"), size: 30); // Add to UI Root UI.Root.AddChild(text); }
/// <summary> /// Renders the text /// </summary> public void RenderScore() { Score.SetText(string.Format("Score: {0}", points)); Score.SetColor(new Vec3I(255, 0, 0)); Score.RenderText(); if (customer.pickedUp) { Stopwatch.Start(); Timer.SetText(string.Format("Time left: {0}", (int.Parse(customer.timelimit) - Stopwatch.Elapsed.Seconds))); Timer.SetColor(new Vec3I(0, 0, 255)); Timer.RenderText(); } }
public void InitializeGameState() { spaceTaxiBus = SpaceTaxiBus.GetBus(); imageContainer = ImageContainer.GetInstance(); backgroundImage = new Entity( new StationaryShape(0.0f, 0.0f, 1f, 1f), imageContainer.GetImageByName("SpaceBackground.png")); gameOverText = new Text("GAME OVER", new Vec2F(0.31f, 0.4f), new Vec2F(0.4f, 0.3f)); gameOverText.SetColor(Color.White); tryAgainButton = new Text("Press ENTER to try again", new Vec2F(0.25f, 0.0f), new Vec2F(0.7f, 0.5f)); tryAgainButton.SetColor(Color.White); tryAgainButton.SetFontSize(20); }
public void Show(Color color, int fontSize = 18) { if (text != null) return; text = new Text(); text.SetColor(color); text.VerticalAlignment = VerticalAlignment.Top; text.HorizontalAlignment = HorizontalAlignment.Right; text.TextAlignment = HorizontalAlignment.Right; text.SetFont(CoreAssets.Fonts.AnonymousPro, fontSize); application.UI.Root.AddChild(text); subscription = application.Engine.SubscribeToPostUpdate(OnPostUpdate); }
private void CreateText() { // Create Text Element var text = new Text() { Value = "Hello World!", HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; text.SetColor(Color.Cyan); text.SetFont(font: ResourceCache.GetFont("Fonts/Anonymous Pro.ttf"), size: 30); // Add to UI Root UI.Root.AddChild(text); }
async void HelloWorld(string msg) { //Criação do texto - o texto é adicionado à UI var helloText = new Text() { Value = msg, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; helloText.SetColor(new Color(0f, 1f, 1f)); helloText.SetFont( font: ResourceCache.GetFont("Fonts/OLDENGL.TTF"), size: 30); UI.Root.AddChild(helloText); }
protected override void Start() { instanceId++; Log.LogLevel = LogLevel.Debug; // UI text helloText = new Text(Context); helloText.HorizontalAlignment = HorizontalAlignment.Center; helloText.VerticalAlignment = VerticalAlignment.Top; helloText.SetColor(Color.Black); helloText.SetFont(font: CoreAssets.Fonts.AnonymousPro, size: 20); UI.Root.AddChild(helloText); // 3D scene with Octree Scene = new Scene(Context); Scene.CreateComponent <Octree>(); Scene.CreateComponent <Zone>().AmbientColor = new Color(0.5f, 0.5f, 0.5f); for (int i = 0; i < 70; i++) { SpawnRandomShape(); } // Light Node lightNode = Scene.CreateChild(name: "light"); var light = lightNode.CreateComponent <Light>(); light.Range = 50; light.Brightness = 1f; // Camera CameraNode = Scene.CreateChild(name: "camera"); Camera camera = CameraNode.CreateComponent <Camera>(); // Viewport Viewport = new Viewport(Context, Scene, camera, null); if (Platform == Platforms.Windows) { Viewport.RenderPath.Append(CoreAssets.PostProcess.FXAA2); } Viewport.SetClearColor(BackgroundColor); Renderer.SetViewport(0, Viewport); new MonoDebugHud(this).Show(Color.Red); }
//EnemyManager _enemyManager; public Level(Input input, TextureManager textureManager, PersistantGameData gameData, Engine.Font generalFont, Engine.Font titleFont, Size windowSize) { //_testSprite.Texture = textureManager.Get("explosion"); //_testSprite.SetAnimation(4, 4); _input = input; _gameData = gameData; _textureManager = textureManager; _effectsManager = new EffectsManager(_textureManager); _background = new Background(textureManager.Get("background")); //_background.Speed = 0.15f; widthScale2 = _windowSize.Width / 900.0; heightScale2 = _windowSize.Height / 695.0; _background.SetScale(2.0, 2.0); //_backgroundLayer = new Background(textureManager.Get("background_layer_1")); //_backgroundLayer.Speed = 0.1f; //_backgroundLayer.SetScale(2.0, 2.0); m_ChessBoard = Form1.InitChessBoard; _chessBoard = new ChessBoard(_textureManager, _moveChessManager); //_system = system; //_input = input; _generalFont = generalFont; _titleFont = titleFont; settingChecked = SettingMenu(); Option optionChecked = OptionMenu(); Engines engineChecked = EngineMenu(); _enginemenu._rvdisable = true; _optiontitle = new Text("选项", _titleFont); _optiontitle.SetColor(new Color(0, 0, 0, 1)); //Center on the x and place somewhere near the top _optiontitle.SetPosition(-_optiontitle.Width / 2 - 450, 300); //EngineMenu(); _optiontitle = new Text("引擎", _titleFont); _optiontitle.SetColor(new Color(0, 0, 0, 1)); // Center on the x and place somewhere near the top _optiontitle.SetPosition(-_optiontitle.Width / 2 + 450, 300); //_enemyManager = new EnemyManager(_textureManager, _effectsManager, _bulletManager, _playerCharacter, -1300); }
public void Show(Color color, int fontSize = 18) { if (text != null) { return; } text = new Text(); text.SetColor(color); text.VerticalAlignment = VerticalAlignment.Top; text.HorizontalAlignment = HorizontalAlignment.Right; text.TextAlignment = HorizontalAlignment.Right; text.SetFont(CoreAssets.Fonts.AnonymousPro, fontSize); application.UI.Root.AddChild(text); application.Engine.PostUpdate += OnPostUpdate; }
void CreateArScene() { // 3D scene with Octree and Zone Scene = new Scene(Context); Octree = Scene.CreateComponent <Octree>(); Zone = Scene.CreateComponent <Zone>(); Zone.AmbientColor = Color.White * 0.2f; // Light LightNode = Scene.CreateChild(name: "DirectionalLight"); LightNode.SetDirection(new Vector3(0.8f, -1.0f, 0f)); Light = LightNode.CreateComponent <Light>(); Light.LightType = LightType.Directional; Light.CastShadows = true; Light.Brightness = 1.5f; Light.ShadowResolution = 4; Light.ShadowIntensity = 0.8f; Renderer.ShadowMapSize *= 2; // Camera CameraNode = Scene.CreateChild(name: "Camera"); Camera = CameraNode.CreateComponent <Camera>(); // Viewport Viewport = new Viewport(Context, Scene, Camera, null); Viewport.SetClearColor(Color.Transparent); Renderer.SetViewport(0, Viewport); DebugHud = new MonoDebugHud(this); DebugHud.FpsOnly = true; DebugHud.Show(Color.Black, 45); AnchorsNode = Scene.CreateChild(); FeaturePointsCloudeNode = Scene.CreateChild(); loadingLabel = new Text { Value = "Detecting planes...", HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; loadingLabel.SetColor(new Color(0f, 1f, 0f)); loadingLabel.SetFont(font: CoreAssets.Fonts.AnonymousPro, size: 42); UI.Root.AddChild(loadingLabel); }
async void CreateScene() { // UI text var helloText = new Text(Context); helloText.Value = "Hello World from UrhoSharp"; helloText.HorizontalAlignment = HorizontalAlignment.Center; helloText.VerticalAlignment = VerticalAlignment.Top; helloText.SetColor(new Color(r: 0f, g: 1f, b: 1f)); helloText.SetFont(font: ResourceCache.GetFont("Fonts/Font.ttf"), size: 30); UI.Root.AddChild(helloText); // 3D scene with Octree var scene = new Scene(Context); scene.CreateComponent<Octree>(); // Box Node boxNode = scene.CreateChild(name: "Box node"); boxNode.Position = new Vector3(x: 0, y: 0, z: 5); boxNode.SetScale(0f); boxNode.Rotation = new Quaternion(x: 60, y: 0, z: 30); StaticModel boxModel = boxNode.CreateComponent<StaticModel>(); boxModel.Model = ResourceCache.GetModel("Models/Box.mdl"); boxModel.SetMaterial(ResourceCache.GetMaterial("Materials/BoxMaterial.xml")); // Light Node lightNode = scene.CreateChild(name: "light"); var light = lightNode.CreateComponent<Light>(); light.Range = 10; light.Brightness = 1.5f; // Camera Node cameraNode = scene.CreateChild(name: "camera"); Camera camera = cameraNode.CreateComponent<Camera>(); // Viewport Renderer.SetViewport(0, new Viewport(Context, scene, camera, null)); // Do actions await boxNode.RunActionsAsync(new EaseBounceOut(new ScaleTo(duration: 1f, scale: 1))); await boxNode.RunActionsAsync(new RepeatForever( new RotateBy(duration: 1, deltaAngleX: 90, deltaAngleY: 0, deltaAngleZ: 0))); }
void CreateScene() { Input.SubscribeToTouchEnd(OnTouched); // UI text var helloText = new Text(Context); helloText.Value = "Select your start track!"; helloText.HorizontalAlignment = HorizontalAlignment.Center; helloText.VerticalAlignment = VerticalAlignment.Top; helloText.SetColor(new Color(r: 0f, g: 1f, b: 1f)); helloText.SetFont(font: ResourceCache.GetFont("Fonts/Font.ttf"), size: 30); UI.Root.AddChild(helloText); // 3D scene with Octree scene = new Scene(Context); octree = scene.CreateComponent <Octree>(); Node cameraNode = scene.CreateChild(name: "camera"); camera = cameraNode.CreateComponent <Camera>(); cameraNode.Position = new Vector3(30, 50, -150); // Viewport Renderer.SetViewport(0, new Viewport(Context, scene, camera, null)); var lightNode = scene.CreateChild(); var light = lightNode.CreateComponent <Light>(); light.Range = 200; light.Brightness = 150f; lightNode.Position = new Vector3(0, 0, -150); for (int i = 0; i < 10; i++) { var starNode = scene.CreateChild(); Random randomY = new Random(); starNode.Position = new Vector3(6 * i, randomY.Next(0, 20) * 5, 0); var star = new Star(); starNode.AddComponent(star); stars.Add(starNode); } }
protected override void Start() { var cache = ResourceCache; var helloText = new Text() { Value = "Hello World from UrhoSharp", HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; helloText.SetColor(new Color(0f, 1f, 0f)); helloText.SetFont(font: cache.GetFont("Fonts/Anonymous Pro.ttf"), size: 30); UI.Root.AddChild(helloText); Graphics.SetWindowIcon(cache.GetImage("Textures/UrhoIcon.png")); Graphics.WindowTitle = "UrhoSharp Sample"; // Subscribe to Esc key: Input.SubscribeToKeyDown(args => { if (args.Key == Key.Esc) Exit(); }); }
async void CreateScene() { // UI text helloText = new Text() { Value = "Hello World from MySample", HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; helloText.SetColor(new Color(0f, 1f, 1f)); helloText.SetFont( font: ResourceCache.GetFont("Fonts/BlueHighway.ttf"), size: 30); UI.Root.AddChild(helloText); // Create a top-level scene, must add the Octree // to visualize any 3D content. var scene = new Scene(); scene.CreateComponent<Octree>(); // Box Node boxNode = scene.CreateChild(); boxNode.Position = new Vector3(0, 0, 5); boxNode.Rotation = new Quaternion(60, 0, 30); boxNode.SetScale(0f); StaticModel modelObject = boxNode.CreateComponent<StaticModel>(); modelObject.Model = ResourceCache.GetModel("Models/Box.mdl"); // Light Node lightNode = scene.CreateChild(name: "light"); lightNode.SetDirection(new Vector3(0.6f, -1.0f, 0.8f)); lightNode.CreateComponent<Light>(); // Camera Node cameraNode = scene.CreateChild(name: "camera"); Camera camera = cameraNode.CreateComponent<Camera>(); // Viewport Renderer.SetViewport(0, new Viewport(scene, camera, null)); // Perform some actions await boxNode.RunActionsAsync( new EaseBounceOut(new ScaleTo(duration: 1f, scale: 1))); await boxNode.RunActionsAsync( new RepeatForever(new RotateBy(duration: 1, deltaAngleX: 90, deltaAngleY: 0, deltaAngleZ: 0))); }
static void Main() { Clutter.Application.Init (); Stage = new Stage (); Stage.Title = "Deal!"; Stage.Add (new Texture ("Pixmaps/Table.png")); Stage.SetSize (800, 480); Stage.KeyPressEvent += HandleKeyPress; Texture C = new Texture ("Pixmaps/Coin.png"); C.SetSize (50, 50); C.SetPosition (35, 405); Stage.Add (C); Bet = 0; BetButton = new BetButton (); BetButton.ButtonPressEvent += IncreaseBet; Stage.Add (BetButton); DealButton = new DealButton (); DealButton.ButtonPressEvent += NewGame; Stage.Add (DealButton); StepButton = new StepButton (); StepButton.ButtonPressEvent += NextStep; Stage.Add (StepButton); Stack = new Stack (); Stack.Decrease (20); ScoreText = new Text ("Droid Sans Bold 21", "" + Stack.GetAmount()); ScoreText.SetColor (new Clutter.Color (0xff, 0xff, 0xff, 0xff)); ScoreText.SetPosition (100, 413); Stage.Add (ScoreText); Coins = new Coin [5]; Coins [0] = new Coin (); Coins [1] = new Coin (); Coins [2] = new Coin (); Coins [3] = new Coin (); Coins [4] = new Coin (); for (int i = 0; i < 5; i++) { Coins [i].SetPosition (35, 405); Stage.Add (Coins [i]); } Deck = new Deck (); PlayerHand = new Hand (Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw ()); OpponentHand = new Hand (Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw (), Deck.Draw ()); SetupAnimation (); Stage.ShowAll(); Clutter.Application.Run (); }
protected override void Start() { // UI text var helloText = new Text(Context); helloText.Value = "UrhoSharp face detection"; helloText.HorizontalAlignment = Urho.Gui.HorizontalAlignment.Center; helloText.VerticalAlignment = Urho.Gui.VerticalAlignment.Top; helloText.SetColor(new Color(r: 0f, g: 0f, b: 1f)); helloText.SetFont(font: CoreAssets.Fonts.AnonymousPro, size: 30); UI.Root.AddChild(helloText); // 3D scene with Octree scene = new Scene(Context); scene.CreateComponent<Octree>(); // Mask maskNode = scene.CreateChild(); maskNode.Position = new Vector3(x: 1, y: 0, z: 5); maskNode.Scale = new Vector3(1, 1, 1) / 3f; var leftEye = maskNode.CreateChild(); var leftEyeModel = leftEye.CreateComponent<Urho.Shapes.Sphere>(); var rightEye = maskNode.CreateChild(); var rightEyeModel = rightEye.CreateComponent<Urho.Shapes.Sphere>(); leftEye.Position = new Vector3(-0.6f, 0, 0); rightEye.Position = new Vector3(0.6f, 0, 0); leftEye.RunActions(new TintTo(1f, Randoms.Next(), Randoms.Next(), Randoms.Next())); rightEye.RunActions(new TintTo(1f, Randoms.Next(), Randoms.Next(), Randoms.Next())); // Light Node lightNode = scene.CreateChild(); lightNode.Position = new Vector3(-2, 0, 0); var light = lightNode.CreateComponent<Light>(); light.Range = 20; light.Brightness = 1f; // Camera Node cameraNode = scene.CreateChild(); camera = cameraNode.CreateComponent<Camera>(); // Viewport var vp = new Viewport(Context, scene, camera, null); Renderer.SetViewport(0, vp); vp.SetClearColor(Color.White); }