Author Topic: displayText  (Read 2018 times)

dave_h

  • Wizard
  • *****
  • Posts: 185
    • View Profile
displayText
« on: August 20, 2015, 11:36:22 PM »
This function here does not do the correct size of the font? It picks up the style fine and displays the text but is very small.

Code: [Select]
self.game.displayText(['Lets','GO'],None,font_key='EDLarge',font_style=self.game.fontstyles['redYellow'],opaque=True)
This one however works:

Code: [Select]
self.layer = self.game.generateLayer(['Lets','GO'],None,self.game.fontstyles['redYellow'],font_key='EDLarge',opaque=True)
Bug or doing it wrong?

MOcean

  • Moderator
  • ****
  • Posts: 822
  • Michael Ocean
    • View Profile
Re: displayText
« Reply #1 on: August 21, 2015, 12:02:49 AM »
Do you mean it's displaying the wrong size of the font or the placement is incorrect?


dave_h

  • Wizard
  • *****
  • Posts: 185
    • View Profile
Re: displayText
« Reply #2 on: August 21, 2015, 12:10:31 AM »
Yeah the size is wrong, I'd say it's at whatever the default is for displayText. The message list placement is correct.

With the generate layer it's using all the same fonts & style and displays how it should.

Code: [Select]
  HDFonts:
  - key: 'EDLarge'
    file: 'EVILDEAD.ttf'
    size: 62

MOcean

  • Moderator
  • ****
  • Posts: 822
  • Michael Ocean
    • View Profile
Re: displayText
« Reply #3 on: August 21, 2015, 12:32:55 AM »
Since the key also defines the size, it's really weird that you're seeing the right font but at the wrong size.

If you pass it no font key, it uses the one tagged "med" in the asset_list.

Are you sure there isn't more than one entry in the asset_list with the same key? Sorry for the absurd suggestion but I'm just trying to thing if /something/ here...

dave_h

  • Wizard
  • *****
  • Posts: 185
    • View Profile
Re: displayText
« Reply #4 on: August 21, 2015, 12:43:58 AM »
Don't worry. No, it's just one key in yaml. Doesn't matter which font you use or what size it's specified at, it's always using the 'med'.

I did notice this the other day but never mentioned it and carried on just using generateLayer.

dave_h

  • Wizard
  • *****
  • Posts: 185
    • View Profile
Re: displayText
« Reply #5 on: August 21, 2015, 12:46:30 AM »
I don't even think it's picking up the correct font, sorry, just using default but only the style and message is picked up.

dave_h

  • Wizard
  • *****
  • Posts: 185
    • View Profile
Re: displayText
« Reply #6 on: September 07, 2015, 08:57:05 PM »
Ok, think I got it now. I uploaded the changes.

Inside the sample games assetlist.yaml FontStyles: is set twice, so that was blocking it?

I haven't tested displayText but I'd imagine it works now as I've had to edit the attract.py for applying the 'fontstyles' to the high scores.

dave_h

  • Wizard
  • *****
  • Posts: 185
    • View Profile
Re: displayText
« Reply #7 on: September 07, 2015, 08:58:58 PM »
Hah this thread was about the size  :o

Oh well the styles are fixed now, yet to test the size again, I just haven't used the displaytext for a while now because of it.

MOcean

  • Moderator
  • ****
  • Posts: 822
  • Michael Ocean
    • View Profile
Re: displayText
« Reply #8 on: September 09, 2015, 06:38:05 PM »
Wait. I'm totally confused now :)

Is it working or broken?

Thanks
- Michael

dave_h

  • Wizard
  • *****
  • Posts: 185
    • View Profile
Re: displayText
« Reply #9 on: September 17, 2015, 05:02:55 PM »
Sorry, only just caught your reply.

This should do the same your end too. Go into your sample game and add in the test target:

Code: [Select]
self.game.displayText("YOU did GOOD",font_key=self.game.fonts['score_activeM'])
You will see it's using the medium sized font?




MOcean

  • Moderator
  • ****
  • Posts: 822
  • Michael Ocean
    • View Profile
Re: displayText
« Reply #10 on: September 20, 2015, 09:57:25 AM »
Fixed and update pushed to GitHub.  Thanks for spotting this.

I've also added the ability to have GroupedLayer contain 'None' as a layer in its contents (and skips such layers).

Sorry, only just caught your reply.

This should do the same your end too. Go into your sample game and add in the test target:

Code: [Select]
self.game.displayText("YOU did GOOD",font_key=self.game.fonts['score_activeM'])
You will see it's using the medium sized font?

dave_h

  • Wizard
  • *****
  • Posts: 185
    • View Profile
Re: displayText
« Reply #11 on: September 23, 2015, 10:10:09 AM »
Wow that easy :) Didn't even look properly, could've done that for you!

Another thing that I suppose fits in this thread would be using the markdown. I've tried adding this to a  scriptless layer and it doesn't like it at all. Can't remember the exact problem but I ended up using an image and the panning layer scrolling up and adding to attract.

genLayerFromYaml = dmdhelper

Code: [Select]
        elif ('Credits' in yamlStruct):
            v = yamlStruct['Credits']
            groupList = []
            panningLayer = dmd.PanningLayer (self.game.dmd.width,self.game.dmd.height,self.game.animations[value_for_key(v,'Image')],origin=(0, 0),translate=(0, 5), bounce=False)
            groupList.append(self.game.animations[value_for_key(v,'Animation')])
            groupList.append(panningLayer)
            lyrTmp = dmd.GroupedLayer(self.game.dmd.width,self.game.dmd.height,groupList)
            lyrTmp.reset()
            duration = value_for_key(v,'duration')

Code: [Select]
    - Credits:
        Image: bitmap
        Animation: Piano
        lampshow: leftRight
        sound: PianoTune
        duration: 48.0