Page 9 of 15
Re: [WIP] GrimTK GUI Framework
Posted: Wed Mar 04, 2015 1:43 am
by Slade
Now i dont understand..hmm the test dungeon works and when i do all the same things in my dungeon it wont work? Any ideas what im doing wrong? Sorry for these noob questions, im just frustrated sometimes
Re: [WIP] GrimTK GUI Framework
Posted: Fri Mar 06, 2015 9:12 pm
by Drakkan
just to let you know - GUI is curently bugged, if you save / load game, GUI got freezed. I am sure John will track this problem down soon
btw small request for next version, in case not implemented yet - if GUI is started it will disable AI brains (which makes monster stop attacking you), this was added in last patch.
Re: [WIP] GrimTK GUI Framework
Posted: Fri Mar 06, 2015 10:17 pm
by JohnWordsworth
I will track down and resolve the issue this weekend. This is why the toolkit is still in alpha
.
As for freezing brains. That's a good idea - I'll just add it as an option "freezeMonsters" for gui windows (and make it a dialogue option too) so that users can decide whether they want that functionality in their own mods or not.
Re: [WIP] GrimTK GUI Framework
Posted: Sat Mar 07, 2015 1:39 am
by JKos
Hi,
I had a pretty hard time trying to figure out how the item atlas works after index number 169 and noticed that you have the same problem in your framework. So to save your time and nerves, here is a working grawItem function:
Code: Select all
function drawItem(g,item,x,y,pAttack)
local index = item:getGfxIndex()
if pAttack then
index = item:getGfxIndexPowerAttack()
end
--image indexes in atlas 2 and forward starts from 200 for some reason, not from 170
--it's simple now when I know it, but figuring it out gave me a headache :)
local atlasNumber = math.floor(index/200)
if index >= 200 then
index = index - 200 * (atlasNumber)
end
local atlasIndex = index%169
local row = math.floor(atlasIndex/13)
local col = atlasIndex%13
local atlas = 'assets/textures/gui/items.tga'
if atlasNumber > 0 then
atlas = 'assets/textures/gui/items_'..(atlasNumber+1)..'.tga'
end
--g.drawImage(atlas,0,0)
g.drawImage2(atlas, x, y, col*75, row*75, 75,75, 75, 75)
end
Re: [WIP] GrimTK GUI Framework
Posted: Sat Mar 07, 2015 8:58 am
by AdrTru
Hi,
I wrote this problem in some post ago. There is my fix( with your %169) in GrimTk file.
mod_assets\grimtk\scripts\gtk\core.lua - line cca 430:
Code: Select all
self.drawIcon = function(self, args)
if ( args.position == nil or args.size == nil or args.gfxIndex == nil) then
Console.warn("Invalid parameters to drawIcon");
return false;
end
local path = args.gfxAtlas;
local index = args.gfxIndex;
local atlasWidth = iff(args.atlasWidth, args.gfxAtlasWidth, 13);
local iconWidth = iff(args.iconWidth,args.iconWidth, 75);
local iconHeight = iff(args.iconHeight,args.iconHeight, 75);
if ( path == nil ) then
local builtInGfxAtlasIndex = math.floor(args.gfxIndex / 200);
index = index - (builtInGfxAtlasIndex * 200);
index = index%169
if ( builtInGfxAtlasIndex == 0 ) then
path = "assets/textures/gui/items.tga";
else
path = "assets/textures/gui/items_" .. (builtInGfxAtlasIndex + 1) .. ".tga";
end
end
local image = {
path = path,
origin = { iconWidth * (index % atlasWidth), iconHeight * math.floor(index / atlasWidth) },
size = { iconWidth, iconHeight }
}
local imageArgs = {
image = image,
position = args.position,
size = args.size,
drawMode = args.drawMode,
imageGravity = args.imageGravity,
}
self:drawImage(imageArgs);
end
Re: [WIP] GrimTK GUI Framework
Posted: Sat Mar 07, 2015 12:30 pm
by JohnWordsworth
Many thanks to both AdrTru and JKos. I will fix the GIcon issue this weekend sometime
.
Re: [WIP] GrimTK GUI Framework
Posted: Sun Mar 08, 2015 8:20 pm
by JohnWordsworth
GrimTK GUI Alpha 007 Released.
Release Notes
REALLY IMPORTANT: GrimTK no longer allows you to pass raw function objects to anything as a callback as it caused issues with save games. All of the normal "onPressed", "onSelected", "onFinished" etc hooks should be a string of the form "entity_name.component.function_name", which would usually be something like ...
onPressed = self.go.id .. ".script.function";
If you have been working with the toolkit, you will likely need to make some very minor tweaks. Please see the new demos!
TextInputBox: Added a text input box which can ask the user for a password or a text string.
Added FreezeAI Window Option: You can add "freezeAI" to window definitions to make them freeze monster AI when shown. The NPC dialogue system uses this feature by default.
Bug Fixes: If a text box is in focus, shortcuts shouldn't trigger.
Fixes GIcon: Many thanks for your fix AdrTru.
Re: [WIP] GrimTK GUI Framework
Posted: Sat Mar 14, 2015 1:45 am
by AndakRainor
Hello ! Thank you for all this wonderful work
I'd like to create some taverns and shops as those in the Ishar games. Basically it would be a background image the size of the screen with some menus. How should I implement it with your framework ? Would it be smart to use a window of maximum size to cover the screen or is there a way to stop the 3D rendering while in those screen size menus ?
Re: [WIP] GrimTK GUI Framework
Posted: Sun Mar 22, 2015 1:45 pm
by AndakRainor
Is there any hook I could define which is called before each rendering of a widget ? onDrawGui seems to be called only once.
Re: [WIP] GrimTK GUI Framework
Posted: Wed Jun 24, 2015 8:01 pm
by Emera Nova
So I'm making a quest that you have to talk to an NPC to start it and then you meet back up with them when you finish for your reward. Problem is atm the player just has to retalk to the npc and they can get the reward for the quest. How would I make it so it checks to see say either a trigger has been stepped on a button pressed or a monster killed before giving the players the option of saying yes I've completed the quest.
As it is I have the script check to see if you have accepted the quest if you have it changes the dialogue to different stuff which gives you access to turning in the quest as completed.. But I have no way atm of checking to see if it really is complete to give that option.