From 0f767d5bed1eec29f5d5b275d3e554d9e1813a1f Mon Sep 17 00:00:00 2001 From: LibreHacker Date: Thu, 23 Jul 2020 17:36:24 +0300 Subject: [PATCH] first --- Examples/01_ПриветМир.as | 78 ++++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 80 insertions(+) create mode 100644 Examples/01_ПриветМир.as create mode 100644 README.md diff --git a/Examples/01_ПриветМир.as b/Examples/01_ПриветМир.as new file mode 100644 index 0000000..cdb5700 --- /dev/null +++ b/Examples/01_ПриветМир.as @@ -0,0 +1,78 @@ +// This first example, maintaining tradition, prints a "Hello World" message. +// Это первый пример, традиционный, выводит "Привет мир" сообщение. +// Furthermore it shows: +// Furthermore это показывает: +// - Using the Sample utility functions as a base for the application +// - Использование Sample utility функций как база для приложения +// - Adding a Text element to the graphical user interface +// - Добавление элемента Текст на графический интерфейс пользователя +// - Subscribing to and handling of update events +// - Подписывание и удержание обновлений событий + +#include "Scripts/Utilities/Sample.as" + +void Start() +{ + // Execute the common startup for samples + // Запускает основной запуск для примеров + SampleStart(); + + // Create "Hello World" Text + // Создание "Привет мир" Текста + CreateText(); + + // Set the mouse mode to use in the sample + // Установка режима мыщи используется в примере + SampleInitMouseMode(MM_FREE); + + // Finally, hook-up this HelloWorld instance to handle update events + // Наконец, связываем этот ПриветМир инстранцию для подхватывания обновлений событий + SubscribeToEvents(); +} + +void CreateText() +{ + // Construct new Text object + // Делаем новый Текстовый объект + Text@ helloText = Text(); + + // Set String to display + // Назначаем Строку для вывода + helloText.text = "Hello World from Urho3D!"; + + // Set font and text color + // Устанавливаем шрифт и цвет текста + helloText.SetFont(cache.GetResource("Font", "Fonts/Anonymous Pro.ttf"), 30); + helloText.color = Color(0.0f, 1.0f, 0.0f); + + // Align Text center-screen + // Помешаем Текст в центр экрана + helloText.horizontalAlignment = HA_CENTER; + helloText.verticalAlignment = VA_CENTER; + + // Add Text instance to the UI root element + // Добавляем Текстовую инстрацию на UI (интерфейс пользователя) родительного элемента + ui.root.AddChild(helloText); +} + +void SubscribeToEvents() +{ + // Subscribe HandleUpdate() function for processing update events + // Подписываем HandleUpdate() функцию для обработки обновлений событий + SubscribeToEvent("Update", "HandleUpdate"); +} + +void HandleUpdate(StringHash eventType, VariantMap& eventData) +{ + // Do nothing for now, could be extended to eg. animate the display + // Ничего не делаем сейчас, возможно расширить это, например анимировать экран +} + +// Create XML patch instructions for screen joystick layout specific to this sample app +// Создаём XML путь инструкция для экрана джойстика специфичный для примерного приложения +String patchInstructions = + "" + + " " + + " " + + " " + + ""; diff --git a/README.md b/README.md new file mode 100644 index 0000000..aec8116 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +Быстрый старт: +https://sourceforge.net/projects/urho3d/files/Urho3D/Snapshots/