예제 #1
0
 public int sceFontFindFont(FontLibrary FontLibrary, FontStyle* FontStylePointer, uint* ErrorCode)
 {
     var FontRegistry = FontLibrary.FontRegistryList.OrderByDescending(Entry => FontStyle.GetScoreCompare(Entry.FontStyle, *FontStylePointer)).First();
     var FontIndex = FontLibrary.FontRegistryList.IndexOf(FontRegistry);
     *ErrorCode = 0;
     return FontIndex;
 }
        public Font sceFontOpenUserFile(FontLibrary FontLibrary, string FileName, int Mode, uint *ErrorCode)
        {
            var FontFileStream = HleIoManager.HleIoWrapper.Open(FileName, Vfs.HleIoFlags.Read, (Vfs.SceMode)Mode);
            var PGF            = new Pgf().Load(FontFileStream);
            var Font           = new Font(FontLibrary, PGF);

            *ErrorCode = 0;
            return(Font);
        }
예제 #3
0
 public int sceFontGetFontList(FontLibrary FontLibrary, FontStyle* FontStylesPointer, int MaximumNumberOfFontsToGet)
 {
     int NumberOfFontsReturned = Math.Min(MaximumNumberOfFontsToGet, FontLibrary.FontRegistryList.Count);
     for (int n = 0; n < NumberOfFontsReturned; n++)
     {
         FontStylesPointer[n] = FontLibrary.FontRegistryList[n].FontStyle;
     }
     return NumberOfFontsReturned;
 }
        //[HlePspNotImplemented]
        public int sceFontFindFont(FontLibrary FontLibrary, FontStyle *FontStylePointer, uint *ErrorCode)
        {
            var FontRegistry = FontLibrary.FontRegistryList
                               .OrderByDescending(Entry => FontStyle.GetScoreCompare(Entry.FontStyle, *FontStylePointer)).First();
            var FontIndex = FontLibrary.FontRegistryList.IndexOf(FontRegistry);

            *ErrorCode = 0;
            return(FontIndex);
        }
        public Font sceFontOpenUserMemory(FontLibrary FontLibrary, byte *MemoryFontAddress, int MemoryFontLength,
                                          uint *ErrorCode)
        {
            var MemoryFont = PointerUtils.PointerToByteArray(MemoryFontAddress, MemoryFontLength);
            var PGF        = new Pgf().Load(new MemoryStream(MemoryFont));
            var Font       = new Font(FontLibrary, PGF);

            *ErrorCode = 0;
            return(Font);
        }
        public int sceFontGetFontList(FontLibrary FontLibrary, FontStyle *FontStylesPointer,
                                      int MaximumNumberOfFontsToGet)
        {
            int NumberOfFontsReturned = Math.Min(MaximumNumberOfFontsToGet, FontLibrary.FontRegistryList.Count);

            for (int n = 0; n < NumberOfFontsReturned; n++)
            {
                FontStylesPointer[n] = FontLibrary.FontRegistryList[n].FontStyle;
            }
            return(NumberOfFontsReturned);
        }
예제 #7
0
 public void Initialize()
 {
     Fonts = new FontLibrary(gs);
     //LevelMaps = new LevelMapLibrary(gs);
     LevelScripts = new LevelScriptLibrary(gs);
     Songs        = new SongLibrary(gs);
     SoundEffects = new SoundEffectLibrary(gs);
     Textures     = new TextureLibrary(gs);
     Sprites      = new SpriteLibrary(gs);
     Stories      = new StoryLibrary(gs);
 }
예제 #8
0
        public FontLibraryHandle sceFontNewLib(FontNewLibParams *Params, uint *errorCode)
        {
            //if (Params != null) throw (new NotImplementedException("(Params != null)"));

            var FontLibrary = new FontLibrary()
            {
                Params = *Params,
            };

            return((FontLibraryHandle)FontLibraries.Create(FontLibrary));
        }
예제 #9
0
파일: FeContent.cs 프로젝트: pacojq/Ferret
        /// <summary>
        ///
        /// </summary>
        /// <param name="path">Path to a TTF font</param>
        /// <param name="size">Size of the font</param>
        public static Font LoadFont(string path, int size, char defaultChar = '_')
        {
            // TODO try/catch FileNotFoundException and look for the font in the system

            path = CheckFilename(path, ".ttf");
            FontLibrary lib = new FontLibrary(File.OpenRead(path), FeGame.Instance.GraphicsDevice);
            Font        fnt = lib.CreateFont(size);

            fnt.DefaultCharacter = defaultChar;
            fnt.PreheatCache("asdfghjklñqwertyuiopzxcvbnm");
            return(fnt);
        }
예제 #10
0
        public FontLibrary sceFontNewLib(FontNewLibParams* Params, uint* ErrorCode)
        {
            //if (Params != null) throw (new NotImplementedException("(Params != null)"));

            var FontLibrary = new FontLibrary()
            {
                Params = *Params,
            };

            *ErrorCode = 0;

            return FontLibrary;
        }
예제 #11
0
        public FontLibrary sceFontNewLib(FontNewLibParams *Params, uint *ErrorCode)
        {
            //if (Params != null) throw (new NotImplementedException("(Params != null)"));

            var FontLibrary = new FontLibrary()
            {
                Params = *Params,
            };

            *ErrorCode = 0;

            return(FontLibrary);
        }
예제 #12
0
        public FontLibrarian(FontLibrary lib, string id, FontStyle fst, FontSize fsz)
        {
            _id  = id;
            _fst = fst;
            _fsz = fsz;
            _lib = lib;

            // Actual font entry
            var f = lib.lookup(id, fst);

            // Real size
            var rsz = (byte)lib.lookupSz(fsz);

            _current = f.ToFont(rsz);
        }
            public ResizableCharacter(Vector2I position, char character, Color color, int size)
            {
                this.position = position;

                int sizeX = (FontLibrary.CHARWIDTH * size) + 2;
                int sizeY = (FontLibrary.CHARHEIGHT * size) + 2;

                center = new Vector2I((FontLibrary.CHARWIDTH * size) / 2 + 1, (FontLibrary.CHARHEIGHT * size) / 2);

                this.color = color;
                this.size  = size;

                canvas = new Canvas(sizeX, sizeY);

                characterbitMap = FontLibrary.GetCharacterBitmap(character);

                Generate();
            }
예제 #14
0
파일: GameFont.cs 프로젝트: ByteChkR/Minor
        /// <summary>
        /// Creates the default font from embedded program resources
        /// </summary>
        /// <returns>The Default font</returns>
        private static GameFont GetDefaultFont()
        {
            Assembly asm = Assembly.GetExecutingAssembly();

            string[] paths = asm.GetManifestResourceNames();
            string   path  = asm.GetName().Name + "._DefaultResources.DefaultFont.ttf";

            using (Stream resourceStream = asm.GetManifestResourceStream(path))
            {
                if (resourceStream == null)
                {
                    Logger.Crash(new EngineException("Could not load default font"), false);
                    return(null);
                }

                GameFont f = FontLibrary.LoadFontInternal(resourceStream, 32, out string name);
                resourceStream.Close();
                return(f);
            }
        }
        //[HlePspNotImplemented]
        public Font sceFontOpen(FontLibrary FontLibrary, int Index, int Mode, uint *ErrorCode)
        {
            var FontRegistry = FontLibrary.FontRegistryList[Index];

            try
            {
                var FontFileStream = HleIoManager.HleIoWrapper.Open("flash0:/font/" + FontRegistry.FontStyle.FileName,
                                                                    Vfs.HleIoFlags.Read, Vfs.SceMode.All);
                var PGF       = new Pgf().Load(FontFileStream);
                var Font      = new Font(FontLibrary, PGF);
                *   ErrorCode = 0;
                return(Font);
            }
            catch (FileNotFoundException)
            {
                var Font      = new Font(FontLibrary, new NativeFontIpgf());
                *   ErrorCode = 0;
                return(Font);
            }
        }
예제 #16
0
        /// <summary>
        /// The default Constructor.
        /// </summary>
        public SceneManager(GameWindow gameWindow, Camera camera, FontLibrary fontLibrary, string fontPath, IDirectoryHandler directoryHandler, IGameSettings gameSettings, ValueWrapper <bool> debug)
        {
            GameWindow      = gameWindow;
            SceneList       = new List <Scene>();
            _scenesToAdd    = new List <Scene>();
            _scenesToRemove = new List <Scene>();

            Directories = directoryHandler;

            FontPath        = fontPath;
            GameFontLibrary = fontLibrary;
            DefaultFont     = GameFontLibrary.GetFirstOrDefault(GameFontType.Default);
            FontDrawing     = new QFontDrawing();
            FontDrawing.ProjectionMatrix = camera.ScreenProjectionMatrix;

            ScreenCamera              = camera;
            ScreenCamera.Center       = Vector2.Zero;
            ScreenCamera.MaximumScale = new Vector2(10000, 10000);

            GameSettings = gameSettings;

            Debug = debug;
        }
예제 #17
0
 public Font sceFontOpenUserMemory(FontLibrary FontLibrary, byte* MemoryFontAddress, int MemoryFontLength, uint* ErrorCode)
 {
     var MemoryFont = PointerUtils.PointerToByteArray(MemoryFontAddress, MemoryFontLength);
     var PGF = new PGF().Load(new MemoryStream(MemoryFont));
     var Font = new Font(FontLibrary, PGF);
     *ErrorCode = 0;
     return Font;
 }
예제 #18
0
 public float sceFontPixelToPointH(FontLibrary FontLibrary, float FontPointsH, int* ErrorCode)
 {
     *ErrorCode = 0;
     return FontPointsH * PointDPI / FontLibrary.HorizontalResolution;
 }
 public float sceFontPixelToPointV(FontLibrary FontLibrary, float FontPointsV, int *ErrorCode)
 {
     *ErrorCode = 0;
     return(FontPointsV * PointDPI / FontLibrary.VerticalResolution);
 }
예제 #20
0
 public int sceFontGetNumFontList(FontLibrary FontLibrary, uint* ErrorCode)
 {
     *ErrorCode = 0;
     return FontLibrary.FontRegistryList.Count;
 }
예제 #21
0
 public int sceFontDoneLib(FontLibrary FontLibrary)
 {
     FontLibrary.RemoveUid(InjectContext);
     return(0);
 }
예제 #22
0
        public void LoadLoadingScreen(Texture background = null)
        {
            LoadingSymbol = TextureLoader.FileToTexture("assets/textures/LoadingSymbol.jpg");
            bg            = new GameObject("Background");
            if (background == null)
            {
                BlackBG = HoBMenuScene.menubg;
            }
            else
            {
                BlackBG = background;
            }

            UiImageRendererComponent bgImage =
                new UiImageRendererComponent(BlackBG, false, 1, DefaultFilepaths.DefaultUiImageShader);

            bgImage.RenderQueue = -1;
            bg.AddComponent(bgImage);
            bg.AddComponent(new BackgroundMover());
            Add(bg);

            GameObject text            = new GameObject("text");
            GameFont   f               = FontLibrary.LoadFontDirect("assets/fonts/default_font.ttf", 64);
            UiTextRendererComponent tr = new UiTextRendererComponent(f, false, 1, DefaultFilepaths.DefaultUiTextShader);

            text.AddComponent(tr);
            bg.Add(text);
            tr.Text        = "Loading...";
            tr.SystemColor = Color.Black;
            tr.Scale       = Vector2.One * 3;
            tr.RenderQueue = -1;
            tr.Position    = new Vector2(-0.7f, -0.7f);
            loading        = new GameObject("Loading");
            UiImageRendererComponent loadingImage =
                new UiImageRendererComponent(LoadingSymbol, false, 1, DefaultFilepaths.DefaultUiImageShader);

            loadingImage.RenderQueue = -1;
            loading.AddComponent(loadingImage);
            Add(loading);
            float size = 0.05f;

            loadingImage.Position = new Vector2(0.7f, -0.7f);
            loadingImage.Scale    = new Vector2(size, GameEngine.Instance.AspectRatio * size);
            LinearAnimation loadAnim = new LinearAnimation();
            Interpolator    intP     = new Arc2Interpolator();

            loadAnim.Interpolator     = intP;
            loadAnim.StartPos         = loadingImage.Position;
            loadAnim.EndPos           = loadingImage.Position + Vector2.UnitY * 0.1f;
            loadAnim.MaxAnimationTime = 0.5f;
            loadAnim.Trigger          = AnimationTrigger.None;
            loadAnim.AnimationDelay   = 0f;
            Animator anim = new Animator(new List <Animation> {
                loadAnim
            }, loadingImage);

            loading.AddComponent(anim);
            LoopTimer(anim, loadAnim);
            GameObject   obj   = new GameObject("Timer");
            GeneralTimer timer = new GeneralTimer(0.5f, () => LoopTimer(anim, loadAnim), true);

            obj.AddComponent(timer);
            Add(obj);
        }
예제 #23
0
        /// <summary>
        /// Setup OpenGL and load resources here.
        /// </summary>
        /// <param name="e">Not used.</param>
        protected override void OnLoad(EventArgs e)
        {
            //fontPath = Path.Combine(_directoryHandler["Fonts"].FullName, "./Chamgagne Limousines/Champagne & Limousines Italic.ttf");
            //fontPath = Path.Combine(_directoryHandler["Fonts"].FullName, "./Ostrich Sans/OstrichSans-Black.otf");
            var menuFontPath      = Path.Combine(_directoryHandler["Fonts"].FullName, "./Oswald-Bold.ttf");
            var versionFontPath   = _directoryHandler.Locate("Fonts", "./Oswald-Regular.ttf");
            var bodyFontPath      = _directoryHandler.Locate("Fonts", "./Open Sans/OpenSans-Light.ttf");
            var largeBodyFontPath = _directoryHandler.Locate("Fonts", "./Open Sans/OpenSans-Regular.ttf");
            //var selectedFontPath = _directoryHandler.Locate("Fonts", "./Open Sans/OpenSans-Bold.ttf");
            var selectedFontPath = Path.Combine(_directoryHandler["Fonts"].FullName, "./Oswald-Bold.ttf");

            Console.WriteLine("Initializing");

            Console.WriteLine("Creating game camera");
            var gameCamera = new Camera(prefWidth, prefHeight, Width, Height, Mouse);

            gameCamera.CameraBounds = gameCamera.OriginalBounds = new Polygon(new Vector2(-prefWidth * 10, -prefHeight * 10), (int)prefWidth * 20, (int)(prefHeight * 20));

            // Register OSX codecs if running on OSX
            if (PlatformDetection.RunningPlatform() == Platform.MacOSX)
            {
                Console.WriteLine("Registering OSX Audio codecs");
                CSCore.OSXCoreAudio.OSXAudio.RegisterCodecs();
            }

            Console.WriteLine("Creating font library");
            var fontLibrary = new FontLibrary();

            Console.WriteLine("Loading fonts");
            // Default font
            var gameFont = new QFont(bodyFontPath, 18, new QFontBuilderConfiguration()
            {
                SuperSampleLevels = 2
            });

            fontLibrary.AddFont(new GameFont(gameFont, GameFontType.Default, new Vector2(Width, Height)));

            // Menu font
            fontLibrary.AddFont(
                new GameFont(new QFont(menuFontPath, 50, new QFontBuilderConfiguration(true)),
                             GameFontType.Menu,
                             new Vector2(Width, Height)));

            // Menu World font
            fontLibrary.AddFont(
                new GameFont(new QFont(menuFontPath, 70, new QFontBuilderConfiguration(true)
            {
                SuperSampleLevels = 2, PageMaxTextureSize = 8192, Characters = CharacterSet.BasicSet
            }),
                             "menuworld",
                             new Vector2(Width, Height)));

            // Heading font
            fontLibrary.AddFont(
                new GameFont(new QFont(menuFontPath, 20, new QFontBuilderConfiguration(true)
            {
                SuperSampleLevels = 2
            }),
                             GameFontType.Heading,
                             new Vector2(Width, Height)));

            // Large body font
            fontLibrary.AddFont(
                new GameFont(new QFont(largeBodyFontPath, 25, new QFontBuilderConfiguration()
            {
                SuperSampleLevels = 1
            }),
                             "largebody",
                             new Vector2(Width, Height)));

            // Version text font
            fontLibrary.AddFont(
                new GameFont(new QFont(versionFontPath, 15, new QFontBuilderConfiguration()),
                             "versiontext",
                             new Vector2(Width, Height)));

            // Selected text font (song browser
            fontLibrary.AddFont(
                new GameFont(new QFont(selectedFontPath, 34, new QFontBuilderConfiguration()
            {
                SuperSampleLevels = 2, Characters = CharacterSet.General
            }),
                             "selected",
                             new Vector2(Width, Height)));

            Console.WriteLine("Creating scene manager");
            _gameSceneManager = new SceneManager(this, gameCamera, fontLibrary, bodyFontPath, _directoryHandler, _gameSettings, DebugMode);
            _gameSceneManager.AddScene(new MenuScene(), null);

            Console.WriteLine("Checking for first run scene");
            if ((bool)ServiceLocator.Settings["FirstRun"])
            {
                _gameSceneManager.AddScene(new FirstRunScene(), null);
            }

            Console.WriteLine("Setting up input system callbacks");
            Keyboard.KeyDown   += (o, args) => InputSystem.KeyDown(args);
            Keyboard.KeyUp     += (o, args) => InputSystem.KeyUp(args);
            Mouse.ButtonDown   += (o, args) => InputSystem.MouseDown(args);
            Mouse.ButtonUp     += (o, args) => InputSystem.MouseUp(args);
            Mouse.WheelChanged += (o, args) => InputSystem.MouseWheelChanged(args);
            Mouse.Move         += (o, args) => InputSystem.MouseMoved(args);

            Console.WriteLine("Setting clear color");
            GL.ClearColor(Color.Black);

            Console.WriteLine("Creating stopwatch");
            _watch = new Stopwatch();

            Console.WriteLine("Finished OnLoad");
        }
예제 #24
0
 public void LoadFonts(FontLibrary pFontLibrary)
 {
     pFontLibrary.LoadFonts(this);
 }
예제 #25
0
 public float sceFontPointToPixelV(FontLibrary FontLibrary, float FontPointsV, int* ErrorCode)
 {
     *ErrorCode = 0;
     return FontPointsV * FontLibrary.VerticalResolution / PointDPI;
 }
예제 #26
0
 public int sceFontSetAltCharacterCode(FontLibrary FontLibrary, ushort CharCode)
 {
     FontLibrary.AlternateCharCode = CharCode;
     return 0;
 }
예제 #27
0
 public int sceFontSetResolution(FontLibrary FontLibrary, float HorizontalResolution, float VerticalResolution)
 {
     FontLibrary.HorizontalResolution = HorizontalResolution;
     FontLibrary.VerticalResolution = VerticalResolution;
     return 0;
 }
예제 #28
0
 public int sceFontFindOptimumFont(FontLibrary FontLibrary, FontStyle* FontStylePointer, uint* ErrorCode)
 {
     return sceFontFindFont(FontLibrary, FontStylePointer, ErrorCode);
 }
 public int sceFontGetNumFontList(FontLibrary FontLibrary, uint *ErrorCode)
 {
     *ErrorCode = 0;
     return(FontLibrary.FontRegistryList.Count);
 }
예제 #30
0
        public FontLibraryHandle sceFontNewLib(FontNewLibParams* Params, uint* errorCode)
        {
            //if (Params != null) throw (new NotImplementedException("(Params != null)"));

            var FontLibrary = new FontLibrary()
            {
                Params = *Params,
            };

            return (FontLibraryHandle)FontLibraries.Create(FontLibrary);
        }
예제 #31
0
 public UpgradeMenu()
 {
     myText = "Press J to upgrade your max health to 200 for 3 coins! \nPress K to upgrade your max speed for 5 coins! \nPress L to next level!";
     myFont = FontLibrary.GetFont("Font");
 }
예제 #32
0
 public Font sceFontOpenUserFile(FontLibrary FontLibrary, string FileName, int Mode, uint* ErrorCode)
 {
     var FontFileStream = HleIoManager.HleIoWrapper.Open(FileName, Vfs.HleIoFlags.Read, (Vfs.SceMode)Mode);
     var PGF = new PGF().Load(FontFileStream);
     var Font = new Font(FontLibrary, PGF);
     *ErrorCode = 0;
     return Font;
 }
예제 #33
0
 public float sceFontPointToPixelH(FontLibrary FontLibrary, float FontPointsH, int* ErrorCode)
 {
     *ErrorCode = 0;
     return FontPointsH * FontLibrary.HorizontalResolution / PointDPI;
 }
예제 #34
0
 public Font sceFontOpen(FontLibrary FontLibrary, int Index, int Mode, uint* ErrorCode)
 {
     var FontRegistry = FontLibrary.FontRegistryList[Index];
     try
     {
         var FontFileStream = HleIoManager.HleIoWrapper.Open("flash0:/font/" + FontRegistry.FontStyle.FileName, Vfs.HleIoFlags.Read, Vfs.SceMode.All);
         var PGF = new PGF().Load(FontFileStream);
         var Font = new Font(FontLibrary, PGF);
         *ErrorCode = 0;
         return Font;
     }
     catch (FileNotFoundException)
     {
         var Font = new Font(FontLibrary, new NativeFontIPGF());
         *ErrorCode = 0;
         return Font;
     }
 }
예제 #35
0
 public float sceFontPixelToPointV(FontLibrary FontLibrary, float FontPointsV, int* ErrorCode)
 {
     *ErrorCode = 0;
     return FontPointsV * PointDPI / FontLibrary.VerticalResolution;
 }
예제 #36
0
            //public FontInfo FontInfo;

            public Font(FontLibrary FontLibrary, IPgf PGF)
            {
                this.FontLibrary = FontLibrary;
                this.PGF         = PGF;
            }
예제 #37
0
 public int sceFontGetFontInfoByIndexNumber(FontLibrary FontLibrary, FontInfo* FontInfoPointer, int Unknown, int FontIndex)
 {
     throw (new NotImplementedException());
 }
예제 #38
0
 public int sceFontDoneLib(FontLibrary FontLibrary)
 {
     FontLibrary.RemoveUid(InjectContext);
     return 0;
 }
 public int sceFontGetFontInfoByIndexNumber(FontLibrary FontLibrary, FontInfo *FontInfoPointer, int Unknown,
                                            int FontIndex)
 {
     throw (new NotImplementedException());
 }
예제 #40
0
 //public FontInfo FontInfo;
 public Font(FontLibrary FontLibrary, IPGF PGF)
 {
     this.FontLibrary = FontLibrary;
     this.PGF = PGF;
 }
 public int sceFontSetAltCharacterCode(FontLibrary FontLibrary, ushort CharCode)
 {
     FontLibrary.AlternateCharCode = CharCode;
     return(0);
 }
예제 #42
0
        static PackedFont load_font(FontLibrary library, string path, LongForm form, uint alignment)
        {
            var face = new FontFace(form);

            FT_CHECK(face.NewFace(library, path, 0));

            FT_CHECK(face.SetCharSize(
                         form.FromInt32(0),
                         form.FromInt32(1000),
                         96,
                         96));

            uint total_points = 0;
            uint total_cells  = 0;


            var glyph_infos = new fd_HostGlyphInfo[NUMBER_OF_GLYPHS];


            var outlines = new fd_Outline[NUMBER_OF_GLYPHS];

            for (uint i = 0; i < NUMBER_OF_GLYPHS; i++)
            {
                char c = Convert.ToChar(Convert.ToInt32(' ') + i);
                Console.WriteLine("{0}", c);

                //fd_Outline o = r.outlines[i];
                //fd_HostGlyphInfo hgi = r.glyph_infos[i];

                var glyph_index = face.GetCharIndex(c);
                FT_CHECK(face.LoadGlyph(glyph_index, LoadFlags.NoHinting, LoadTarget.Default));

                var g = face.GetGlyph(c);
                outlines[i]    = g.Outline;
                glyph_infos[i] = new fd_HostGlyphInfo
                {
                    bbox    = outlines[i].bbox,
                    advance = g.Advance,
                };

                total_points += outlines[i].num_of_points;
                total_cells  += outlines[i].cell_count_x * outlines[i].cell_count_y;
            }

            uint glyph_info_size  = (UInt32)Marshal.SizeOf <fd_DeviceGlyphInfo>() * NUMBER_OF_GLYPHS;
            uint glyph_cells_size = sizeof(UInt32) * total_cells;

            var result = new PackedFont
            {
                no_of_glyphs      = NUMBER_OF_GLYPHS,
                glyph_infos       = glyph_infos,
                glyph_info_size   = glyph_info_size,
                glyph_cells_size  = glyph_cells_size,
                glyph_points_size = (UInt32)Marshal.SizeOf <Vector2>() * total_points,

                alignment           = alignment,
                glyph_info_offset   = 0U,
                glyph_cells_offset  = align_uint32(glyph_info_size, alignment),
                glyph_points_offset = align_uint32(glyph_info_size + glyph_cells_size, alignment),
            };

            // UInt32 alignment = r->device_properties.limits.minStorageBufferOffsetAlignment;
            result.glyph_data_size = align_uint32(result.glyph_points_offset + result.glyph_points_size, alignment);
            result.glyphData       = new byte[result.glyph_data_size];

            Span <byte> dstBuffer = result.glyphData;

            var dstGlyphInfo = MemoryMarshal.Cast <byte, fd_DeviceGlyphInfo>(
                dstBuffer.Slice((int)result.glyph_info_offset, (int)result.glyph_info_size)
                );
            var dstCells = MemoryMarshal.Cast <byte, uint>(
                dstBuffer.Slice((int)result.glyph_cells_offset, (int)result.glyph_cells_size)
                );
            var dstPoints = MemoryMarshal.Cast <byte, Vector2>(
                dstBuffer.Slice((int)result.glyph_points_offset, (int)result.glyph_points_size)
                );

            UInt32 point_offset = 0;
            UInt32 cell_offset  = 0;

            for (var i = 0; i < NUMBER_OF_GLYPHS; i++)
            {
                dstGlyphInfo[i] = new fd_DeviceGlyphInfo
                {
                    bbox      = outlines[i].bbox,
                    cell_info = new fd_CellInfo
                    {
                        cell_count_x = outlines[i].cell_count_x,
                        cell_count_y = outlines[i].cell_count_y,
                        point_offset = point_offset,
                        cell_offset  = cell_offset,
                    }
                };

                uint cell_count = outlines[i].cell_count_x * outlines[i].cell_count_y;
                // memcpy(dstCells + cell_offset, o->cells, sizeof(uint32_t) * cell_count);
                {
                    var         dst = dstCells.Slice((int)cell_offset, (int)cell_count);
                    Span <uint> src = outlines[i].cells;
                    src.CopyTo(dst);
                }

                // memcpy(dstPoints + point_offset, o->points, sizeof(vec2) * o->num_of_points);
                {
                    var num_of_points = (int)outlines[i].num_of_points;
                    var dst           = dstPoints.Slice((int)point_offset, num_of_points);
                    for (var j = 0; j < num_of_points; j += 1)
                    {
                        dst[j] = outlines[i].points[j];
                    }
                }

                point_offset += outlines[i].num_of_points;
                cell_offset  += cell_count;
            }

            Debug.Assert(point_offset == total_points);
            Debug.Assert(cell_offset == total_cells);

            for (uint i = 0; i < NUMBER_OF_GLYPHS; i++)
            {
                outlines[i].fd_outline_destroy();
            }

            FT_CHECK(face.DoneFace());

            return(result);
        }
 public int sceFontSetResolution(FontLibrary FontLibrary, float HorizontalResolution, float VerticalResolution)
 {
     FontLibrary.HorizontalResolution = HorizontalResolution;
     FontLibrary.VerticalResolution   = VerticalResolution;
     return(0);
 }
예제 #44
0
 public HealthUI() :
     base(null, new Rectangle())
 {
     myFont   = FontLibrary.GetFont("Font");
     myPlayer = Game1.myObjects.Where(x => x is Player).First() as Player;
 }
 public float sceFontPointToPixelH(FontLibrary FontLibrary, float FontPointsH, int *ErrorCode)
 {
     *ErrorCode = 0;
     return(FontPointsH * FontLibrary.HorizontalResolution / PointDPI);
 }
예제 #46
0
 /// <summary>
 /// Creates the default font from embedded program resources
 /// </summary>
 /// <returns>The Default font</returns>
 private static GameFont GetDefaultFont()
 {
     return(FontLibrary.LoadFontInternal(IOManager.GetStream(DefaultFontPath), 32, out string name));
 }
 public float sceFontPointToPixelV(FontLibrary FontLibrary, float FontPointsV, int *ErrorCode)
 {
     *ErrorCode = 0;
     return(FontPointsV * FontLibrary.VerticalResolution / PointDPI);
 }
예제 #48
0
 public MoneyUI() :
     base(null, new Rectangle())
 {
     myFont = FontLibrary.GetFont("Font");
 }
 public float sceFontPixelToPointH(FontLibrary FontLibrary, float FontPointsH, int *ErrorCode)
 {
     *ErrorCode = 0;
     return(FontPointsH * PointDPI / FontLibrary.HorizontalResolution);
 }