Löve Frames - A GUI Library

Showcase your libraries, tools and other projects that help your fellow love users.
pirogronian
Prole
Posts: 17
Joined: Sun Jun 30, 2019 5:38 pm

Re: Löve Frames - A GUI Library

Post by pirogronian »

Bug report: Colored text doesnt work (as already posted at https://github.com/linux-man/LoveFrames/issues/2). Quick reproduce: (following wiki):

Code: Select all

local text = {{255, 0, 0, 255}, "Red ", {0, 255, 0, 255}, "Green ", {0, 0, 255, 255}, "Blue"}
object:SetText(text)
Resulted text is grey (with default skin).

Edit: Following updated documentation solved the problem (code which works:

Code: Select all

local text = {{color = {1, 0, 0}}, "Red ", {color = {0, 1, 0}}, "Green ", {color = {0, 0, 1}}, "Blue"}
).
AlexYeCu
Citizen
Posts: 53
Joined: Fri May 30, 2014 4:08 pm

Re: Löve Frames - A GUI Library

Post by AlexYeCu »

Bug report:

Code: Select all

       	--font = love.graphics.newFont("fonts/Neocyr.ttf", 16); -- bug is presented  for both fonts
	font = love.graphics.newFont("fonts/DroidSans.ttf", 16);

Code: Select all

	global.buttons.start_button = loveframes.Create("imagebutton");
	global.buttons.start_button:SetImage(media.images.button_quickstart);
	global.buttons.start_button:SetPos(_x_position, _y_position_initial);
	global.buttons.start_button:SizeToImage();
	global.buttons.start_button:SetText(utilits.Translate("buttons", "quickstart"));
	global.buttons.start_button.OnClick = function(object)
		mainmenuState.startGame ();
	end;

Code: Select all

        quickstart = {english = "Quick Start", russian = "Быстрый старт"},
In version version 0.10 this works fine. Only image buttons are affected, textfields are ok.

Another bug report:

Code: Select all

Error: lib/loveframes/objects/text.lua:285: UTF-8 decoding error: Not enough space

Code: Select all

	endurance = {english = "endurance", russian = "выносливость"},
	speed = {english = "speed", russian = "скорость"},
	dexterity = {english = "dexterity", russian = "ловкость"},
	flexibility = {english = "flexibility", russian = "гибкость"},
	sensory = {english = "sensory", russian = "чувствительность"},
	concentration = {english = "concentration", russian = "сосредоточенность"},
Last two strings shows the error.

One more words calling the same error: "обезвреживание".
Last edited by AlexYeCu on Wed Apr 22, 2020 8:18 am, edited 1 time in total.
AlexYeCu
Citizen
Posts: 53
Joined: Fri May 30, 2014 4:08 pm

Re: Löve Frames - A GUI Library

Post by AlexYeCu »

Hmm, about the «another bug»: looks like the text file was without Unicode BOM, so…
It has fixed one error, but not all.

On more bug: image buttons, created like this:

Code: Select all

				local btn = loveframes.Create("imagebutton");
				btn:SetImage(media.images.button_minus);
				btn:SetPos(x + 200 + (index - 1) * createpartyState.columnMultiplier, createpartyState.height + 120 + _counter2 * 20);
				btn:SizeToImage();
				btn:SetText("");
				btn.OnClick = function(object)
					global.party[index]:StatAddAtCreationMinus (key2, 1, 5);
					createpartyState.renew ();
				end;
can not be pressed.
linux-man
Citizen
Posts: 67
Joined: Thu Apr 28, 2011 4:51 pm

Re: Löve Frames - A GUI Library

Post by linux-man »

Hi! Can you create a small app that shows the bugs?
AlexYeCu
Citizen
Posts: 53
Joined: Fri May 30, 2014 4:08 pm

Re: Löve Frames - A GUI Library

Post by AlexYeCu »

linux-man wrote: Sun Apr 26, 2020 2:28 pm Hi! Can you create a small app that shows the bugs?
Well, main.lua for the bug with image buttons and unreadable text:

Code: Select all

loveframes = require "lib.loveframes"

love.keyboard.setKeyRepeat(true);

function love.load()

	local image2 = love.graphics.newImage( "button.pkm" )

	button = loveframes.Create("imagebutton");
	button:SetImage(image2);
	button:SetPos(300, 100);
	button:SizeToImage();
	button:SetText("СТАРТ"); -- Russian language
	button.OnClick = function(object)
		
	end;
end;

function love.update(dt)
	loveframes.update(dt);
end;

function love.mousepressed(x,y,button)
  loveframes.mousepressed(x, y, button);
end;

function love.mousereleased(x,y,button)
  loveframes.mousereleased(x, y, button);
end

function love.draw()
	loveframes.draw();
end;
See the comment "Russian language"? In earlier versions of loveframes it works fine.
Last edited by AlexYeCu on Mon Apr 27, 2020 5:30 pm, edited 2 times in total.
AlexYeCu
Citizen
Posts: 53
Joined: Fri May 30, 2014 4:08 pm

Re: Löve Frames - A GUI Library

Post by AlexYeCu »

linux-man wrote: Sun Apr 26, 2020 2:28 pm Hi! Can you create a small app that shows the bugs?
Small textfield + long russian word causes this error:

Code: Select all

Error: lib/loveframes/objects/text.lua:285: UTF-8 decoding error: Not enough space

Code: Select all

loveframes = require "lib.loveframes"

love.keyboard.setKeyRepeat(true);

function love.load()
	local back = loveframes.Create("image");
	local image = love.graphics.newImage( "background.dds" )
	
	back:SetImage(image);
	back:SetPos (0, 0)

	font = love.graphics.newFont("DroidSans.ttf", 16);
	local textfield = loveframes.Create("text");
	textfield:SetPos(120, 120);
	textfield:SetWidth(50); -- small text field
	textfield:SetFont(font);
	local text = "обезвреживание"; --russian text
	textfield:SetText(text);
end;

function love.update(dt)
	loveframes.update(dt);
end;

function love.keypressed(key)
  loveframes.keypressed(button,true);
end

function love.keyreleased(key)
  loveframes.keyreleased(button,true);
end

function love.mousepressed(x,y,button)
  loveframes.mousepressed(x, y, button);
end

function love.mousereleased(x,y,button)
  loveframes.mousereleased(x, y, button);
end

function love.mousemooved(x,y,dx,dy)
end

function love.wheelmoved( x, y )
end;

function love.textinput(text)
   loveframes.textinput(text);
end;

function love.draw()
	loveframes.draw();
end;
AlexYeCu
Citizen
Posts: 53
Joined: Fri May 30, 2014 4:08 pm

Re: Löve Frames - A GUI Library

Post by AlexYeCu »

linux-man wrote: Sun Apr 26, 2020 2:28 pm Hi! Can you create a small app that shows the bugs?
Unpressing. Well, in latest version of loveframes tooltip can block the button. Take an image 20x20 size fir this code and you'll not be able to press the button.

Code: Select all

loveframes = require "lib.loveframes"
require 'functions.utilits';
require 'lang.translation'

if jit then
   jit.on();
else
	print ("No luajit detected!")
end

love.keyboard.setKeyRepeat(true);

function love.load()
	local back = loveframes.Create("image");
	local image = love.graphics.newImage( "background.dds" )
	
	back:SetImage(image);
	back:SetPos (0, 0)
		font = love.graphics.newFont("DroidSans.ttf", 16);
		local textfield = loveframes.Create("text");
		textfield:SetPos(120, 120);
		textfield:SetWidth(200);
		textfield:SetFont(font);
		textfield:SetText("обезвреживание");
		
		local tooltip = loveframes.Create("tooltip");
		tooltip:SetObject(textfield);
		tooltip:SetPadding(10);
		tooltip:SetFont(font);
		tooltip:SetOffsetX(-100);
		tooltip:SetText("fhzfgklzsvk;fbjjh;kb'dbmkhnskvhAKCPdvl;fgoerui p[dfkfajkepfi[flpawe[fkaopwefawk[k");
		
		local image2 = love.graphics.newImage( "button.pkm" )
		button = loveframes.Create("imagebutton");
		button:SetImage(image2);
		button:SetPos(160, 120);
		button:SizeToImage();
		button:SetText(""); -- Russian language
		button.OnClick = function(object)

		end;
end;

function love.update(dt)
	loveframes.update(dt);
end;

function love.keypressed(key)
  loveframes.keypressed(button,true);
end

function love.keyreleased(key)
  loveframes.keyreleased(button,true);
end

function love.mousepressed(x,y,button)
  loveframes.mousepressed(x, y, button);
end

function love.mousereleased(x,y,button)
  loveframes.mousereleased(x, y, button);
end

function love.mousemooved(x,y,dx,dy)
end

function love.wheelmoved( x, y )
end;

function love.textinput(text)
   loveframes.textinput(text);
end;

function love.draw()
	loveframes.draw();
end;
There is a draw function in old tooltip.lua which is not presented in new one. And it calls SetDrawOrder function. May be this is the root of the problem?
linux-man
Citizen
Posts: 67
Joined: Thu Apr 28, 2011 4:51 pm

Re: Löve Frames - A GUI Library

Post by linux-man »

Thank you for your help.
The first 2 issues are probably solved. The text was unreadable because the default Sans Serif font don't support cyrillic chars, as you can see with a simple graphics.text().
The real problem was that you couldn't change loveframes font without editing themes, so I normalized the 2 sets of themes (from Nicolai and ingsoc451) to use the same font tables and published them. Now you can define the font loveframes is using without changing theme.

Code: Select all

-- Change fonts on active skin
	loveframes.GetActiveSkin().controls.smallfont = love.graphics.newFont( "Arial.ttf", 10)
	loveframes.GetActiveSkin().controls.imagebuttonfont = love.graphics.newFont( "Arial.ttf", 15)

-- Change fonts on all registered skins
	for _, skin in pairs(loveframes.skins) do
		skin.controls.smallfont = love.graphics.newFont( "Arial.ttf", 10)
		skin.controls.imagebuttonfont = love.graphics.newFont( "Arial.ttf", 15)
	end
I tried to solve the second issue doing an extreme conversion to utf8 library (was already there, but only used sometimes). Now almost all :len, :sub, :gsub and :char are using utf8 versions. I suspect this change can break something, so please throw everything you can to test it.

I'll look at tooltip tomorrow.
Attachments
unicode.love
(320.61 KiB) Downloaded 276 times
AlexYeCu
Citizen
Posts: 53
Joined: Fri May 30, 2014 4:08 pm

Re: Löve Frames - A GUI Library

Post by AlexYeCu »

The real problem was that you couldn't change loveframes
Hm, I thought that font is wrong, but haven't check this… Guess this issue appeared after removing SetActiveSkin from the project…
so please throw everything you can to test it
Test how? I mean I'll see an error of course, and I can try different textfield sizes and words, but may be something else can help to find and fix the problem?
linux-man
Citizen
Posts: 67
Joined: Thu Apr 28, 2011 4:51 pm

Re: Löve Frames - A GUI Library

Post by linux-man »

That's ok. I only appreciate your feedback. As I suspected, textinput is broken with this changes (cursor movement). I might have to rollback some.
Post Reply

Who is online

Users browsing this forum: No registered users and 49 guests