You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Impossible to make multiple instances of ig.Font that share common image path #68
Say, for example, you wanted to create two instances of ig.Font, both which share the same image: 'media/04b03.font.png'
MyGame=ig.Game.extend({font1: newig.Font('media/04b03.font.png'),font2: newig.Font('media/04b03.font.png'),draw: function(){this.parent();varx=ig.system.width/2,y=ig.system.height/2;this.font1.draw('It Works 1!',x,y,ig.Font.ALIGN.CENTER);this.font2.draw('It Works 2!',x,y+10,ig.Font.ALIGN.CENTER);}});
Then let's say you want to modify the letter spacing of one, but not the other...
It's not possible. Modifying one font instance, modifies the other, because they are the same instance. You can't have more instances, due to the way ig.Image caching works.
This works great for images, but not necessarily for fonts.
Perhaps it would make sense for ig.Font to be its own class, and simply have an image property which it reads from, instead of extending from ig.Image.
changed the title [-]Impossible to make multiple instances of ig.Font sharing common image path[/-][+]Impossible to make multiple instances of ig.Font that share common image path[/+]on Sep 14, 2019
Activity
[-]Impossible to make multiple instances of ig.Font sharing common image path[/-][+]Impossible to make multiple instances of ig.Font that share common image path[/+]