clrammer's Recent Forum Activity

  • I'm wondering if anyone else has been using the new official sprite font in their projects and noticed a significant difference in creation speed on iOS versus Android (via CocoonJS)?

    As an example, loading a layout that draws 40 words to the screen (each word being a separate instance of the sprite font) takes about 1.5 seconds on a Galaxy 2 10.1. The exact same operation takes 6 seconds on iPad 2. This is very surprising considering the iPad is faster than the Android tablet in pretty much every other way (even outside my app).

    Not surprisingly, the layout loads instantly on the PC.

    One more detail to include.. On CocoonJS 1.3, the creation speed was just as slow on the Galaxy tablet as it was on iPad. When 1.4 came out for Android, we saw a great improvement in sprite font creation speed and were excited to have iOS see the same improvement. Unfortunately, there was no change when we updated the iOS version to 1.4.

    I understand this may be a question for ludei, but I wanted to ask here as well.

    Thanks!

  • Would be awesome if I could set the Wrapping property to "none" for the new Sprite font object. Alternatively, (or additionally), it would be cool if the Character Width property as shown in the editor was actually called "Cell Width" and it could be referenced at runtime without having to specify a character in order to get width (the current character width implementation is useful as well, and I'm not suggesting it be removed).

    In a nutshell, I'm creating a drawText function of my own that I can use in all of my projects. What seems intuitive to me is to create the sprite font object, set the text, and then set the width of the object to Self.textWidth to keep things tidy. TextWidth returns the width of the wrapped text, not the width as if all characters were left to right, and I understand why this functionality makes sense. However, if I have a project where I never want text to wrap, it would be cool to be able to just set it at the object level and then TextWidth always returns the cumulative width of all characters.

    Now, assuming this is viewed as a low priority convenience request that can be worked around, I wanted to share a hurdle I encountered while trying to work around it :)

    When creating the sprite font object, I thought I could just set the width to len(string)*[cell width of the sf object]. This basically enforces the no-wrapping behavior, and then I can set text and trim down the width with TextWidth. However, it's not possible to grab the cell width at runtime, it is only possible to grab the width of a specific charater. My workaround to the workaround is to create an instance variable called cellWidth and set it manually when the object is created, using a hard coded value that I must remember to update if I ever change the sprite font image.

    Thanks for reading :)

  • Thanks for the replies!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well, that was embarrassing. Definitely should have tested outright before posting here. Setting it explicitly worked.

    What is interesting is that the method for setting it in a loop didn't work.

    What I've done is created a delimited global string in the following format:

    "a^39|b^39|c^39|d^41" etc. that includes all characters in my character set. The end of the above list is "Z^44| ^14" indicating that a "space" is 14 pixels wide.

    I loop through this string using tokenat on start of layout to set all character widths, but it doesn't seem to register the "space". If I use a manual line after the loop is over to explicitly set the width of space, things work fine.

    Anyway, thank you very much, Ashley, for adding this plugin officially. If you're still taking feature requests for it, could you add a property that allows for adjusting the pixel width of each character based on the character that follows it? I understand if this is a little too convoluted to be worth the time, but it really would allow for non-mono width fonts to be perfectly reproduced with Sprite font.

    To give an example of what I mean, take two strings, each two characters wide:

    aa

    ab

    In 48 point, Arial Rounded MT Bold font, the width of the first 'a' in "aa" is 38 pixels. The width of the 'a' in "ab" is 40 pixels. It turns out that regardless of what the first letter is, if the letter 'b' comes second, it ALWAYS results in the preceding character being 2 pixels wider than if an 'a' were to come second. So, what would be perfect is if I could set a baseline width per character and ALSO set a modifier for each character that says "add this amount to the width of the preceding character". The value could be negative, of course.

    For now, I've just averaged the width of each character and I'm hoping it will continue to test to make sure it looks ok. We're only talking about a few pixels. For what it's worth, the letter 'j' is kind of the outlier in how much it affects the width of whatever character precedes it. 'f' is the other culprit.

    Anyway, thanks again for the plugin. I can now determine the exact width of strings and I'm not dealing with blank text boxes as I tried to trim the whitespace from dynamically created and resized text boxes between Chrome and iPad... talk about maddening :)

  • I've been meticulously working on getting Arial Rounded MT Bold into the new Sprite font object, and I'm 95% there. I know it can't be perfect because this font has different character widths depending on the characters that FOLLOWS it, but I can still get it close enough to be acceptable with one exception... How can I define the width of the "space" character? I left room in the Sprite font image at the end, and I added a space to the end of the Character Set. I then adjusted the width of "space" in the same loop where I adjust all of my other characters, but space is ignored (i.e. it just uses the default Character width of the Sprite font object).

    I know this is a brand new feature and will be documented after the next stable release, but does anyone know right now if this can be done?

    Thanks!

  • I know this is over a year old now, but I wanted to say thank you for taking the time to write this up. Lots of very valuable information in here! Oh, and great work on those apps.

  • I am also very interested in the 1.4 update! Any news? I'm primarily looking forward to improved memory management which I read should be included - hopefully I read that right :)

    Btw, Ashley, thank you very much for the textbox workaround you included recently.

  • Thank you very much for these summaries. Very helpful.

  • Thanks for the reply, justifun. I may just take a crack at modeling this in C2 and see where I trip up. Then perhaps I will have better questions to ask.

    All I really need is a simple UI, the ability to track about 125 global variables (or perhaps leverage a database), and perform a large amount of conditional checks (If/Then) for each run of the program. The calculations themselves are very basic.

  • Hi all,

    I did a quick search on the forums before posting. Didn't see anything that specifically addressed my question.

    I've been a Scirra fan for about a year now, and looking for my first opportunity to leverage Construct 2 for an actual project. Turns out it's harder to design good games than I originally thought, so I'm thinking of leveraging some work I've already done in the past to get me started.

    The thing is, this work I have completed is not the kind of game others are using Construct 2 to make. In fact, it's not really a game, it's a simulation of a casino game. I'm not even looking for flashy graphics or animations (although adding them later could be neat), I just need input boxes and formatted output and a whole bunch of calculations to happen on the back end.

    Currently, the simulation is written in VBA (Excel is the front end), and I would like to convert it to HTML5 so it is in a universal format that I can either publish or convert to mobile app or desktop app. Also, I want to roll up my sleeves and get a project under my belt with Construct 2.

    Am I on the right track by using Construct 2 to accomplish this, or am I trying to fit a square peg in a round hole? Also, I'm a pretty noob programmer at the moment (hence the VBA), so I like the idea of using Contruct 2 for this.

    Thanks for any input you can offer!

clrammer's avatar

clrammer

Member since 22 Apr, 2012

None one is following clrammer yet!

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies