Exemple #1
0
        // Init is called on startup.
        public override void Init()
        {
            #if GUI_SIMPLE
            _guiHandler = new GUIHandler();
            _guiHandler.AttachToContext(RC);

            _guiFuseeLink                   = new GUIButton(6, 6, 157, 87);
            _guiFuseeLink.ButtonColor       = new float4(0, 0, 0, 0);
            _guiFuseeLink.BorderColor       = new float4(0, 0.6f, 0.2f, 1);
            _guiFuseeLink.BorderWidth       = 0;
            _guiFuseeLink.OnGUIButtonDown  += _guiFuseeLink_OnGUIButtonDown;
            _guiFuseeLink.OnGUIButtonEnter += _guiFuseeLink_OnGUIButtonEnter;
            _guiFuseeLink.OnGUIButtonLeave += _guiFuseeLink_OnGUIButtonLeave;
            _guiHandler.Add(_guiFuseeLink);
            _guiFuseeLogo = new GUIImage(AssetStorage.Get <ImageData>("FuseeLogo150.png"), 10, 10, -5, 150, 80);
            _guiHandler.Add(_guiFuseeLogo);
            var fontLato = AssetStorage.Get <Font>("Lato-Black.ttf");
            fontLato.UseKerning   = true;
            _guiLatoBlack         = new FontMap(fontLato, 18);
            _guiSubText           = new GUIText("Simple FUSEE Example", _guiLatoBlack, 100, 100);
            _guiSubText.TextColor = new float4(0.05f, 0.25f, 0.15f, 0.8f);
            _guiHandler.Add(_guiSubText);
            _subtextWidth  = GUIText.GetTextWidth(_guiSubText.Text, _guiLatoBlack);
            _subtextHeight = GUIText.GetTextHeight(_guiSubText.Text, _guiLatoBlack);
            #endif

            // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A).
            RC.ClearColor = new float4(1, 1, 1, 1);

            // Load the rocket model
            _rocketScene = AssetStorage.Get <SceneContainer>("RocketModel.fus");

            // Wrap a SceneRenderer around the model.
            _sceneRenderer = new SceneRenderer(_rocketScene);
        }
Exemple #2
0
        // is called on startup
        public override void Init()
        {
            RC.ClearColor = new float4(0.1f, 0.1f, 0.5f, 1);

            // IMPORTANT: You are supposed to use either one SetWindowSize() or VideoWall(). You can't use both.
            // It's possible to resize a window to fit on a video wall or display.
            // Here are some different variants how to use this functionality. Uncomment to test.
            //SetWindowSize(800, 600);
            //SetWindowSize(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height/5 * 2, true, 0, 0);
            //SetWindowSize(Screen.PrimaryScreen.Bounds.Width/9 * 2, Screen.PrimaryScreen.Bounds.Height, true, 0, 0);
            //SetWindowSize(640, 480, false, Screen.PrimaryScreen.Bounds.Width/2 - 640/2, Screen.PrimaryScreen.Bounds.Height/2 - 480/2);
            // IMPORTANT: For video Walls or projector matrices it's possible to let the system do the magic by
            // giving it the number of monitors/projectors per axis and specify some border information.
            // This only works in pseudo-fullscreen mode a.k.a borderless fullscreen-window.
            VideoWall(0, 0, true, true);

            // This is the old method. More than this could not be done directly in a project code(?)
            //Width = 640;
            //Height = 480;

            // Initialize an ui.
            _guiHandler = new GUIHandler();
            _guiHandler.AttachToContext(RC);

            // Create a new element.
            GUIElement element = new GUIImage("Assets/image.png", 0, 0, -10, 320, 130);

            // Add the element to the gui.
            _guiHandler.Add(element);

            // Add something to render.
            _cube       = new Cube();
            _spcolor    = Shaders.GetDiffuseColorShader(RC);
            _colorParam = _spcolor.GetShaderParam("color");
        }
    private void CreateLine(Vector2 position, string leftAchievement, string rightAchievement, float deltaLayer)
    {
        var panel = new GUIImage("Textures/Achievements/Panel", -2 - deltaLayer, position + new Vector2(0, 0), new Vector2(-1, -1), false);

        DrawAchievement(position - new Vector2(5.82f, 0), leftAchievement, deltaLayer);
        DrawAchievement(position + new Vector2(5.82f + 0.3f, 0), rightAchievement, deltaLayer);
    }
Exemple #4
0
 private void CheckElement(GUIControl temp)
 {
     Log.Info(temp.GetType() + " : " + temp.GetID);
     if (temp.GetID == LABEL_ID)
     {
         if (temp.GetType() == typeof(GUILabelControl))
         {
             _label = new LabelElement(temp);
         }
         else
         {
             Log.Info("VIDEO OSD: TYPE LABEL NOT FOUND FOR LABEL_ID=10 IN FULLSCREEN WINDOW. FOUND: " + temp.GetType());
         }
     }
     if (temp.GetID == BACKGROUND_ID)
     {
         if (temp.GetType() == typeof(GUIImage))
         {
             _background = new ImageElement(temp);
         }
         else
         {
             Log.Info("VIDEO OSD: TYPE IMAGE NOT FOUND FOR BACKGROUND_ID=0 IN FULLSCREEN WINDOW. FOUND: " + temp.GetType());
         }
     }
     if (temp.GetID == BACKGROUND_ID2)
     {
         if (temp.GetType() == typeof(GUIImage))
         {
             _background2 = new ImageElement(temp);
         }
         else
         {
             Log.Info("VIDEO OSD: TYPE IMAGE NOT FOUND FOR BACKGROUND_ID=104 IN FULLSCREEN WINDOW. FOUND: " + temp.GetType());
         }
     }
     if (temp.GetType() == typeof(GUIImage))
     {
         GUIImage imageElement = temp as GUIImage;
         if (imageElement != null)
         {
             if (imageElement.FileName.Equals("osd_bg_top.png"))
             {
                 _background3 = new ImageElement(temp);
             }
         }
     }
     if ((temp.GetID == PROGRESS_ID) && (temp.GetType() == typeof(GUIProgressControl) || temp.GetType() == typeof(GUILabelControl)) ||
         (temp.GetID > PANEL_START && temp.GetID < PANEL_END))
     {
         if (temp.GetType() == typeof(GUIImage))
         {
             _imageCacheElements.Add(GenerateElement(temp));
         }
         else
         {
             _cacheElements.Add(GenerateElement(temp));
         }
     }
 }
        /// <summary>
        /// Render icon
        /// </summary>
        /// <param name="graph">Graphics</param>
        /// <param name="buttonNr">Button number</param>
        /// <param name="x">X Position</param>
        /// <param name="y">Y Position</param>
        private void RenderIcon(Graphics graph, int buttonNr, int x, int y)
        {
            GUIListItem pItem = _listItems[buttonNr + _offset];

            if (pItem.HasIcon)
            {
                // show icon
                GUIImage pImage = pItem.Icon;
                if (null == pImage)
                {
                    return;
                }
                Bitmap bitmap;
                if (_cachedBitmaps.ContainsKey(pImage.FileName))
                {
                    bitmap = _cachedBitmaps[pImage.FileName];
                }
                else
                {
                    bitmap = loadBitmap(pImage.FileName);
                    if (bitmap != null)
                    {
                        _cachedBitmaps.Add(pImage.FileName, bitmap);
                    }
                }
                if (bitmap != null)
                {
                    graph.DrawImage(bitmap, x, y, _list.ImageWidth, _list.ImageHeight);
                }
            }
        }
        public override void AllocResources()
        {
            base.AllocResources();

            m_imgFocus = new GUIImage(GetID, GetID * 10, _positionX, _positionY, this.Width, this.Height,
                                      "icon_empty_focus.png",
                                      0xFFFFFFFF);
            m_imgFocus.AllocResources();
            m_imgNoFocus = new GUIImage(GetID, GetID * 100, _positionX, _positionY, this.Width, this.Height,
                                        "icon_empty_nofocus.png", 0xFFFFFFFF);
            m_imgNoFocus.AllocResources();
            for (int i = 0; i < 9; i++)
            {
                m_imgOverlay[i] = new GUIImage(GetID, GetID * 1000 + i, _positionX, _positionY, this.Width, this.Height,
                                               string.Format("icon_numberplace_overlay_{0}.png", i + 1), 0xFFFFFFFF);
                m_imgOverlay[i].AllocResources();
            }

            m_label = new GUILabelControl(GetID, GetID * 1000, _positionX, _positionY, this.Width, this.Height, this.FontName,
                                          string.Empty, 0xFFFFFFFF, Alignment.ALIGN_CENTER, VAlignment.ALIGN_MIDDLE, false,
                                          _shadowAngle, _shadowDistance, _shadowColor);
            _colorOverlay = new GUIImage(GetID, GetID * 10, _positionX, _positionY, this.Width, this.Height,
                                         "icon_numberplace_colouroverlay.png", 0xFFFFFFFF);
            _colorOverlay.AllocResources();
        }
        public PlaneScene(VMR9Util util)
        {
            //	Log.Info("PlaneScene: ctor()");

            _textureAddress = 0;
            _vmr9Util       = util;

            // Number of vertex buffers must be same as numer of segments in non-linear stretch
            _vertexBuffers = new VertexBuffer[nlsSourcePartitioning.Length];
            for (int i = 0; i < _vertexBuffers.Length; i++)
            {
                _vertexBuffers[i] = new VertexBuffer(typeof(CustomVertex.TransformedColoredTextured),
                                                     4,
                                                     GUIGraphicsContext.DX9Device,
                                                     0,
                                                     CustomVertex.TransformedColoredTextured.Format,
                                                     GUIGraphicsContext.GetTexturePoolType());
            }

            _blackImage = new GUIImage(0);
            _blackImage.SetFileName("black.png");
            _blackImage.AllocResources();

            _cropSettings = new CropSettings();
        }
        /// <summary>
        /// Deinitialize. Release the vertex buffer and the render target resources
        /// This function should be called at last when playing has been stopped
        /// </summary>
        public void Deinit()
        {
            GUIWindowManager.Receivers -= new SendMessageHandler(this.OnMessage);
            GUILayerManager.UnRegisterLayer(this);
            if (_renderTarget != null)
            {
                //VMR9 changes the directx 9 render target. Thats why we set it back to what it was
                if (!_renderTarget.Disposed)
                {
                    GUIGraphicsContext.DX9Device.SetRenderTarget(0, _renderTarget);
                }
                _renderTarget.SafeDispose();
                _renderTarget = null;
            }
            for (int i = 0; i < _vertexBuffers.Length; i++)
            {
                if (_vertexBuffers[i] != null)
                {
                    _vertexBuffers[i].SafeDispose();
                    _vertexBuffers[i] = null;
                }
            }
            if (_blackImage != null)
            {
                _blackImage.SafeDispose();
                _blackImage = null;
            }

            grabber.Clean();
            SubtitleRenderer.GetInstance().Clear();
        }
        public static void UpdateVoiceIndicator(GUIImage soundIcon, float voipAmplitude, float deltaTime)
        {
            if (voiceIconSheetRects == null)
            {
                var       soundIconStyle = GUI.Style.GetComponentStyle("GUISoundIcon");
                Rectangle sourceRect     = soundIconStyle.Sprites.First().Value.First().Sprite.SourceRect;
                var       indexPieces    = soundIconStyle.Element.Attribute("sheetindices").Value.Split(';');
                voiceIconSheetRects = new Rectangle[indexPieces.Length];
                for (int i = 0; i < indexPieces.Length; i++)
                {
                    Point location = sourceRect.Location + XMLExtensions.ParsePoint(indexPieces[i].Trim()) * sourceRect.Size;
                    voiceIconSheetRects[i] = new Rectangle(location, sourceRect.Size);
                }
            }

            Pair <string, float> userdata = soundIcon.UserData as Pair <string, float>;

            userdata.Second = Math.Max(voipAmplitude, userdata.Second - deltaTime);

            if (userdata.Second <= 0.0f)
            {
                soundIcon.Visible = false;
            }
            else
            {
                soundIcon.Visible = true;
                int sheetIndex = (int)Math.Floor(userdata.Second * voiceIconSheetRects.Length);
                sheetIndex              = MathHelper.Clamp(sheetIndex, 0, voiceIconSheetRects.Length - 1);
                soundIcon.SourceRect    = voiceIconSheetRects[sheetIndex];
                soundIcon.OverrideState = GUIComponent.ComponentState.None;
                soundIcon.HoverColor    = Color.White;
            }
        }
Exemple #10
0
        // Init is called on startup.
        public override void Init()
        {
            #if GUI_SIMPLE
            _guiHandler = new GUIHandler();
            _guiHandler.AttachToContext(RC);

            _guiFuseeLink                   = new GUIButton(6, 6, 157, 87);
            _guiFuseeLink.ButtonColor       = new float4(0, 0, 0, 0);
            _guiFuseeLink.BorderColor       = new float4(0, 0.6f, 0.2f, 1);
            _guiFuseeLink.BorderWidth       = 0;
            _guiFuseeLink.OnGUIButtonDown  += _guiFuseeLink_OnGUIButtonDown;
            _guiFuseeLink.OnGUIButtonEnter += _guiFuseeLink_OnGUIButtonEnter;
            _guiFuseeLink.OnGUIButtonLeave += _guiFuseeLink_OnGUIButtonLeave;
            _guiHandler.Add(_guiFuseeLink);
            _guiFuseeLogo = new GUIImage(AssetStorage.Get <ImageData>("FuseeLogo150.png"), 10, 10, -5, 150, 80);
            _guiHandler.Add(_guiFuseeLogo);
            var fontLato = AssetStorage.Get <Font>("Lato-Black.ttf");
            fontLato.UseKerning   = true;
            _guiLatoBlack         = new FontMap(fontLato, 18);
            _guiSubText           = new GUIText("FUSEE Example", _guiLatoBlack, 100, 100);
            _guiSubText.TextColor = new float4(0.05f, 0.25f, 0.15f, 0.8f);
            _guiHandler.Add(_guiSubText);
            _subtextWidth  = GUIText.GetTextWidth(_guiSubText.Text, _guiLatoBlack);
            _subtextHeight = GUIText.GetTextHeight(_guiSubText.Text, _guiLatoBlack);
            #endif

            // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A).
            RC.ClearColor = new float4(1, 1, 1, 1);

            // Load the rocket model
            _rocketScene = AssetStorage.Get <SceneContainer>("RocketModel.fus");

            //Create StereoCam for S3D rendering
            _stereoCam = new StereoCameraRig(Stereo3DMode.Anaglyph, Width, Height, 6.5f);
            _stereoCam.AttachToContext(RC);

            //Create ScreenS3DTextures object holding the 4 textures to be used with the ScreenS3D object
            ScreenS3DTextures screenTex = new ScreenS3DTextures();
            screenTex.Left       = RC.CreateTexture(AssetStorage.Get <ImageData>("left.png"));
            screenTex.LeftDepth  = RC.CreateTexture(AssetStorage.Get <ImageData>("depthLeft.png"));
            screenTex.Right      = RC.CreateTexture(AssetStorage.Get <ImageData>("right.png"));
            screenTex.RightDepth = RC.CreateTexture(AssetStorage.Get <ImageData>("depthRight.png"));
            //Create ScreenS3D Object using the ScreenS3Dtextures object from above
            _screen = new ScreenS3D(RC, screenTex);
            //Set the config fort the Screen objet. This can also be doene using a whole ScreenConfig object and assiging direktly to the ScreenS3D object
            _screen.Config.ScaleSize  = 1000;
            _screen.Config.ScaleDepth = 5;
            _screen.Config.Transform  = float4x4.CreateTranslation(0, 200, 0);
            // Wrap a SceneRenderer around the model.
            _sceneRenderer = new SceneRenderer(_rocketScene);


            // vl = AssetStorage.Get<VideoStream>("left.mkv");
            capL  = new Capture("Assets/left.mkv");
            capLD = new Capture("Assets/depthLeft.mkv");
            capR  = new Capture("Assets/right.mkv");
            capRD = new Capture("Assets/depthRight.mkv");
        }
Exemple #11
0
 /// <summary>
 /// Creates the element and retrieves all information from the control
 /// </summary>
 /// <param name="control">GUIControl</param>
 public ImageElement(GUIControl control)
     : base(control)
 {
     _image = control as GUIImage;
     if (_image != null)
     {
         _bitmap = LoadBitmap(_image.FileName);
     }
 }
Exemple #12
0
    private void CreateItemSelect(Vector2 position, float deltaLayer)
    {
        if (select != null)
        {
            select.Destroy();
        }

        select = new GUIImage("Textures/Upgrades/Select", -4.8f - deltaLayer, position, new Vector2(-1, -1) * Settings.FhdToHD, false);
    }
Exemple #13
0
        private void RenderHorizontal(float timePassed)
        {
            int startx       = _positionX;
            int imagesToDraw = _width / _textureWidth; // in case no fixed value exists => calculate it

            if (_imagesToDraw > -1)
            {
                imagesToDraw = _imagesToDraw; // we have a fixed value
            }

            for (int i = 0; i < imagesToDraw; ++i)
            {
                int texture        = 0;
                int currentPercent = ((i + 1) * 100) / imagesToDraw;
                if (_alignment == Alignment.ALIGN_RIGHT)
                {
                    currentPercent = ((imagesToDraw - i) * 100) / (imagesToDraw);
                }
                if (currentPercent <= Percentage)
                {
                    int   textureCount    = _itemList.Count - 1;
                    float fcurrentPercent = currentPercent;
                    fcurrentPercent /= 100f;
                    fcurrentPercent *= ((float)textureCount);
                    texture          = (int)fcurrentPercent;

                    //if (_alignment==Alignment.ALIGN_RIGHT)
                    //	texture=textureCount-texture;
                    if (texture < 1)
                    {
                        texture = 1;
                    }
                    if (texture >= _itemList.Count)
                    {
                        texture = _itemList.Count - 1;
                    }
                }

                if (texture < 0 || texture >= _itemList.Count || _itemList.Count <= 0)
                {
                    return;
                }

                GUIImage img = (GUIImage)_itemList[texture];
                img.SetPosition(startx, _positionY);
                img.Render(timePassed);
                if (_alignment == Alignment.ALIGN_LEFT)
                {
                    startx += _textureWidth;
                }
                else
                {
                    startx -= _textureWidth;
                }
            }
        }
Exemple #14
0
        private void DisposeImage(ref GUIImage image)
        {
            if (null == image)
            {
                return;
            }

            image.SafeDispose();
            image = null;
        }
    private void Create()
    {
        top    = new GUIImage("Textures/ScenePassage/Top", -0.1f, new Vector2(0, 100), new Vector2(-1, -1), false);
        bottom = new GUIImage("Textures/ScenePassage/Bottom", -0.15f, new Vector2(0, -100), new Vector2(-1, -1), false);
        circle = new GUIImage("Textures/ScenePassage/Circle", -0.05f, new Vector2(0, -100), new Vector2(-1, -1), false);

        top.isOnlyDirectDestroying    = true;
        bottom.isOnlyDirectDestroying = true;
        circle.isOnlyDirectDestroying = true;
    }
Exemple #16
0
        public override bool OnMessage(GUIMessage message)
        {
            switch (message.Message)
            {
            case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT:
            {
                GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, GetID, 0, 0, 0, 0, null);
                //g_application.m_guiWindowOSD.OnMessage(msg);	// Send an init msg to the OSD
                GUIGraphicsContext.Save();
                GUIGraphicsContext.Calibrating = false;
                // reset our screen resolution to what it was initially
                //GUIGraphicsContext.SetGUIResolution(g_stSettings.m_ScreenResolution);
                // Inform the player so we can update the resolution
                //if (g_application.m_pPlayer)
                //  g_application.m_pPlayer.Update();
            }
            break;

            case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT:
            {
                base.OnMessage(message);
                m_iControl = (int)Controls.CONTROL_TOP_LEFT;
                m_iSpeed   = 1;
                m_iCountU  = 0;
                m_iCountD  = 0;
                m_iCountL  = 0;
                m_iCountR  = 0;
                GUIGraphicsContext.Calibrating = true;
                // Inform the player so we can update the resolution

                // disable the UI calibration for our controls...
                GUIImage pControl = (GUIImage)GetControl((int)Controls.CONTROL_BOTTOM_RIGHT);
                if (null != pControl)
                {
                    pControl.CalibrationEnabled = false;
                    pControl = (GUIImage)GetControl((int)Controls.CONTROL_TOP_LEFT);
                    pControl.CalibrationEnabled = false;
                    pControl = (GUIImage)GetControl((int)Controls.CONTROL_SUBTITLES);
                    pControl.CalibrationEnabled = false;
                    pControl = (GUIImage)GetControl((int)Controls.CONTROL_PIXEL_RATIO);
                    pControl.CalibrationEnabled = false;
                    pControl = (GUIImage)GetControl((int)Controls.CONTROL_OSD);
                    pControl.CalibrationEnabled = false;
                    m_fPixelRatioBoxHeight      = (float)pControl.Height;
                }

                GUIMessage msg    = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_INIT, GetID, 0, 0, 0, 0, null);
                GUIWindow  window = GUIWindowManager.GetWindow((int)Window.WINDOW_OSD);
                window.OnMessage(msg); // Send an init msg to the OSD
                return(true);
            }
            }
            return(base.OnMessage(message));
        }
Exemple #17
0
        public Fabricator(Item item, XElement element)
            : base(item, element)
        {
            fabricableItems = new List <FabricableItem>();

            foreach (XElement subElement in element.Elements())
            {
                if (subElement.Name.ToString() != "fabricableitem")
                {
                    continue;
                }

                FabricableItem fabricableItem = new FabricableItem(subElement);
                if (fabricableItem.TargetItem != null)
                {
                    fabricableItems.Add(fabricableItem);
                }
            }

            GuiFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);

            itemList            = new GUIListBox(new Rectangle(0, 0, GuiFrame.Rect.Width / 2 - 20, 0), "", GuiFrame);
            itemList.OnSelected = SelectItem;

            foreach (FabricableItem fi in fabricableItems)
            {
                GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 50), Color.Transparent, null, itemList)
                {
                    UserData      = fi,
                    Padding       = new Vector4(5.0f, 5.0f, 5.0f, 5.0f),
                    HoverColor    = Color.Gold * 0.2f,
                    SelectedColor = Color.Gold * 0.5f,
                    ToolTip       = fi.TargetItem.Description
                };

                GUITextBlock textBlock = new GUITextBlock(
                    new Rectangle(40, 0, 0, 25),
                    fi.TargetItem.Name,
                    Color.Transparent, Color.White,
                    Alignment.Left, Alignment.Left,
                    null, frame);
                textBlock.ToolTip = fi.TargetItem.Description;
                textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);

                if (fi.TargetItem.sprite != null)
                {
                    GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), fi.TargetItem.sprite, Alignment.Left, frame);
                    img.Scale   = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f);
                    img.Color   = fi.TargetItem.SpriteColor;
                    img.ToolTip = fi.TargetItem.Description;
                }
            }
        }
Exemple #18
0
        partial void InitProjSpecific()
        {
            var paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), GuiFrame.RectTransform, Anchor.Center), isHorizontal: true, childAnchor: Anchor.CenterLeft)
            {
                Stretch         = true,
                RelativeSpacing = 0.03f
            };

            inputInventoryHolder = new GUIFrame(new RectTransform(new Vector2(0.1f, 1.0f), paddedFrame.RectTransform), style: null);

            itemList = new GUIListBox(new RectTransform(new Vector2(0.4f, 1.0f), paddedFrame.RectTransform))
            {
                OnSelected = SelectItem
            };

            selectedItemFrame = new GUIFrame(new RectTransform(new Vector2(0.4f, 0.8f), paddedFrame.RectTransform), style: "InnerFrame");

            outputInventoryHolder = new GUIFrame(new RectTransform(new Vector2(0.1f, 1.0f), paddedFrame.RectTransform), style: null);

            foreach (FabricableItem fi in fabricableItems)
            {
                GUIFrame frame = new GUIFrame(new RectTransform(new Point(itemList.Rect.Width, 50), itemList.Content.RectTransform), style: null)
                {
                    UserData      = fi,
                    HoverColor    = Color.Gold * 0.2f,
                    SelectedColor = Color.Gold * 0.5f,
                    ToolTip       = fi.TargetItem.Description
                };

                GUITextBlock textBlock = new GUITextBlock(new RectTransform(Vector2.Zero, frame.RectTransform, Anchor.CenterLeft)
                {
                    AbsoluteOffset = new Point(50, 0)
                },
                                                          fi.DisplayName)
                {
                    ToolTip = fi.TargetItem.Description
                };

                if (fi.TargetItem.sprite != null)
                {
                    GUIImage img = new GUIImage(new RectTransform(new Point(40, 40), frame.RectTransform, Anchor.CenterLeft)
                    {
                        AbsoluteOffset = new Point(3, 0)
                    },
                                                fi.TargetItem.sprite, scaleToFit: true)
                    {
                        Color   = fi.TargetItem.SpriteColor,
                        ToolTip = fi.TargetItem.Description
                    };
                }
            }
        }
Exemple #19
0
        /// <summary>
        /// Attaches the object to a specific <see cref="RenderContext"/> object.
        /// </summary>
        /// <param name="rc">The <see cref="RenderContext"/> object to be used.</param>
        public void AttachToContext(RenderContext rc)
        {
            _rc         = rc;
            _clearColor = rc.ClearColor;

            var imgData = new ImageData();

            imgData.Width       = _screenWidth;
            imgData.Height      = _screenHeight;
            imgData.PixelFormat = ImagePixelFormat.RGBA;
            imgData.Stride      = 4;

            //this seems is not working in the new FUSEE verison
            //var imgData = ImageData.CreateImage(_screenWidth, _screenHeight, ColorUint.Black);

            _contentLTex = _rc.CreateTexture(imgData);
            _contentRTex = _rc.CreateTexture(imgData);

            // initialize shader and image
            switch (_activeMode)
            {
            case Stereo3DMode.Oculus:
                _guiLImage = new GUIImage(default(ImageData), 0, 0, _screenWidth / 2, _screenHeight);
                _guiLImage.AttachToContext(rc);
                _guiLImage.Refresh();

                _guiRImage = new GUIImage(default(ImageData), _screenWidth / 2, 0, _screenWidth / 2, _screenHeight);
                _guiRImage.AttachToContext(rc);
                _guiRImage.Refresh();

                _shaderProgram = _rc.CreateShader(OculusVs, OculusPs);
                _shaderTexture = _shaderProgram.GetShaderParam("vTexture");

                _lensCenterParam   = _shaderProgram.GetShaderParam("LensCenter");
                _screenCenterParam = _shaderProgram.GetShaderParam("ScreenCenter");
                _scaleParam        = _shaderProgram.GetShaderParam("Scale");
                _scaleInParam      = _shaderProgram.GetShaderParam("ScaleIn");
                _hdmWarpParam      = _shaderProgram.GetShaderParam("HmdWarpParam");

                break;

            case Stereo3DMode.Anaglyph:
                _shaderProgram = _rc.CreateShader(AnaglyphVs, AnaglyphPs);
                _shaderTexture = _shaderProgram.GetShaderParam("vTexture");

                _guiLImage = new GUIImage(default(ImageData), 0, 0, _screenWidth, _screenHeight);
                _guiLImage.AttachToContext(rc);
                _guiLImage.Refresh();

                break;
            }
        }
Exemple #20
0
        public override void FinalizeConstruction()
        {
            base.FinalizeConstruction();
            _imageFocusRectangle = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                                        _focusedTextureName);
            thumbImage = new GUIImage(_parentControlId, _controlId, _positionX, _positionY, _width, _height,
                                      "#Play.Current.Thumb", 1);
            blackImage = new GUIImage(_parentControlId, _controlId, _positionX, _positionY, _width, _height, "black.png", 1);

            _imageFocusRectangle.ParentControl = this;
            thumbImage.ParentControl           = this;
            blackImage.ParentControl           = this;
        }
        private void CreateLoadingScreen()
        {
            connectionBackgorund             = new GUIImage(new System.Drawing.Rectangle(0, 0, 0, 0), UIDock.ScreenSizeRatio);
            connectionBackgorund.TextureName = "BackGround";
            connectionBackgorund.NoInteractable();
            connectionBackgorund.Disable();

            connectionTextInfo = new GUILable("Null Connection Screen Info", new System.Drawing.Rectangle(0, 0, 200, 20), UIDock.Cennter);
            connectionTextInfo.SetColor(Color4.White);
            connectionTextInfo.SetTextAling(Font.TextAling.Center);
            connectionTextInfo.ShowBackGround = false;
            connectionTextInfo.Disable();
        }
        private void CreateBackground()
        {
            GameObject      background      = new GameObject();
            CSpriteRenderer backgroundSR    = new CSpriteRenderer("Map", EOriginPosition.TopLeft, 0.01f);
            GUIImage        backgroundImage = new GUIImage(backgroundSR, false, false);

            background.Transform.Scale = GraphicsSetting.Instance.ScreenSize / new Vector2(2048, 1536); //2048, 1536 is the image's default size

            background.AddComponent <CSpriteRenderer>(backgroundSR);
            background.AddComponent <GUIImage>(backgroundImage);

            myScene.Instantiate(background);
        }
Exemple #23
0
        private void CreateBorder(Vector2 pos, Texture2D texture, Vector2 scale, float depth)
        {
            GameObject      go        = new GameObject();
            CSpriteRenderer iconSR    = new CSpriteRenderer(texture);
            GUIImage        iconImage = new GUIImage(iconSR, false, false);

            go.AddComponent <CSpriteRenderer>(iconSR);
            go.AddComponent <GUIImage>(iconImage);
            go.Transform.Scale    = scale;
            go.Transform.Position = pos;
            myScene.Instantiate(go);
            iconSR.LayerDepth = depth;
        }
 public MainPresenter(GUIFacadeControl facade, GUIImage[] stars, GUIImage bg_description, GUITextScrollUpControl text_description, GUIButtonControl button_view, GUILabelControl gamelabel_year, GUILabelControl gamelabel_genre, GUILabelControl gamelabel_company, GUILabelControl gamelabel_latestplay, GUILabelControl gamelabel_playcount)
 {
     this.facade               = facade;
     this.stars                = stars;
     this.bg_description       = bg_description;
     this.text_description     = text_description;
     this.button_view          = button_view;
     this.gamelabel_year       = gamelabel_year;
     this.gamelabel_genre      = gamelabel_genre;
     this.gamelabel_company    = gamelabel_company;
     this.gamelabel_latestplay = gamelabel_latestplay;
     this.gamelabel_playcount  = gamelabel_playcount;
 }
Exemple #25
0
        // Init is called on startup.
        public override void Init()
        {
            //Width and Height are 0 on our Android Device
            if (Width <= 0)
            {
                Width = 2560;
            }
            if (Height <= 0)
            {
                Height = 1440;
            }

            #if GUI_SIMPLE
            _guiHandler = new GUIHandler();
            _guiHandler.AttachToContext(RC);
            _guiFuseeLink                   = new GUIButton(6, 6, 157, 87);
            _guiFuseeLink.ButtonColor       = new float4(0, 0, 0, 0);
            _guiFuseeLink.BorderColor       = new float4(0, 0.6f, 0.2f, 1);
            _guiFuseeLink.BorderWidth       = 0;
            _guiFuseeLink.OnGUIButtonDown  += _guiFuseeLink_OnGUIButtonDown;
            _guiFuseeLink.OnGUIButtonEnter += _guiFuseeLink_OnGUIButtonEnter;
            _guiFuseeLink.OnGUIButtonLeave += _guiFuseeLink_OnGUIButtonLeave;
            _guiHandler.Add(_guiFuseeLink);
            _guiFuseeLogo = new GUIImage(AssetStorage.Get <ImageData>("FuseeLogo150.png"), 10, 10, -5, 150, 80);
            _guiHandler.Add(_guiFuseeLogo);
            var fontLato = AssetStorage.Get <Font>("Lato-Black.ttf");
            fontLato.UseKerning   = true;
            _guiLatoBlack         = new FontMap(fontLato, 18);
            _guiSubText           = new GUIText("Simple FUSEE Cardboard Example", _guiLatoBlack, 100, 100);
            _guiSubText.TextColor = new float4(0.05f, 0.25f, 0.15f, 0.8f);
            _guiHandler.Add(_guiSubText);
            _subtextWidth  = GUIText.GetTextWidth(_guiSubText.Text, _guiLatoBlack);
            _subtextHeight = GUIText.GetTextHeight(_guiSubText.Text, _guiLatoBlack);
            #endif

            // Set the clear color for the backbuffer to white (100% intentsity in all color channels R, G, B, A).
            RC.ClearColor = new float4(1, 1, 1, 1);

            //Initialize StereoRendering
            if (_renderStereo)
            {
                _stereo3d = new Stereo3D(Stereo3DMode.Cardboard, Width, Height);
                _stereo3d.AttachToContext(RC);
            }

            // Load the scene
            _WuggyScene = AssetStorage.Get <SceneContainer>("WuggyLand.fus");

            // Wrap a SceneRenderer around the scene.
            _sceneRenderer = new SceneRenderer(_WuggyScene);
        }
        public GUIMainMenu(Client cli)
        {
            _Client = cli;

            System.Random rand = new Random();

            imgteste             = new GUIImage(new System.Drawing.Rectangle(0, 0, 0, 0), UIDock.ScreenSizeRatio);
            imgteste.TextureName = "BackGround";
            imgteste.NoInteractable();
            imgteste.SetBackColors(new Color4(102, 70, 36, 255), Color4.White, Color4.White, Color4.White);
            imgteste.SetInteractColor(new Color4(102, 70, 36, 255));

            Logo             = new GUIImage(new System.Drawing.Rectangle(0, 135, 350, 50), UIDock.Cennter);
            Logo.TextureName = "VaKLogoYellow";
            Logo.SetBackColors(Color4.White, Color4.White, Color4.White, Color4.White);
            Logo.NoInteractable();
            Logo.SetInteractColor(Color4.White);

            PlaySingleButtom = new GUIButtom("SinglePlayer", new System.Drawing.Rectangle(0, 55, 200, 50), UIDock.Cennter);
            PlaySingleButtom.SetColor(Color4.White);
            PlaySingleButtom.SetBackColors(Color4.White, Color4.Gray, Color4.Gray, Color4.White);
            PlaySingleButtom.TextureName = "Buttom";
            PlaySingleButtom.OnClick    += PlayButtomClick;

            PlayMultiButtom = new GUIButtom("MultiPlayer", new System.Drawing.Rectangle(0, 0, 200, 50), UIDock.Cennter);
            PlayMultiButtom.SetColor(Color4.White);
            PlayMultiButtom.TextureName = "Buttom";
            PlayMultiButtom.OnClick    += PlayMButtomClick;

            QuitButtom = new GUIButtom("Quit", new System.Drawing.Rectangle(0, -55, 200, 50), UIDock.Cennter);
            QuitButtom.SetColor(Color4.White);
            QuitButtom.TextureName = "Buttom";
            QuitButtom.OnClick    += QuitButtomClick;

            VersionText = new GUILable(GlobalData.AppName + " " + GlobalData.Version, new System.Drawing.Rectangle(5, 5, 200, 20), UIDock.TopLeft);
            VersionText.SetColor(Color4.White);
            VersionText.SetTextAling(Font.TextAling.Left);
            VersionText.ShowBackGround = false;

            debugText = new GUILable("", new System.Drawing.Rectangle(5, 30, 200, 20), UIDock.TopLeft);
            debugText.SetColor(Color4.White);
            debugText.SetTextAling(Font.TextAling.Left);
            debugText.ShowBackGround = false;

            DarkcomsoftCopy = new GUILable("Copyright(c) 2020 Darkcomsoft - All rights reserved.", new System.Drawing.Rectangle(5, 5, 200, 20), UIDock.BottomLeft);
            DarkcomsoftCopy.SetColor(Color4.White);
            DarkcomsoftCopy.SetTextAling(Font.TextAling.Left);
            DarkcomsoftCopy.ShowBackGround = false;

            CreateLoadingScreen();
        }
        private void CreateCampaignIcons(string name, Vector2 pos)
        {
            GameObject      go        = new GameObject();
            CSpriteRenderer iconSR    = new CSpriteRenderer(name, EOriginPosition.TopLeft, 0.02f);
            GUIImage        iconImage = new GUIImage(iconSR, false, false);

            go.Transform.Position = pos;

            go.AddComponent <CSpriteRenderer>(iconSR);
            go.AddComponent <GUIImage>(iconImage);

            go.SetMyParent(CampaignMenuGO);
            myScene.Instantiate(go);
        }
Exemple #28
0
        protected void UpdateChannelCount()
        {
            GetChannels(false);
            GUIControl cntlPanel           = GetControl((int)Controls.PANEL_BACKGROUND);
            GUIImage   cntlChannelTemplate = (GUIImage)GetControl((int)Controls.CHANNEL_TEMPLATE);

            int iHeight     = cntlPanel.Height + cntlPanel.YPosition - cntlChannelTemplate.YPosition;
            int iItemHeight = cntlChannelTemplate.Height;

            _channelCount = (int)(((float)iHeight) / iItemHeight);

            if (_channelCount > _channelList.Count())
            {
                _channelCount = _channelList.Count();
            }
        }
Exemple #29
0
        public void ImageInSlot(Vector2 size, GameObject myParent, TextureSheet2D image)
        {
            GameObject      go       = new GameObject();
            CSpriteRenderer sr       = new CSpriteRenderer(image);
            GUIImage        GUIImage = new GUIImage(sr, false, false, Color.White, EOriginPosition.Mid, 0.13f);

            go.AddComponent <CSpriteRenderer>(sr);
            go.AddComponent <GUIImage>(GUIImage);

            go.MyParent = myParent;
            go.SetMyParent(myParent);
            go.Transform.Scale    = new Vector2(size.X / sr.SpriteSheet.Rectangle.Width * 0.6f, size.Y / sr.SpriteSheet.Rectangle.Height * 0.6f);
            go.Transform.Position = go.MyParent.Transform.Position + new Vector2(size.X / 2, size.Y / 2);

            myScene.Instantiate(go);
        }
Exemple #30
0
        private void ClearPinCode()
        {
            GUIImage[] imagePins = new GUIImage[4] {
                imagePin1, imagePin2, imagePin3, imagePin4
            };

            for (int i = 0; i < 4; i++)
            {
                imagePins[i].Visible = false;
            }

            IsCorrect = false;
            if (labelFeedback != null)
            {
                labelFeedback.Label = " ";
            }
        }
        public static void hide()
        {
            if (!_isShown)
                return;

            Debug.Log("Hiding Main Page.");

            _pageTitle.destroy();
            _pageTitle = null;

            _backButton.destroy();
            _backButton = null;

            _levelsContainer.destroy();
            _levelsContainer = null;

            _isShown = false;
        }
        public static void hide()
        {
            if (!_isShown)
                return;

            Debug.Log("Hiding Main Page.");

            _pageTitle.destroy();
            _pageTitle = null;

            _levelButton.destroy();
            _levelButton = null;

            _editorButton.destroy();
            _editorButton = null;

            _optionsButton.destroy();
            _optionsButton = null;

            _exitButton.destroy();
            _exitButton = null;

            _isShown = false;
        }
        public static void show()
        {
            if (_isShown)
                return;

            _isShown = true;

            Debug.Log("Showing Options Page.");

            // Epoch Escape Title ======================================================================================
            _pageTitle = new GUIImage((_obj) =>
            {
                GUIImage obj = _obj as GUIImage;

                obj.position(new Vector2(0, 0.7f));
                obj.size(new Vector2(800, 120));
                obj.image(_rm.sprite("Textures/GUI/MainMenu/EpochOptions"));
            });

            _backButton = new GUIButton((_obj) =>
            {
                GUIButton obj = _obj as GUIButton;

                obj.name("backButton");
                obj.position(new Vector2(-0.9f, 0.7f));
                obj.size(new Vector2(30, 30));
                obj.setBaseBackground(_rm.sprite("Textures/GUI/Buttons/LeftArrow"), Color.white);
                obj.setOverBackground(_rm.sprite("Textures/GUI/Buttons/LeftArrowHover"), Color.white);
                obj.setDownBackground(_rm.sprite("Textures/GUI/Buttons/LeftArrowHover"), Color.white);

                obj.addListener(EventTriggerType.PointerClick, (e) =>
                {
                    MainPage.show();
                    OptionsPage.hide();
                });
            });

            _optionsContainer = new GUIImage((_obj) =>
            {
                GUIImage obj = _obj as GUIImage;

                obj.name("optionsContainer");
                obj.position(new Vector2(0, -0.2f), GUIObject.POSITION_TYPE.PERCENT);
                obj.size(new Vector2(600, 400));
                obj.image(null);
                obj.imageColor(new Color(0, 0, 0, 0.1f));

                new GUI.GUIText((_creditsObj) =>
                {
                    GUI.GUIText creditsObj = _creditsObj as GUI.GUIText;

                    creditsObj.name("credits");
                    obj.addChild(creditsObj);

                    creditsObj.position(new Vector2(0, 0), GUIObject.POSITION_TYPE.RELATIVE);
                    creditsObj.size(new Vector2(550, 300));
                    creditsObj.font(Resources.Load<Font>("Fonts/Sans"));
                    creditsObj.fontSize(26);
                    creditsObj.text("Credits:\n" +
                        "\tAdam Burkhalter: Lead Developer/Project Manager\n" +
                        "\tTerry Rogers: Developer\n" +
                        "\tMicah Lee: Developer\n" +
                        "\tMichael Hsieh: Developer\n" +
                        "\tCandelaria Herrera: Project Manager");
                });
            });
        }
        public static void show()
        {
            if (_isShown)
                return;

            _isShown = true;

            Debug.Log("Showing Main Page.");

            // Epoch Escape Title ======================================================================================
            _pageTitle = new GUIImage((_obj) =>
            {
                _pageTitle.position(new Vector2(0, 0.7f));
                _pageTitle.size(new Vector2(800, 120));
                _pageTitle.image(_rm.sprite("Textures/GUI/MainMenu/EpochLevels"));
            });

            _backButton = new GUIButton((_obj) =>
            {
                GUIButton obj = _obj as GUIButton;

                obj.name("backButton");
                obj.position(new Vector2(-0.9f, 0.7f));
                obj.size(ARROW_SIZE);
                obj.setBaseBackground(_rm.sprite("Textures/GUI/Buttons/LeftArrow"), Color.white);
                obj.setOverBackground(_rm.sprite("Textures/GUI/Buttons/LeftArrowHover"), Color.white);
                obj.setDownBackground(_rm.sprite("Textures/GUI/Buttons/LeftArrowHover"), Color.white);

                obj.addListener(EventTriggerType.PointerClick, (e) =>
                {
                    MainPage.show();
                    LevelsPage.hide();
                });
            });

            _levelsContainer = new GUIVerticalDialog((_obj) =>
            {
                GUIVerticalDialog obj = _obj as GUIVerticalDialog;
                obj.name("levelsContainer");

                obj.position(new Vector2(0, -0.2f), GUIObject.POSITION_TYPE.PERCENT);
                obj.size(new Vector2(600, 400));
                obj.overflow(GUI.GUIContent.OVERFLOW_TYPE.HIDE);
                obj.backgroundImage(null);
                obj.backgroundColor(new Color(0, 0, 0, 0.1f));
                obj.contentHeight(800);

                new GUI.GUIText((_level1) =>
                {
                    GUI.GUIText level1 = _level1 as GUI.GUIText;
                    obj.addChild(level1);

                    level1.name("Level1");
                    level1.text("This is the first level");
                    level1.font(Resources.Load<Font>("Fonts/Sans"));
                    level1.fontColor(Color.black);
                });
            });
        }
        public static void show()
        {
            if (_isShown)
                return;

            _isShown = true;

            Debug.Log("Showing Main Page.");

            // Epoch Escape Title ======================================================================================
            _pageTitle = new GUIImage((_obj) =>
            {
                GUIImage obj = _obj as GUIImage;
                obj.position(new Vector3(0, 0.7f));
                obj.size(new Vector2(800, 120));
                obj.image(_rm.sprite("Textures/GUI/MainMenu/EpochEscape"));
            });

            // Level Button ============================================================================================
            _levelButton = new GUIButton((_obj) =>
            {
                GUIButton obj = _obj as GUIButton;
                obj.name("levelButton");
                obj.position(new Vector3(0, 0.2f));
                obj.size(new Vector2(150, 60));
                obj.setBaseBackground(_rm.sprite("Textures/GUI/MainMenu/LevelsButton"), Color.white);
                obj.setOverBackground(_rm.sprite("Textures/GUI/MainMenu/LevelsButtonHover"), Color.white);
                obj.setDownBackground(_rm.sprite("Textures/GUI/MainMenu/LevelsButtonHover"), Color.white);

                obj.addListener(EventTriggerType.PointerClick, (e) =>
                {
                    LevelsPage.show();
                    MainPage.hide();
                });
            });

            // Editor Button ===========================================================================================
            _editorButton = new GUIButton((_obj) =>
            {
                GUIButton obj = _obj as GUIButton;
                obj.name("editorButton");
                obj.position(new Vector2(0, -0.1f));
                obj.size(new Vector2(150, 60));
                obj.setBaseBackground(_rm.sprite("Textures/GUI/MainMenu/EditorButton"), Color.white);
                obj.setOverBackground(_rm.sprite("Textures/GUI/MainMenu/EditorButtonHover"), Color.white);
                obj.setDownBackground(_rm.sprite("Textures/GUI/MainMenu/EditorButtonHover"), Color.white);

                obj.addListener(EventTriggerType.PointerClick, (e) =>
                {
                    Driver.Get().progress(Driver.DRIVER_STATE.EDITOR);
                });
            });

            // Options Button ==========================================================================================
            _optionsButton = new GUIButton((_obj) =>
            {
                GUIButton obj = _obj as GUIButton;

                obj.name("optionsButton");
                obj.position(new Vector2(0, -0.4f));
                obj.size(new Vector2(150, 60));
                obj.setBaseBackground(_rm.sprite("Textures/GUI/MainMenu/OptionsButton"), Color.white);
                obj.setOverBackground(_rm.sprite("Textures/GUI/MainMenu/OptionsButtonHover"), Color.white);
                obj.setDownBackground(_rm.sprite("Textures/GUI/MainMenu/OptionsButtonHover"), Color.white);

                obj.addListener(EventTriggerType.PointerClick, (e) =>
                {
                    OptionsPage.show();
                    MainPage.hide();
                });
            });

            // Exit Button =============================================================================================
            _exitButton = new GUIButton((_obj) =>
            {
                GUIButton obj = _obj as GUIButton;

                obj.name("exitButton");
                obj.position(new Vector2(0, -0.7f));
                obj.size(new Vector2(150, 60));
                obj.setBaseBackground(_rm.sprite("Textures/GUI/MainMenu/ExitButton"), Color.white);
                obj.setOverBackground(_rm.sprite("Textures/GUI/MainMenu/ExitButtonHover"), Color.white);
                obj.setDownBackground(_rm.sprite("Textures/GUI/MainMenu/ExitButtonHover"), Color.white);

                obj.addListener(EventTriggerType.PointerClick, (e) =>
                {
                    Debug.Log("Exiting Game.");

                    Driver.Get().progress(Driver.DRIVER_STATE.EXIT);
                });
            });
        }
  public override void FinalizeConstruction()
  {
    base.FinalizeConstruction();

    m_Font = GUIFontManager.GetFont((m_strFont != "" && m_strFont != "-") ? m_strFont : "font18");

    if (m_strTexture != "" && m_strTexture != "-")
    {
      m_imgTexture = new GUIImage(_parentControlId, 9998, _positionX, _positionY, this.Width, this.Height, m_strTexture,
                                  m_dwColorDiffuse);
    }

    if (m_strTextureFocused != "" && m_strTextureFocused != "-")
    {
      m_imgTextureFocused = new GUIImage(_parentControlId, 9999, _positionX, _positionY, this.Width, this.Height,
                                         m_strTextureFocused, m_dwColorDiffuse);
    }

    m_imgGuide = new GUIImage[2];

    m_nBoardWidth = (m_nBoardWidth == -99999) ? this.Width : m_nBoardWidth;
    m_nBoardHeight = (m_nBoardHeight == -99999) ? this.Height : m_nBoardHeight;

    m_cyBlock = m_nBoardHeight / (Game.Height + 2);
    m_cxBlock = m_cyBlock;
    m_nBoardWidth = m_cxBlock * Game.Width;

    m_nBoardX = (m_nBoardX == -99999) ? _positionX + ((this.Width - (m_cxBlock * Game.Width)) / 2) : m_nBoardX;
    m_nBoardY = (m_nBoardY == -99999) ? _positionY + ((this.Height - (m_cyBlock * Game.Height)) / 2) : m_nBoardY;
    m_nBoardY = m_nBoardY - m_cyBlock;

    m_imgBlocks = new GUIImage[]
                    {
                      new GUIImage(_parentControlId, 10001, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                   GUIGraphicsContext.Skin + @"\media\tetris\block_red.png", m_dwColorDiffuse),
                      new GUIImage(_parentControlId, 10002, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                   GUIGraphicsContext.Skin + @"\media\tetris\block_blue.png", m_dwColorDiffuse),
                      new GUIImage(_parentControlId, 10003, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                   GUIGraphicsContext.Skin + @"\media\tetris\block_gray.png", m_dwColorDiffuse),
                      new GUIImage(_parentControlId, 10004, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                   GUIGraphicsContext.Skin + @"\media\tetris\block_yellow.png", m_dwColorDiffuse),
                      new GUIImage(_parentControlId, 10005, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                   GUIGraphicsContext.Skin + @"\media\tetris\block_cyan.png", m_dwColorDiffuse),
                      new GUIImage(_parentControlId, 10006, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                   GUIGraphicsContext.Skin + @"\media\tetris\block_orange.png", m_dwColorDiffuse),
                      new GUIImage(_parentControlId, 10007, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                   GUIGraphicsContext.Skin + @"\media\tetris\block_green.png", m_dwColorDiffuse),
                    };

    m_imgBlocksGlow = new GUIImage[]
                        {
                          new GUIImage(_parentControlId, 10011, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                       GUIGraphicsContext.Skin + @"\media\tetris\block_red_glow.png", m_dwColorDiffuse),
                          new GUIImage(_parentControlId, 10012, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                       GUIGraphicsContext.Skin + @"\media\tetris\block_blue_glow.png", m_dwColorDiffuse)
                          ,
                          new GUIImage(_parentControlId, 10013, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                       GUIGraphicsContext.Skin + @"\media\tetris\block_gray_glow.png", m_dwColorDiffuse)
                          ,
                          new GUIImage(_parentControlId, 10014, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                       GUIGraphicsContext.Skin + @"\media\tetris\block_yellow_glow.png",
                                       m_dwColorDiffuse),
                          new GUIImage(_parentControlId, 10015, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                       GUIGraphicsContext.Skin + @"\media\tetris\block_cyan_glow.png", m_dwColorDiffuse)
                          ,
                          new GUIImage(_parentControlId, 10016, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                       GUIGraphicsContext.Skin + @"\media\tetris\block_orange_glow.png",
                                       m_dwColorDiffuse),
                          new GUIImage(_parentControlId, 10017, _positionX, _positionY, m_cxBlock, m_cyBlock,
                                       GUIGraphicsContext.Skin + @"\media\tetris\block_green_glow.png", m_dwColorDiffuse)
                          ,
                        };

    m_strStart = GUILocalizeStrings.Get(19010);
    m_strPaused = GUILocalizeStrings.Get(19011);
    m_strGameOver = GUILocalizeStrings.Get(19012);

    m_imgBlocksNext = new GUIImage[7];

    if (m_strTextureO != "" && m_strTextureO != "-")
    {
      m_imgBlocksNext[0] = new GUIImage(_parentControlId, 10021, _positionX, _positionY, 0, 0, m_strTextureO,
                                        m_dwColorDiffuse);
    }

    if (m_strTextureI != "" && m_strTextureI != "-")
    {
      m_imgBlocksNext[1] = new GUIImage(_parentControlId, 10022, _positionX, _positionY, 0, 0, m_strTextureI,
                                        m_dwColorDiffuse);
    }

    if (m_strTextureS != "" && m_strTextureS != "-")
    {
      m_imgBlocksNext[2] = new GUIImage(_parentControlId, 10023, _positionX, _positionY, 0, 0, m_strTextureS,
                                        m_dwColorDiffuse);
    }

    if (m_strTextureZ != "" && m_strTextureZ != "-")
    {
      m_imgBlocksNext[3] = new GUIImage(_parentControlId, 10024, _positionX, _positionY, 0, 0, m_strTextureZ,
                                        m_dwColorDiffuse);
    }

    if (m_strTextureL != "" && m_strTextureL != "-")
    {
      m_imgBlocksNext[4] = new GUIImage(_parentControlId, 10025, _positionX, _positionY, 0, 0, m_strTextureL,
                                        m_dwColorDiffuse);
    }

    if (m_strTextureT != "" && m_strTextureT != "-")
    {
      m_imgBlocksNext[5] = new GUIImage(_parentControlId, 10026, _positionX, _positionY, 0, 0, m_strTextureT,
                                        m_dwColorDiffuse);
    }

    if (m_strTextureJ != "" && m_strTextureJ != "-")
    {
      m_imgBlocksNext[6] = new GUIImage(_parentControlId, 10027, _positionX, _positionY, 0, 0, m_strTextureJ,
                                        m_dwColorDiffuse);
    }

    if (m_imgBlocksNext != null)
    {
      foreach (GUIImage image in m_imgBlocksNext)
      {
        if (image != null)
        {
          image.ScaleToScreenResolution();
        }
      }
    }

    if (m_strTextureLeft != "" && m_strTextureLeft != "-")
    {
      m_imgGuide[0] = new GUIImage(_parentControlId, 9996, _positionX, _positionY, 0, 0, m_strTextureLeft,
                                   m_dwColorDiffuse);
    }

    if (m_strTextureRight != "" && m_strTextureRight != "-")
    {
      m_imgGuide[1] = new GUIImage(_parentControlId, 9997, _positionX, _positionY, 0, 0, m_strTextureRight,
                                   m_dwColorDiffuse);
    }
  }