Ejemplo n.º 1
0
 public void ResetGame()
 {
     SetScale(ScreenScale.ScaleByPercent(Camera.main, new Vector3(0.20f, 0.20f, 0.20f), true));
     SetPosition(PositionToScreen.Position(Camera.main, new Vector3(0.50f, 0.50f, 0.0f)));
     velocity = Vector2.zero;
     gameObject.SendMessage("Shrinking", false);
 }
Ejemplo n.º 2
0
        public ProjectExplorerForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
            var sc = ScreenScale.Calc();

            if (sc >= 1.99)
            {
                this.tvProjectExplorer.ImageList = this.imageList2;
            }

            this.tvProjectExplorer.LabelEdit        = true;
            this.tvProjectExplorer.BeforeLabelEdit += tvProjectExplorer_BeforeLabelEdit;
            this.Icon = new System.Drawing.Icon(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("VisualPascalABC.Resources.PadIcons.ProjectBrowser.ico"));
            pRJBUILDToolStripMenuItem.Image    = VisualPABCSingleton.MainForm.BuildImage;
            pRJBUILDALLToolStripMenuItem.Image = VisualPABCSingleton.MainForm.RebuildImage;
            pRJRUNToolStripMenuItem.Image      = VisualPABCSingleton.MainForm.RunImage;
            pRJNEWFILEToolStripMenuItem.Image  = VisualPABCSingleton.MainForm.NewFileImage;
            pRJOPENToolStripMenuItem.Image     = VisualPABCSingleton.MainForm.OpenFileImage;
            pRJFORMToolStripMenuItem.Image     = VisualPABCSingleton.MainForm.NewFormImage;
            Form1StringResources.SetTextForAllControls(this.AddReferenceMenuStrip);
            Form1StringResources.SetTextForAllControls(this.ProjectMenuStrip);
            Form1StringResources.SetTextForAllControls(this.ReferenceMenuStrip);
            Form1StringResources.SetTextForAllControls(this.SouceFileMenuStrip);
            this.tvProjectExplorer.AfterLabelEdit += new NodeLabelEditEventHandler(LabelEditFinished);
        }
Ejemplo n.º 3
0
        public CodeTemplatesForm()
        {
            InitializeComponent();
            var scale = ScreenScale.Calc();

            listBox1.TileSize = new Size(listBox1.TileSize.Width, System.Convert.ToInt32(16 * scale));
            LoadTemplates();
        }
        public ScreenSizeMenuController(ScreenScaleController controller, ToolStripMenuItem item, ScreenScale scale)
        {
            this.controller = controller;
            this.scale = scale;
            this.item = item;

            item.Click += Item_Click;
            controller.SizeChanged += Controller_SizeChanged;
            controller.NtscSet += Controller_NtscSet;
        }
Ejemplo n.º 5
0
        public ScreenSizeMenuController(ScreenScaleController controller, ToolStripMenuItem item, ScreenScale scale)
        {
            this.controller = controller;
            this.scale      = scale;
            this.item       = item;

            item.Click             += Item_Click;
            controller.SizeChanged += Controller_SizeChanged;
            controller.NtscSet     += Controller_NtscSet;
        }
Ejemplo n.º 6
0
 private void Controller_SizeChanged(object sender, ScreenScaleChangedEventArgs e)
 {
     if (e.Scale == ScreenScale.Fullscreen)
     {
         this.item.Checked = true;
     }
     else
     {
         this.lastScale    = e.Scale;
         this.item.Checked = false;
     }
 }
        private void Raise(ScreenScale scale)
        {
            var e = SizeChanged;

            if (e != null)
            {
                var args = new ScreenScaleChangedEventArgs()
                {
                    Scale = scale
                };
                e(this, args);
            }
        }
        public void Ntsc(snes_ntsc_setup_t setup)
        {
            CurrentScale = ScreenScale.NTSC;
            var e = NtscSet;

            if (e != null)
            {
                var args = new ScreenScaleNtscEventArgs()
                {
                    Setup = setup
                };
                e(this, args);
            }
        }
Ejemplo n.º 9
0
        public void ScaleScreen(ScreenScale scale)
        {
            if (scale == ScreenScale.Fullscreen)
            {
                SetFullscreen();
            }
            else
            {
                UnsetFullscreen();
            }

            if (scale == ScreenScale.X1)
            {
                widthZoom = heightZoom = 1;
            }
            else if (scale == ScreenScale.X2)
            {
                widthZoom = heightZoom = 2;
            }
            else if (scale == ScreenScale.X3)
            {
                widthZoom = heightZoom = 3;
            }
            else if (scale == ScreenScale.X4)
            {
                widthZoom = heightZoom = 4;
            }

            if (Game.CurrentGame == null)
            {
                DefaultScreen();
                xnaImage.NTSC = false;
            }
            else if (scale == ScreenScale.NTSC)
            {
                NtscScreen();
            }
            else
            {
                ResizeScreen();
                xnaImage.NTSC = false;
            }
        }
Ejemplo n.º 10
0
    public void StartGame()
    {
        gameState = GameState.Started;

        gameOverCanvas.SetActive(false);

        IGame game;

        for (int n = 0; n < iGameObjects.Length; n++)
        {
            foreach (Component comp in iGameObjects[n].GetComponents(typeof(IGame)))
            {
                game = comp as IGame;
                game.StartGame();
            }
        }

        // Set borders:
        Vector3 lScale          = ScreenScale.Scale(Camera.main, leftBorder);
        Vector3 rScale          = ScreenScale.Scale(Camera.main, rightBorder);
        Vector3 tScale          = ScreenScale.Scale(Camera.main, topBorder);
        Vector3 bScale          = ScreenScale.Scale(Camera.main, bottomBorder);
        Vector3 backgroundScale = ScreenScale.Scale(Camera.main, background);

        leftBorder.transform.localScale = new Vector3(bScale.x, lScale.y);
        leftBorder.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.0f, 0.0f, 0.0f));

        rightBorder.transform.localScale = new Vector3(tScale.x, rScale.y);
        rightBorder.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(1.0f, 1.0f, 0.0f));

        topBorder.transform.localScale = new Vector3(tScale.x, rScale.y);
        topBorder.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.0f, 1.0f, 0.0f));

        bottomBorder.transform.localScale = new Vector3(bScale.x, lScale.y);
        bottomBorder.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.0f, 0.0f, 0.0f));

        background.transform.localScale = new Vector3(backgroundScale.x, backgroundScale.y);
        background.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.5f, 0.5f, 0.0f));

        // Set ads:

        // Set Google Play Score:
    }
Ejemplo n.º 11
0
    void Start()
    {
        Vector3 lScale = ScreenScale.Scale(Camera.main, l);
        Vector3 rScale = ScreenScale.Scale(Camera.main, r);
        Vector3 tScale = ScreenScale.Scale(Camera.main, t);
        Vector3 bScale = ScreenScale.Scale(Camera.main, b);

        l.transform.localScale = new Vector3(bScale.x, lScale.y);
        l.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.0f, 0.0f, 0.0f));

        r.transform.localScale = new Vector3(tScale.x, rScale.y);
        r.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(1.0f, 1.0f, 0.0f));

        t.transform.localScale = new Vector3(tScale.x, rScale.y);
        t.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.0f, 1.0f, 0.0f));

        b.transform.localScale = new Vector3(bScale.x, lScale.y);
        b.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.0f, 0.0f, 0.0f));
    }
Ejemplo n.º 12
0
        void ComboBoxDrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
        {
            ComboBox comboBox = (ComboBox)sender;

            lock (comboBox)
            {
                e.DrawBackground();
                if (e.Index >= 0)
                {
                    ComboBoxItem item = (ComboBoxItem)comboBox.Items[e.Index];
                    var          dx   = Convert.ToInt32(Math.Round(2 * ScreenScale.Calc()));
                    e.Graphics.DrawImage(CodeCompletionProvider.ImagesProvider.ImageList.Images[item.IconIndex],
                                         e.Bounds.X + dx, e.Bounds.Y, // + (e.Bounds.Height - CodeCompletionProvider.ImagesProvider.ImageList.ImageSize.Height) / 2
                                         e.Bounds.Height, e.Bounds.Height
                                         );
                    Rectangle drawingRect = new Rectangle(e.Bounds.X + dx + e.Bounds.Height /*CodeCompletionProvider.ImagesProvider.ImageList.ImageSize.Width*/,
                                                          e.Bounds.Y,
                                                          e.Bounds.Width - dx - e.Bounds.Height /*CodeCompletionProvider.ImagesProvider.ImageList.ImageSize.Width*/,
                                                          e.Bounds.Height);

                    Brush drawItemBrush = SystemBrushes.WindowText;
                    if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
                    {
                        drawItemBrush = SystemBrushes.HighlightText;
                    }
                    if (!item.IsInCurrentPart)
                    {
                        drawItemBrush = SystemBrushes.ControlDark;
                    }
                    else if (e.State == DrawItemState.ComboBoxEdit && !item.IsInside(textAreaControl.ActiveTextAreaControl.Caret.Line, textAreaControl.ActiveTextAreaControl.Caret.Column))
                    {
                        drawItemBrush = SystemBrushes.ControlDark;
                    }
                    e.Graphics.DrawString(item.ToString(),
                                          font,
                                          drawItemBrush,
                                          drawingRect,
                                          drawStringFormat);
                }
                //e.DrawFocusRectangle();
            }
        }
Ejemplo n.º 13
0
        public ErrorsListWindowForm(Form1 MainForm)
            : base(MainForm)
        {
            InitializeComponent();
            Form1StringResources.SetTextForAllControls(this.contextMenuStrip1);
            var sc = ScreenScale.Calc();

            if (sc != 1.0)
            {
                columnHeader6.Width  = Convert.ToInt32(columnHeader6.Width * sc);
                columnHeader7.Width  = Convert.ToInt32(columnHeader7.Width * sc);
                columnHeader8.Width  = Convert.ToInt32(columnHeader8.Width * sc);
                columnHeader9.Width  = Convert.ToInt32(columnHeader9.Width * sc);
                columnHeader10.Width = Convert.ToInt32(columnHeader10.Width * 0.9 * sc);
                columnHeader11.Width = Convert.ToInt32(columnHeader11.Width * sc);
            }
            if (sc >= 1.99)
            {
                this.lvErrorsList.SmallImageList = this.ilvlErrorList32;
            }
        }
Ejemplo n.º 14
0
        protected override void OnMeasureItem(System.Windows.Forms.MeasureItemEventArgs e)
        {
            if (e.Index > -1)
            {
                int      w          = 0;
                string   fontstring = Items[e.Index].ToString();
                Graphics g          = CreateGraphics();
                e.ItemHeight = (int)g.MeasureString(fontstring, new Font(fontstring, 10)).Height;
                w            = (int)g.MeasureString(fontstring, new Font(fontstring, 10)).Width;
                if (both)
                {
                    int h1 = (int)g.MeasureString(samplestr, new Font(fontstring, 10)).Height;
                    int h2 = (int)g.MeasureString(Items[e.Index].ToString(), new Font("Arial", 10)).Height;
                    int w1 = (int)g.MeasureString(samplestr, new Font(fontstring, 10)).Width;
                    int w2 = (int)g.MeasureString(Items[e.Index].ToString(), new Font("Arial", 10)).Width;
                    if (h1 > h2)
                    {
                        h2 = h1;
                    }
                    e.ItemHeight = h2;
                    w            = w1 + w2;
                }
                //w += ttimg.Width*2;
                if (w > maxwid)
                {
                    maxwid = w;
                }
                var ss = ScreenScale.Calc();
                if (e.ItemHeight > Convert.ToInt32(20 * ss))
                {
                    e.ItemHeight = Convert.ToInt32(20 * ss);
                }
            }



            base.OnMeasureItem(e);
        }
 public void Change(ScreenScale scale)
 {
     CurrentScale = scale;
     Raise(scale);
 }
Ejemplo n.º 16
0
        public QuickClassBrowserPanel(CodeFileDocumentTextEditorControl textAreaControl)
        {
            InitializeComponent();
            this.membersComboBox.DropDownHeight = Convert.ToInt32(this.membersComboBox.DropDownHeight * ScreenScale.Calc());
            this.classComboBox.DropDownHeight   = Convert.ToInt32(this.classComboBox.DropDownHeight * ScreenScale.Calc());

            this.membersComboBox.MaxDropDownItems = 20;

            base.Dock            = DockStyle.Top;
            this.textAreaControl = textAreaControl;
            this.textAreaControl.ActiveTextAreaControl.Caret.PositionChanged += new EventHandler(CaretPositionChanged);
            if (VisualPABCSingleton.MainForm != null && !VisualPABCSingleton.MainForm.UserOptions.ShowQuickClassBrowserPanel)
            {
                this.Visible = false;
            }
            if (VisualPABCSingleton.MainForm != null)
            {
                th              = new Thread(new ThreadStart(ChangeInternal));
                th.Priority     = ThreadPriority.Lowest;
                th.IsBackground = true;
                th.Start();
            }
        }
Ejemplo n.º 17
0
 private void Controller_NtscSet(object sender, ScreenScaleNtscEventArgs e)
 {
     this.item.Checked = false;
     this.lastScale    = ScreenScale.NTSC;
 }