Lemma Soft Forums

Supporting creators of visual novels and story-based games since 2003.


Visit our new games list, blog aggregator, IRC channel, and Discord (new).
Activation problem? Email pytom@bishoujo.us.
It is currently Sun Mar 26, 2017 1:22 am

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Wed Feb 15, 2017 7:37 pm 
Newbie

Joined: Sat Sep 24, 2016 4:49 pm
Posts: 9
Hey all,

Ran into a little gotcha today, the title says it all - The "area" property of text in a screen won't respect the width and height provided unless the numbers are integers.

Does not work ( text will not wrap ):
text "Test" area (0, 0, 100.0, 100.0)

Does work ( text wraps ):
text "Test" area (0, 0, int(100.0), int(100.0))

Might be a nice to have fix by casting the width/height into ints by default in the text display code.


Top
 Profile Send private message  
 
PostPosted: Thu Feb 16, 2017 12:18 am 
Veteran
User avatar

Joined: Sun Jun 05, 2016 8:29 pm
Posts: 345
Projects: The Falconers: Moonlight
Organization: Bionic Penguin
itch.io: bionicpenguin
"area" always take tuple of integer values, as stated in the documentation.

Is there a reason why width and height has to be in float? There is no such thing as half a pixel in image resolution.

_________________
Work in Progress:
Image


Top
 Profile Send private message  
 
PostPosted: Mon Feb 20, 2017 6:49 pm 
Newbie

Joined: Sat Sep 24, 2016 4:49 pm
Posts: 9
Nope! No reason, just that its an invisible failure if you do end up using floats which might happen as a result of division if you're placing elements on screen programmatically rather than using exact coordinates. Its good that its in the documentation, but in absence of the documentation there's no clear indicator of whats going on and can potentially frustrate and waste time for developers. Its a small thing but I thought I'd point it out.


Top
 Profile Send private message  
 
PostPosted: Mon Feb 20, 2017 7:02 pm 
Veteran
User avatar

Joined: Mon Dec 14, 2015 5:05 am
Posts: 319
Location: Your monitor
Divona wrote:
There is no such thing as half a pixel in image resolution.


Ren'Py doesn't use subpixels?
https://en.wikipedia.org/wiki/Sub-pixel_resolution

_________________
Need some free sound effects for your game?
viewtopic.php?f=48&t=42167


Top
 Profile Send private message  
 
PostPosted: Mon Feb 20, 2017 7:32 pm 
Veteran
User avatar

Joined: Mon Jan 26, 2009 7:21 pm
Posts: 354
The reason of that is that you already have "programmatical" size for containers.
Dividing a number by a number is not programmatical, is fixed math. You already knows all the values.

So, wanna divide the screen 3 part? Grid or hbox.
Wanna divide 1280 by 7? You end with floats. A no no in pixel.

@Imperf3kt: subpixeling is a way of rendering objects taking into account the difference into real size and screen resolution. It doesn't allow you to move something by "half pixel". It move by one, then the blit area get calculated in relation to the item size and screen resolution ("blurring" or averaging the edges of the item and faking your eyes)

_________________
10 ? "RENPY"
20 GOTO 10

RUN


Top
 Profile Send private message  
 
PostPosted: Mon Feb 20, 2017 8:09 pm 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 14561
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Twitter: @renpytom
Github: renpytom
itch.io: renpytom
Ren'Py tends to use floats to indicate "fraction of the available area". So when you give area (0, 0, 100.0, 100.0), you're really requesting 100x the space available.

Part of that was we didn't support subpixels back then. We actually do support subpixel now - Ren'Py is happy to put things on a pixel boundary. You have to cast to a special type called absolute, but pos (absolute(100.5), absolute(100.5)) will work fine.

_________________
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Code > Drama


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Protected by Anti-Spam ACP
Powered by phpBB® Forum Software © phpBB Group