public void Create()
        {
            _logger  = GameObject.Find("Logger").GetComponent <Text>();
            _printer = new TextPrinter(_logger);

            // Initializing variables
            _tank = GetComponent <Tank>();

            if (ScriptPath != "")
            {
                // Initializing LUA
                _luaState = new Lua();
                Debug.Log(Environment.CurrentDirectory);
                Debug.Log("Loading script: " + ScriptPath);
                try
                {
                    _mainFile = _luaState.LoadFile(ScriptPath);
                    _mainFile.Call();

                    SetupPrefs();
                    RegFuncs();
                }
                catch (LuaException ex)
                {
                    Debug.LogError("Exception occured while loading Lua script: " + ex);
                    _printer.Print("Exception occured while loading Lua script: " + ex, Color.red, true, false);
                    _printer.Endl();
                }
            }
            else
            {
                gameObject.AddComponent <ManualTankController>();
                _player = true;
            }
        }
예제 #2
0
    public static void Main(String[] args)
    {
        Lexer  l = new Lexer(new StreamReader(args[0]));
        Parser p = new Parser(l);
        Start  s = p.Parse();

        TextPrinter printer = new TextPrinter();

        if (args.Length > 0 && args[0] == "-ansi")
        {
            printer.SetColor(true);
        }

        //s.Apply(printer);

        int indexOfLastDot  = args[0].LastIndexOf('.');
        int extensionLength = args[0].Length - indexOfLastDot;

        string output = args[0].Remove(indexOfLastDot, extensionLength);

        CodeGenerator cg = new CodeGenerator(new StreamWriter(output + ".il"));

        //CodeGenerator cg = new CodeGenerator(Console.Out);
        s.Apply(cg);

        //comment out later
        // Console.ReadLine();
    }
예제 #3
0
 void Start()
 {
     textPrinterScript = GetComponent <TextPrinter>();
     myRigidbody       = GetComponent <Rigidbody>();
     isGrounded        = true;
     animator          = GetComponent <Animator>();
 }
예제 #4
0
        public MainForm()
        {
            InitializeComponent();

            print        = new TextPrinter(new Font("Verdana", 9.0f, FontStyle.Bold));
            hudPage      = HudPages.ModelStats;
            hudBackColor = Color.FromArgb(96, Color.Black);

            glControl1.VSync = Properties.Settings.Default.VSync;
            enableHUDToolStripMenuItem.Checked               = Properties.Settings.Default.EnableHUD;
            disableAllShadersToolStripMenuItem.Checked       = Properties.Settings.Default.DisableAllShaders;
            enableSkeletalRenderingToolStripMenuItem.Checked = Properties.Settings.Default.EnableSkeletalStuff;

            iconImageListSmall = new ImageList()
            {
                ColorDepth = ColorDepth.Depth32Bit, ImageSize = new Size(16, 16)
            };
            iconImageListSmall.Images.Add("folderc", Win32.GetFolderIcon(Win32.IconSize.Small, Win32.FolderType.Closed));
            iconImageListSmall.Images.Add("foldero", Win32.GetFolderIcon(Win32.IconSize.Small, Win32.FolderType.Open));
            iconImageListSmall.Images.Add("default", Win32.GetDllIcon("shell32.dll", 72, Win32.IconSize.Small));

            treeViewEx1.ImageList        = iconImageListSmall;
            treeViewEx1.ImageKey         = "folderc";
            treeViewEx1.SelectedImageKey = "foldero";

            meshToRender = -1;
            renderError  = false;

            this.Text = Program.Description;
        }
        /// <summary>
        /// Context unique creation
        /// </summary>
        public TGPAContext()
        {
            Shots   = new List <Shot>();
            Enemies = new List <BadGuy>();
            Bonuses = new List <Bonus>();

            Saver = new Saver();

            ParticleManager  = new ParticleManager();
            ButtonPrinter    = new ButtonPrinter();
            InputManager     = new InputManager();
            SongInfo         = new SongInfo();
            Cheatcodes       = new Cheatcodes();
            TextPrinter      = new TextPrinter();
            CurrentGameState = GameState.None;

#if WINDOWS
            IsTrialMode = false;
#else
            IsTrialMode = Guide.IsTrialMode;
#endif

            PaperRect = new Rectangle(180, 630, 640, 150);

            ScoreMulti  = 1f;
            DamageMulti = 1f;
        }
예제 #6
0
        public override void Draw(Graphics2D g)
        {
            int width  = 800;
            int height = 600;

            //clear the image to white
            g.Clear(ColorRGBA.White);
            // draw a circle

            Ellipse ellipsePro = new Ellipse(0, 0, 100, 50);

            for (double angleDegrees = 0; angleDegrees < 180; angleDegrees += 22.5)
            {
                var mat = Affine.NewMatix(
                    AffinePlan.Rotate(MathHelper.DegreesToRadians(angleDegrees)),
                    AffinePlan.Translate(width / 2, 150));

                VertexStore sp1 = mat.TransformToVxs(ellipsePro.MakeVxs());

                g.Render(sp1, ColorRGBA.Yellow);

                //Stroke ellipseOutline = new Stroke(sp1, 3);
                g.Render(StrokeHelp.MakeVxs(sp1, 3), ColorRGBA.Blue);
            }

            // and a little polygon
            PathWriter littlePoly = new PathWriter();

            littlePoly.MoveTo(50, 50);
            littlePoly.LineTo(150, 50);
            littlePoly.LineTo(200, 200);
            littlePoly.LineTo(50, 150);
            littlePoly.LineTo(50, 50);
            g.Render(littlePoly.MakeVertexSnap(), ColorRGBA.Cyan);

            // draw some text
            // draw some text



            var textPrinter = new TextPrinter();

            textPrinter.CurrentFont = SvgFontStore.LoadFont(SvgFontStore.DEFAULT_SVG_FONTNAME, 30);
            //new TypeFacePrinter("Printing from a printer", 30, justification: Justification.Center);

            VertexStore vxs   = textPrinter.CreateVxs("Printing from a printer".ToCharArray());
            var         affTx = Affine.NewTranslation(width / 2, height / 4 * 3);
            VertexStore s1    = affTx.TransformToVxs(vxs);


            g.Render(s1, ColorRGBA.Black);
            g.Render(StrokeHelp.MakeVxs(s1, 1), ColorRGBA.Red);


            var aff2 = Affine.NewMatix(
                AffinePlan.Rotate(MathHelper.DegreesToRadians(90)),
                AffinePlan.Translate(40, height / 2));

            g.Render(aff2.TransformToVertexSnap(vxs), ColorRGBA.Black);
        }
예제 #7
0
        public void Setup(int canvasW, int canvasH)
        {
            //--------------------------------------
            //TODO: review here again

            DrawingGL.Text.Utility.SetLoadFontDel(
                fontfile =>
            {
                if (File.Exists("DroidSans.ttf"))
                {
                    using (Stream s = new FileStream("DroidSans.ttf", FileMode.Open, FileAccess.Read))
                        using (var ms = new MemoryStream()) // This is a simple hack because on Xamarin.Android, a `Stream` created by `AssetManager.Open` is not seekable.
                        {
                            s.CopyTo(ms);
                            return(new MemoryStream(ms.ToArray()));
                        }
                }


                return(null);
            });

            //--------------------------------------
            simpleCanvas = new SimpleCanvas(canvasW, canvasH);

            var text = "Typography";


            //optional ....
            //var directory = AndroidOS.Environment.ExternalStorageDirectory;
            //var fullFileName = Path.Combine(directory.ToString(), "TypographyTest.txt");
            //if (File.Exists(fullFileName))
            //{
            //    text = File.ReadAllText(fullFileName);
            //}
            //--------------------------------------------------------------------------
            //we want to create a prepared visual object ***
            //textContext = new TypographyTextContext()
            //{
            //    FontFamily = "DroidSans.ttf", //corresponding to font file Assets/DroidSans.ttf
            //    FontSize = 64,//size in Points
            //    FontStretch = FontStretch.Normal,
            //    FontStyle = FontStyle.Normal,
            //    FontWeight = FontWeight.Normal,
            //    Alignment = DrawingGL.Text.TextAlignment.Leading
            //};
            //--------------------------------------------------------------------------
            //create blank text run
            textRun = new TextRun();
            //generate glyph run inside text text run

            TextPrinter textPrinter = simpleCanvas.TextPrinter;

            textPrinter.FontFilename     = "DroidSans.ttf"; //corresponding to font file Assets/DroidSans.ttf
            textPrinter.FontSizeInPoints = 64;
            //
            simpleCanvas.TextPrinter.GenerateGlyphRuns(textRun, text.ToCharArray(), 0, text.Length);
            //--------------------------------------------------------------------------
        }
예제 #8
0
 public FPSDisplay()
 {
     textPrinter = new TextPrinter(TextQuality.High);
     this.Color  = Color.Black;
     AccumCount  = 100;
     accumTime   = 0;
     timeBuffer  = new LinkedList <double>();
 }
예제 #9
0
        public void ReprintAllText()
        {
            TextPrinter.ClearText();

            foreach (ChatBufferItem item in textBuffer)
            {
                ProcessBufferItem(item, false);
            }
        }
예제 #10
0
 public void ReprintAllText()
 {
     TextPrinter.ClearText();
     PrintLastLog();
     foreach (object obj in textBuffer)
     {
         ProcessIM(obj, false);
     }
 }
예제 #11
0
        private void PrintLastLog()
        {
            string last = string.Empty;

            try
            {
                last = ReadEndTokens(instance.ChatFileName(sessionName + ".txt"), 20, Encoding.UTF8, Environment.NewLine);
            }
            catch { }

            if (string.IsNullOrEmpty(last))
            {
                return;
            }

            string[] lines = last.Split(Environment.NewLine.ToCharArray());
            foreach (var line in lines)
            {
                string msg = line.Trim();
                if (!string.IsNullOrEmpty(msg))
                {
                    /*
                     * if(fontSettings.ContainsKey("History"))
                     * {
                     *  var fontSetting = fontSettings["History"];
                     *  TextPrinter.ForeColor = fontSetting.ForeColor;
                     *  TextPrinter.BackColor = fontSetting.BackColor;
                     *  TextPrinter.Font = fontSetting.Font;
                     * }
                     * else
                     * {
                     *  TextPrinter.ForeColor = SystemColors.GrayText;
                     *  TextPrinter.BackColor = Color.Transparent;
                     *  TextPrinter.Font = Settings.FontSetting.DefaultFont;
                     * }
                     */
                    TextPrinter.PrintTextLine(msg);
                }
            }

            /*
             * if(fontSettings.ContainsKey("History"))
             * {
             *  var fontSetting = fontSettings["History"];
             *  TextPrinter.ForeColor = fontSetting.ForeColor;
             *  TextPrinter.BackColor = fontSetting.BackColor;
             *  TextPrinter.Font = fontSetting.Font;
             * }
             * else
             * {
             *  TextPrinter.ForeColor = SystemColors.GrayText;
             *  TextPrinter.BackColor = Color.Transparent;
             *  TextPrinter.Font = Settings.FontSetting.DefaultFont;
             * }
             */
            TextPrinter.PrintTextLine("====");
        }
예제 #12
0
 public TextController(MonoBehaviour consumer)
 {
     canvas = consumer.GetComponent <Text>();
     mesh   = consumer.GetComponent <TextMesh>();
     //Pro = consumer.GetComponent<TextMeshPro>();
     //uGUIPro = consumer.GetComponent<TextMeshProUGUI>();
     input = consumer.GetComponent <InputField>();
     twife = consumer.GetComponent <TextPrinter>();
 }
예제 #13
0
 public AggCanvasPainter(ImageGraphics2D graphic2d)
 {
     this.gx             = graphic2d;
     this.sclineRas      = gx.ScanlineRasterizer;
     this.stroke         = new Stroke(1);//default
     this.scline         = graphic2d.ScanlinePacked8;
     this.sclineRasToBmp = graphic2d.ScanlineRasToDestBitmap;
     this.textPrinter    = new TextPrinter();
 }
예제 #14
0
 public void PrintDocumentToFile(String Filename, String Type, String Template, Int64 documentId, String connectionstring)
 {
     datacollection = new DataSet();
     port           = new FilePort(Filename);
     printer        = PrinterFactory.getPrinter(Type);
     port.SetDocumentName("CDS DOC " + documentId);
     job = printer.getDefaultJobProperties();
     PrintDocumentFromTemplate(Template, documentId, connectionstring);
     printer.endJob();
 }
예제 #15
0
        public void Test_Printer_Types()
        {
            //arrange
            TextPrinter printer = new TextPrinter("utterance");

            //act
            printer.Type();
            //assert
            Assert.IsTrue(printer.Typed.Length == "utterance".Length);
        }
예제 #16
0
        public void Test_Printer_Prints()
        {
            //arrange
            TextPrinter printer = new TextPrinter("utterance");

            //act
            Assert.IsTrue(string.IsNullOrEmpty(printer.Printed));
            printer.Print();
            //assert
            Assert.IsTrue(printer.Printed == "utterance");
        }
예제 #17
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     if (rbImage.Checked)
     {
         ImagePrinter imagePrinter = new ImagePrinter(Convert.ToInt32(txtHeight.Text), Convert.ToInt32(txtWidth.Text));
         Status(imagePrinter);
     }
     else if (rbtext.Checked)
     {
         TextPrinter textPrinter = new TextPrinter(Convert.ToInt32(txtHeight.Text), Convert.ToInt32(txtWidth.Text));
         Status(textPrinter);
     }
 }
        /// <summary>
        /// Global content loading
        /// </summary>
        /// <param name="Content"></param>
        public void LoadContent(ContentManager Content)
        {
            ParticleManager.LoadContent(Content);
            ButtonPrinter.LoadContent(Content);
            TextPrinter.LoadContent(Content);

            BonusTex = Content.Load <Texture2D>(@"gfx/bonus");
            ShotsTex = Content.Load <Texture2D>(@"gfx/tirs");
            HudTex   = Content.Load <Texture2D>(@"gfx/hud");

            NullTex = Content.Load <Texture2D>(@"gfx/1x1");

            SongInfo.LoadContent(Content);
        }
예제 #19
0
    public static void Main(String[] args)
    {
        Lexer  l = new Lexer(Console.In);
        Parser p = new Parser(l);
        Start  s = p.Parse();

        TextPrinter printer = new TextPrinter();

        if (args.Length > 0 && args[0] == "-ansi")
        {
            printer.SetColor(true);
        }

        s.Apply(printer);
    }
예제 #20
0
        public void DisplayNotification(string message)
        {
            if (instance.MainForm.InvokeRequired)
            {
                instance.MainForm.Invoke(new System.Windows.Forms.MethodInvoker(() => DisplayNotification(message)));
                return;
            }

            if (ShowTimestamps)
            {
                /*
                 * if(fontSettings.ContainsKey("Timestamp"))
                 * {
                 *  var fontSetting = fontSettings["Timestamp"];
                 *  TextPrinter.ForeColor = fontSetting.ForeColor;
                 *  TextPrinter.BackColor = fontSetting.BackColor;
                 *  TextPrinter.Font = fontSetting.Font;
                 *  TextPrinter.PrintText(DateTime.Now.ToString("[HH:mm] "));
                 * }
                 * else
                 * {
                 *  TextPrinter.ForeColor = SystemColors.GrayText;
                 *  TextPrinter.BackColor = Color.Transparent;
                 *  TextPrinter.Font = Settings.FontSetting.DefaultFont;
                 *  TextPrinter.PrintText(DateTime.Now.ToString("[HH:mm] "));
                 * }
                 */
            }

            /*
             * if(fontSettings.ContainsKey("Notification"))
             * {
             *  var fontSetting = fontSettings["Notification"];
             *  TextPrinter.ForeColor = fontSetting.ForeColor;
             *  TextPrinter.BackColor = fontSetting.BackColor;
             *  TextPrinter.Font = fontSetting.Font;
             * }
             * else
             * {
             *  TextPrinter.ForeColor = Color.DarkCyan;
             *  TextPrinter.BackColor = Color.Transparent;
             *  TextPrinter.Font = Settings.FontSetting.DefaultFont;
             * }
             */

            instance.LogClientMessage(sessionName + ".txt", message);
            TextPrinter.PrintTextLine(message);
        }
예제 #21
0
        public void PrintDocument(String Printer, String Type, String Template, Int64 documentId, String connectionstring)
        {
            datacollection = new DataSet();
            port           = new WindowsPrinter(Printer);
            printer        = PrinterFactory.getPrinter(Type);
            port.SetDocumentName("CDS DOC " + documentId);
            job = printer.getDefaultJobProperties();

            job.draftQuality = true;
            job.pitch        = 10;
            //job.paperSize = PaperSize.LETTER;

            PrintDocumentFromTemplate(Template, documentId, connectionstring);

            printer.endJob();
        }
예제 #22
0
 void OnEnable()
 {
     if (rp == null)
     {
         rp = GameObject.Find("Response_Pannel").GetComponent <ResponsePrinter> ();
     }
     if (tp == null)
     {
         tp = GameObject.Find("Text_pannel").GetComponent <TextPrinter> ();
     }
     if (terminal == null)
     {
         terminal = GameObject.FindObjectOfType <Terminal> ();
     }
     //newNodeStart += SetNodeTags;
     //nodeCleanup += UnSetNodeTags;
     //newNodeStart += ExecuteNode;
     rp.onButtonSubmit += FindNextNode;
     tp.onNodeChange   += GetNodePassage;
 }
예제 #23
0
    // Start is called before the first frame update
    void Start()
    {
        /* up1Prefab =  Resources.Load(textPrinterScript.levelTask[textPrinterScript.letterIndex].ToString() ,typeof(GameObject)) as GameObject;
         * if (up1Prefab != null)
         * {
         *   Instantiate(up1Prefab,letterPositions[0].transform.position,Quaternion.identity,letterPositions[0].transform);
         * }*/


        textPrinterScript = GameObject.Find("Player").GetComponent <TextPrinter>();

        down = Instantiate(letter, letterPositions[1].transform.position, Quaternion.identity, letterPositions[1].transform) as GameObject;
        down.transform.GetChild(0).transform.GetChild(0).GetComponent <Text>().text = textPrinterScript.levelTask[textPrinterScript.letterIndex].ToString();
        down.GetComponent <Letter>().whichLetter = textPrinterScript.levelTask[textPrinterScript.letterIndex].ToString();

        up = Instantiate(letter, letterPositions[0].transform.position, Quaternion.identity, letterPositions[0].transform) as GameObject;
        up.transform.GetChild(0).transform.GetChild(0).GetComponent <Text>().text = textPrinterScript.levelTask[textPrinterScript.letterIndex + 1].ToString();
        up.GetComponent <Letter>().whichLetter = textPrinterScript.levelTask[textPrinterScript.letterIndex + 1].ToString();
        //down = Instantiate(Resources.Load(textPrinterScript.levelTask[textPrinterScript.letterIndex].ToString()), letterPositions[1].transform.position,Quaternion.identity,letterPositions[1].transform) as GameObject;
        //up = Instantiate(Resources.Load(textPrinterScript.levelTask[textPrinterScript.letterIndex+1].ToString()), letterPositions[0].transform.position,Quaternion.identity,letterPositions[0].transform) as GameObject;
    }
예제 #24
0
    public static void Main(String[] args)
    {
        Lexer  l = new Lexer(new StreamReader(args[0]));
        Parser p = new Parser(l);

        Start s = p.Parse();

        TextPrinter printer = new TextPrinter();

        if (args.Length > 0 && args[0] == "-ansi")
        {
            printer.SetColor(true);
        }

        s.Apply(printer);

        SemanticAnalyzer sa = new SemanticAnalyzer();

        s.Apply(sa);
        //Console.WriteLine("Press anykey to close...");
        //Console.ReadKey();
    }
예제 #25
0
        public static void Main(string[] args)
        {
            var data = "Hello World !";
            AbstractMediator abstractMediator = new Mediator.Mediator();

            AbstractPrinter textPrinter = new TextPrinter(abstractMediator);
            AbstractPrinter xmlPrinter  = new XmlPrinter(abstractMediator);
            AbstractPrinter htmlPrinter = new HtmlPrinter(abstractMediator);

            abstractMediator.Register(textPrinter);
            abstractMediator.Register(xmlPrinter);
            abstractMediator.Register(htmlPrinter);

            Console.WriteLine("Text Printer talking ......\n");
            textPrinter.Print(data, textPrinter.PrinterType);
            textPrinter.PrintToOtherFormat(data, xmlPrinter.PrinterType, textPrinter.PrinterType);

            Console.WriteLine("\nText Printer talking ......\n");
            xmlPrinter.Print(data, xmlPrinter.PrinterType);
            xmlPrinter.PrintToOtherFormat(data, textPrinter.PrinterType, xmlPrinter.PrinterType);

            Console.WriteLine("\nText Printer talking ......\n");
            htmlPrinter.PrintToOtherFormat(data, xmlPrinter.PrinterType, htmlPrinter.PrinterType);
        }
예제 #26
0
        protected void CalculateSizesAndLoadFonts()
        {
            double windowWidth = this.Width, windowHeight = this.Height;

              if (!string.IsNullOrEmpty(Settings.GameDescription))
              {
            // Reserve part of the top screen space for the description text
            windowHeight *= 0.93;
              }

              double descriptionHeight = (this.Height - windowHeight);

              pixelSize = Math.Min(windowWidth, windowHeight) / (double)Settings.Tiles;
              textureOffset = (pixelSize - (pixelSize * 0.85f)) / 2.0f;
              buttonSize = pixelSize * 0.35f;
              halfButtonSize = buttonSize / 2.0f;
              boardSize = pixelSize * Settings.Tiles;
              boardLeft = ((double)windowWidth - boardSize) / 2.0f;
              boardTop = descriptionHeight + (((double)windowHeight - boardSize) / 2.0f);
              //timerBoxSize = Math.Max(boardLeft, boardTop) * 0.5f;
              timerBoxSize = boardLeft * 0.65f;
              timerBoxMargin = timerBoxSize * 0.1f;

              // Load fonts
              teamNameText = new TextPrinter(Brushes.White, new Font(FontFamily.GenericMonospace, (float)buttonSize * 0.9f, FontStyle.Bold));
              smallScoreText = new TextPrinter(Brushes.White, new Font(FontFamily.GenericMonospace, (float)buttonSize * 0.50f, FontStyle.Bold));
              bigScoreText = new TextPrinter(Brushes.White, new Font(FontFamily.GenericMonospace, (float)buttonSize * 0.75f, FontStyle.Bold));
              communalScoreText = new TextPrinter(Brushes.White, new Font(FontFamily.GenericMonospace, (float)timerBoxSize * 0.40f, FontStyle.Bold));
              descriptionText = new TextPrinter(Brushes.White, new Font(FontFamily.GenericSansSerif, (float)descriptionHeight * 0.45f, FontStyle.Bold));

              var descriptionSize = descriptionText.Measure(Settings.GameDescription);
              descriptionPoint.X = ((float)windowWidth - descriptionSize.Width) / 2.0f;
              descriptionPoint.Y = ((float)descriptionHeight - descriptionSize.Height) / 2.0f;
        }
예제 #27
0
        private void customGLControl_Load(object sender, EventArgs e)
        {
            SettingsGUIInit();

            StartupExtensionChecks();

            Initialization.SetDefaults();

            glText = new TextPrinter(new Font("Verdana", 9.0f, FontStyle.Bold));
            camera = new Camera();
            fpsMonitor = new FPSMonitor();

            oglSceneScale = 0.02;

            ready = true;
        }
예제 #28
0
 public EntityTextHelper()
 {
     _printer     = new TextPrinter(TextQuality.Low);
     _printerFont = new Font(FontFamily.GenericSansSerif, 12, GraphicsUnit.Pixel);
 }
예제 #29
0
 static Text()
 {
     instance = new TextPrinter();
 }
예제 #30
0
 public ObjectDisplay()
 {
     this.textPrinter = new TextPrinter(TextQuality.High);
     this.Objects     = new Dictionary <string, object>();
     this.text        = string.Empty;
 }
예제 #31
0
 public ViewportLabelListener(ViewportBase viewport)
 {
     Viewport = viewport;
     _printer = new TextPrinter(TextQuality.Low);
     Rebuild();
 }
예제 #32
0
 static ListItem()
 {
     _writer  = new GLTextWriter();
     _printer = new TextPrinter();
 }