Skip to content
Snippets Groups Projects
Commit 44b37684 authored by dg's avatar dg
Browse files

Buttons will provide a visual feedback when clicked

git-svn-id: http://svn.net-core.org/repos/t-engine4@3291 51575b47-30f0-44d4-a5cc-537603b46e54
parent c4dc5f9e
No related branches found
No related tags found
No related merge requests found
......@@ -65,12 +65,20 @@ function _M:generate()
self.h = self.h + 6
end
function _M:display(x, y, nb_keyframes)
function _M:display(x, y, nb_keyframes, ox, oy)
x = x + 3
y = y + 3
ox = ox + 3
oy = oy + 3
local mx, my, button = core.mouse.get()
if self.focused then
self:drawFrame(self.frame_sel, x, y)
self.tex[1]:toScreenFull(x-frame_ox1, y-frame_oy1, self.rw, self.rh, self.tex[2], self.tex[3])
if button == 1 and mx > ox and mx < ox+self.w and my > oy and my < oy+self.h then
self:drawFrame(self.frame, x, y, 0, 1, 0, 1)
self.tex[1]:toScreenFull(x-frame_ox1, y-frame_oy1, self.rw, self.rh, self.tex[2], self.tex[3])
else
self:drawFrame(self.frame_sel, x, y)
self.tex[1]:toScreenFull(x-frame_ox1, y-frame_oy1, self.rw, self.rh, self.tex[2], self.tex[3])
end
else
self:drawFrame(self.frame, x, y)
if self.focus_decay then
......
......@@ -46,7 +46,7 @@ TOOLTIP_LIFE_REGEN = [[#GOLD#Life Regeneration#LAST#
How many life you regenerate per turn.
This value can be improved with spells, talents, infusions, equipment.]]
TOOLTIP_LIFE = [[#GOLD#Healing mod#LAST#
TOOLTIP_HEALING_MOD = [[#GOLD#Healing mod#LAST#
This represents how effective is healing for you.
All healing values are multiplied by this value (including life regeneration).]]
......@@ -130,18 +130,18 @@ It represents how much "energy" you get per game turn, once you reach a certain
I.E: at 200% global speed you get twice as much energy per game turn and thus can act twice when other creatures only act once.
]]
TOOLTIP_SPEED_MOVEMENT = [[#GOLD#Movement Speed#LAST#
The time it takes you to move.
It represents how many movements you can do in the same time.
The additional time you have to move.
It represents how many more movements you can do in the same time.
I.E: at 100% you will be able to do 100% more movements (aka twice as many) in the same time it would have taken you to do one at 0% speed.
]]
TOOLTIP_SPEED_SPELL = [[#GOLD#Spell Speed#LAST#
The time it takes you to cast a spell.
It represents how many spells you can do in the same time.
The additional time you have cast a spell.
It represents how many more spells you can cast in the same time.
I.E: at 100% you will be able to cast 100% more spells (aka twice as many) in the same time it would have taken you to do one at 0% speed.
]]
TOOLTIP_SPEED_ATTACK = [[#GOLD#Attack Speed#LAST#
The time it takes you to attack (in melee or ranged).
It represents how many attacks you can do in the same time.
The additional time you have to attack (in melee or ranged).
It represents how many more attacks you can do in the same time.
I.E: at 100% you will be able to do 100% more attacks (aka twice as many) in the same time it would have taken you to do one at 0% speed.
]]
......
......@@ -198,7 +198,7 @@ function _M:drawDialog(kind)
local StatVal = self.actor:getStr(nil, nil, true)
local StatTxt = ""
if StatVal > player:getStr() then
StatTxt = ("Strength : #ff0000#%3d / %3"):format(player:getStr(nil, nil, true), player:getStr())
StatTxt = ("Strength : #ff0000#%3d / %d"):format(player:getStr(nil, nil, true), player:getStr())
else
StatTxt = ("Strength : #00ff00#%3d / %d"):format(player:getStr(nil, nil, true), player:getStr())
end
......
......@@ -45,12 +45,13 @@
static int lua_get_mouse(lua_State *L)
{
int x = 0, y = 0;
(void)SDL_GetMouseState(&x, &y);
int buttons = SDL_GetMouseState(&x, &y);
lua_pushnumber(L, x);
lua_pushnumber(L, y);
lua_pushnumber(L, SDL_BUTTON(buttons));
return 2;
return 3;
}
static int lua_set_mouse(lua_State *L)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment