- ComputerCraft | Programmable Computers for Minecraft
- → Vilsol's Content
Vilsol's Content
There have been 3 items by Vilsol (Search limited from 29-March 23)
#230802 [1.74] Major Window API Bug
Posted by Vilsol on 21 August 2015 - 07:37 PM in Bugs
Hello. I looked all around the forums and I couldn't find anyone creating a topic about this, so here it goes.
Here is a GIF of it in action. This is the program that is available on the wiki: http://www.computerc...ndow.reposition
As you can see, there is a really weird bug where the window size is drawn sometimes larger and sometimes smaller than it actually is.
I ran another test, and really, it draws it larger than it actually is. Here is a GIF of where I iterate from 1 to 20 and set it as the width of the window, then loop over the width of the window and color each column in a different color. As you can see, it draws the box exactly twice minus one as wide as I set it.
Looking at the Window API source, I figured it is because each time the window is re-positioned, the contents of it are multiplied, not just added a blank space.
Here are the lines 402 to 404 in the source:
Here is what they should be
If they are changed, this is the result:
The same DOES NOT apply to the height, as that is calculated differently from the width.
I really hope this is fixed in the future versions.
Here is a GIF of it in action. This is the program that is available on the wiki: http://www.computerc...ndow.reposition
As you can see, there is a really weird bug where the window size is drawn sometimes larger and sometimes smaller than it actually is.
I ran another test, and really, it draws it larger than it actually is. Here is a GIF of where I iterate from 1 to 20 and set it as the width of the window, then loop over the width of the window and color each column in a different color. As you can see, it draws the box exactly twice minus one as wide as I set it.
Looking at the Window API source, I figured it is because each time the window is re-positioned, the contents of it are multiplied, not just added a blank space.
Here are the lines 402 to 404 in the source:
text = tOldLine.text .. string_sub( sEmptyText, 1, nWidth + 1, nNewWidth ), textColor = tOldLine.textColor .. string_sub( sEmptyTextColor, 1, nWidth + 1, nNewWidth ), backgroundColor = tOldLine.backgroundColor .. string_sub( sEmptyBackgroundColor, 1, nWidth + 1, nNewWidth ),
Here is what they should be
text = tOldLine.text .. string_sub( sEmptyText, 1, nNewWidth - (nWidth + 1)), textColor = tOldLine.textColor .. string_sub( sEmptyTextColor, 1, nNewWidth - (nWidth + 1)), backgroundColor = tOldLine.backgroundColor .. string_sub( sEmptyBackgroundColor, 1, nNewWidth - (nWidth + 1)),
If they are changed, this is the result:
The same DOES NOT apply to the height, as that is calculated differently from the width.
I really hope this is fixed in the future versions.
- ComputerCraft | Programmable Computers for Minecraft
- → Vilsol's Content