Galv's Menu Themes Engine 1.6 (text alignment fix)

Parallax Panda

Got into VxAce ~2014 and never stopped...
Veteran
Joined
Oct 29, 2015
Messages
1,064
Reaction score
1,326
First Language
Swedish
Primarily Uses
RMVXA
Hello,

I'm using this script here by Galv but have encountered a small problem with text alignment when I changed the font:
https://galvs-scripts.com/galvs-menu-themes-engine/

What happened is that when I changed the display font (inside the script) from Arial, which is a monospaced font, to a new non-monospaced font a problem reveled itself.
Basically, since the font is not properly aligned to the left or right (I assume it centers itself) it jumps around a few pixels while displaying symbols with different sizes. This affects everything but is most visible in the lower right corner where the playtime is displayed. Since that clock is always ticking it is really noticeable when the text jumps around and I'd like it to be fixed. I also wouldn't mind the same fix for the gold and location text, even if the problem is not as obvious.

Truth is I've had the same problem with Moghunters "Monogatari menu" plugin for MV, and the solution was to simply specify the text to be aligned to the left (or maybe it was to the right, I can't remember which one worked). I'm sure that's an easy enough fix for someone who understands RGSS3 but I'm afraid I don't so I'd like to request some help here.

I don't mind editing the script myself if someone could tell me what to type, and on what line.

I'd really appreciate it.
 

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
67
Reaction score
12
First Language
português
Primarily Uses
RMVXA
can you upload a game demo with this script + whatever font you're using?
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,658
Reaction score
563
First Language
English
Primarily Uses
RMVXA
upload a game demo
That's pretty easy. Just use the theme demo and add in a font.
I've done this easily and I can see the issue, but no idea how to correct it.
The game time moves because the characters that are drawn are not all the same size (I think).
Here is the demo with a font I use that shows it.
Watch the timer in the menu count from 09 to 11
 
Last edited:

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
67
Reaction score
12
First Language
português
Primarily Uses
RMVXA
thanks. I just don't want to set up demos when the OP could've done it in the first post hahahaha

For the playtime, you could set the text alignment to 0 and set different coords so it's at the bottom right again. at line 712, do something like
Code:
  def draw_playtime
    draw_text(400,ty,Graphics.width - 20,line_height,time_text,0)
  end
The only disadvantage is that if the player reaches a really long playtime and you want to keep the playtime on the lower right, the text might get cut off.

same script editing idea would apply to drawing the currency and area text

EDIT: @Parallax Panda I'd ask that you try to code it yourself first, but if you can't do it i'm willing to code a small patch fix
 
Last edited:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,658
Reaction score
563
First Language
English
Primarily Uses
RMVXA
After an hour reading up on Sprintf and trying options, the only way I found to make it seriously not move was to break it up.
Draw_text hour
Draw_text minute
Draw_text second

Ruby:
class Window_GameInfo < Window_Base
  def draw_playtime
    draw_text(Graphics.width - 125,ty,40,line_height,time_hour,0)
    draw_text(Graphics.width - 95,ty,10,line_height,":",0)
    draw_text(Graphics.width - 85,ty,40,line_height,time_minit,0)
    draw_text(Graphics.width - 55,ty,10,line_height,":",0)
    draw_text(Graphics.width - 45,ty,40,line_height,time_secon,0)
  end

  def time_hour
    hour = sprintf("%02d", (Graphics.frame_count / 60**2) / 60)
    time = "#{hour}".center(2)
    return time
  end

  def time_minit
    minit = sprintf("%02d", Graphics.frame_count / 60**2 % 60)
    time = "#{minit}".center(2)
    return time
  end

  def time_secon
    secon = sprintf("%02d", Graphics.frame_count / 60 % 60)
    time = "#{secon}".center(2)
    return time
  end
end
The center might not be needed, but that's where I left off with it working.
 

Parallax Panda

Got into VxAce ~2014 and never stopped...
Veteran
Joined
Oct 29, 2015
Messages
1,064
Reaction score
1,326
First Language
Swedish
Primarily Uses
RMVXA
Thanks for the replies (and for uploading a demo). I'm at little late to the party but to clarify, we're replacing the code on line 712 and 713 in Galv's script, correct?

The original code snippet is this:

Ruby:
  def draw_playtime
    draw_text(tx,ty,Graphics.width - 20,line_height,time_text,2)
I don't have a clue how to read or write Ruby or RGSS3 to be honest, so even simple syntax like how to align text is beyond me. So let me ask, in the above code snippet, is that "2" that's written at the end the alignment? is "0" center, "1" left and "2" right? I'm wildly guessing here.

Besides that, I'm presented with two solutions (one from each one of you) which is great. But as a non-coder I'm not sure which one would be best?
 

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
67
Reaction score
12
First Language
português
Primarily Uses
RMVXA
yea. 0 = left, 1 = center, 2 = right. (works only for draw_text)
but yes, both scripts lead to the same basic result, but look slightly different. depends on what you want for your game
roninator2's script:
1603954797292.png (spaced out)
my code edit:
1603954847843.png (same look)
 

Parallax Panda

Got into VxAce ~2014 and never stopped...
Veteran
Joined
Oct 29, 2015
Messages
1,064
Reaction score
1,326
First Language
Swedish
Primarily Uses
RMVXA
Thank you, very informative. I'll test both and see which ones would work the best.

As for how large numbers will make the playtime expand outside of the window/be cut off, are we alking something like 10.000+ hours? Or like...50 hours?
 

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
67
Reaction score
12
First Language
português
Primarily Uses
RMVXA
Thank you, very informative. I'll test both and see which ones would work the best.

As for how large numbers will make the playtime expand outside of the window/be cut off, are we alking something like 10.000+ hours? Or like...50 hours?
depends on the font size, but if you keep it to the right, probably 3+ digit hour counts. if it's on the left, you wouldn't have to worry about that unless you use 1 or 2 (center or right) text alignments
 

Parallax Panda

Got into VxAce ~2014 and never stopped...
Veteran
Joined
Oct 29, 2015
Messages
1,064
Reaction score
1,326
First Language
Swedish
Primarily Uses
RMVXA
Alright. Well, if it can at least go up to 999 hours then I wouldn't consider it to be a problem for 99.9% of the players. I'll experiment and try aligning the text both to the left and right though.

Thank you both for all the help. Really appreciate it.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,658
Reaction score
563
First Language
English
Primarily Uses
RMVXA
The numbers can be adjusted to make it closer as well.
1604008186912.png
Ruby:
class Window_GameInfo < Window_Base
  def draw_playtime
    draw_text(Graphics.width - 105,ty,40,line_height,time_hour,0)
    draw_text(Graphics.width - 80,ty,10,line_height,":",0)
    draw_text(Graphics.width - 75,ty,40,line_height,time_minit,0)
    draw_text(Graphics.width - 50,ty,10,line_height,":",0)
    draw_text(Graphics.width - 45,ty,40,line_height,time_secon,0)
  end

  def time_hour
    hour = sprintf("%02d", (Graphics.frame_count / 60**2) / 60)
    time = "#{hour}"
    return time
  end

  def time_minit
    minit = sprintf("%02d", Graphics.frame_count / 60**2 % 60)
    time = "#{minit}"
    return time
  end

  def time_secon
    secon = sprintf("%02d", Graphics.frame_count / 60 % 60)
    time = "#{secon}"
    return time
  end
end
 

Parallax Panda

Got into VxAce ~2014 and never stopped...
Veteran
Joined
Oct 29, 2015
Messages
1,064
Reaction score
1,326
First Language
Swedish
Primarily Uses
RMVXA
Alright, finally got the time to properly test it out and I got it to work, so thank you both very much for the help :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Having randomized space below my maps is like cheating, every map instantly starts out interesting. See? I just started on this one, and boom interesting!. :LZSexcite:

Moderators, you must have so much patience to be able to deal with everything. I mod in a server of sorts and today we just got a message, which, despite it's helpful constructive criticism, basically stated that all of the mods were jerks and that was the only reason our server was unlikeable. So, thank you, for having patience. You are appreciated! :kaoluv:
Haired slime? Trying some different styles of art. Maybe I can make some resources with this new kind of painting.......
i love my game very much
Uh, I'm probably overthinking this, but I think that some of my music sounds kinda...bad?
The melodies are just sort of awkward, and don't flow.
I'm really not sure what to do. Why am I even worrying about this? I don't even have a battle system yet!

Forum statistics

Threads
105,727
Messages
1,015,935
Members
137,410
Latest member
judicasino88
Top