コード例 #1
0
ファイル: Renderer.cs プロジェクト: neilpate/Asteroids
        public Renderer()
        {
            SDL.SDL_Init(SDL.SDL_INIT_VIDEO);

            window = SDL.SDL_CreateWindow("Asterids", SDL.SDL_WINDOWPOS_UNDEFINED, SDL.SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL.SDL_WindowFlags.SDL_WINDOW_SHOWN);
            Rend   = SDL.SDL_CreateRenderer(window, -1, SDL.SDL_RendererFlags.SDL_RENDERER_ACCELERATED);

            fontManager = new FontManager();
            fontManager.CreateFont(@"c:\windows\fonts\hyperspace.otf", "hyper", 28);

            var textColor = new SDL.SDL_Color
            {
                r = 0xFF,
                g = 0x32,
                b = 0x90
            };

            var st = new StringTexture(Rend, fontManager.GetFont("hyper"), textColor)
            {
                x = 0,
                y = 0
            };

            stringTextures.Add("fps", st);

            st = new StringTexture(Rend, fontManager.GetFont("hyper"), textColor)
            {
                x = 100,
                y = 100
            };
            stringTextures.Add("score", st);

            st = new StringTexture(Rend, fontManager.GetFont("hyper"), textColor)
            {
                x = 300,
                y = 400
            };
            stringTextures.Add("copyright", st);
        }
コード例 #2
0
 public TestGameWindow() : base()
 {
     anonymous_font = StringTexture.NewFont("Fonts/Anonymous Pro.ttf", "Anonymous Pro", 20, FontStyle.Bold);
     teststring     = new StringTexture("This is a test string\nLine 2 of test string", anonymous_font, Color.White, Color.DarkGreen);
 }