Exemple #1
0
        /// <summary>
        /// Creates a new text to be shown on screen.
        /// </summary>
        /// <param name="text">The text to be shown.</param>
        /// <param name="align">The alignment of the text.</param>
        /// <param name="dialogs"></param>
        /// <param name="game"></param>
        /// <remarks>Use to Coords property to set the location.</remarks>
        public TextGraphics(string text, Align align, Dialogs dialogs, Game game)
        {
            this.game = game;
            this.dialogs = dialogs;
            this.align = align;
            SdlDotNet.Graphics.Font font = dialogs.Font;

            //HACK: Font.Render only returns a Surface with transparent background when called
            //      with textWidth=0 and maxLines=0, and when the text contains no newline characters.
            //      Otherwise it renders on a black background.
            //      So we need to break up the string into lines by hand.
            List<string> lines = SplitAndRejoin(text, font);
            textSurfaces = lines.ConvertAll<Surface>(s => font.Render(s, Color.White, true, 0, 0));
        }
Exemple #2
0
 public ScriptLib(Game game)
 {
     this.game = game;
     dialogs = new Dialogs(game);
 }
 public WindowGraphics(int width, int height, Dialogs dialogs)
 {
     size = new Size(width + dialogs.Margin, height + dialogs.Margin);
     this.dialogs = dialogs;
 }