-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab4b650
commit 3a2cee3
Showing
28 changed files
with
1,661 additions
and
393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--========= Copyright © 2013-2016, Planimeter, All rights reserved. ==========-- | ||
-- | ||
-- Purpose: Spell Item class | ||
-- | ||
--============================================================================-- | ||
|
||
class "spellitem" ( gui.button ) | ||
|
||
spellitem.trappedItem = trappedItem | ||
|
||
function spellitem:spellitem( parent, name, spellName ) | ||
require( "game.shared.spells." .. spellName ) | ||
|
||
local spell = spell.getSpell( spellName ) | ||
local text = spell.name | ||
gui.button.button( self, parent, name, text ) | ||
self.width = parent:getWidth() | ||
self.height = 30 | ||
self.spell = spell | ||
end | ||
|
||
function spellitem:drawBackground() | ||
local property = "button.backgroundColor" | ||
local width = self:getWidth() | ||
local height = self:getHeight() | ||
|
||
if ( self:isDisabled() ) then | ||
property = "button.disabled.backgroundColor" | ||
graphics.setColor( self:getScheme( property ) ) | ||
graphics.rectangle( "fill", 1, 0, width - 2, height ) | ||
return | ||
end | ||
|
||
if ( self.mousedown and self.mouseover ) then | ||
property = "button.mousedown.backgroundColor" | ||
graphics.setColor( self:getScheme( property ) ) | ||
graphics.rectangle( "fill", 1, 0, width - 2, height ) | ||
elseif ( self.mousedown or self.mouseover ) then | ||
property = "button.mouseover.backgroundColor" | ||
graphics.setColor( self:getScheme( property ) ) | ||
graphics.rectangle( "fill", 1, 0, width - 2, height ) | ||
end | ||
end | ||
|
||
function spellitem:drawForeground() | ||
end | ||
|
||
function spellitem:drawText() | ||
local property = "button.textColor" | ||
|
||
if ( self:isDisabled() ) then | ||
property = "button.disabled.textColor" | ||
end | ||
|
||
graphics.setColor( self:getScheme( property ) ) | ||
|
||
local font = self:getScheme( "font" ) | ||
graphics.setFont( font ) | ||
local margin = 18 | ||
local x = margin | ||
local y = self:getHeight() / 2 - font:getHeight() / 2 - 2 | ||
graphics.print( self:getText(), x, y ) | ||
|
||
local label = "Key or Button" | ||
local key = self:getKey() | ||
x = self:getWidth() - margin - font:getWidth( label ) / 2 - font:getWidth( key ) / 2 | ||
graphics.print( key, x, y ) | ||
end | ||
|
||
function spellitem:getSpell() | ||
return self.spell | ||
end | ||
|
||
function spellitem.keyTrap( key ) | ||
local self = gui.spellitem.trappedItem | ||
gui.spellitem.trappedItem = nil | ||
self:setKey( key ) | ||
os.setCursorVisible( true ) | ||
return true | ||
end | ||
|
||
function spellitem:onClick() | ||
gui.spellitem.trappedItem = self | ||
os.setCursorVisible( false ) | ||
input.setKeyTrap( self.keyTrap ) | ||
end | ||
|
||
gui.register( spellitem, "spellitem" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<tileset name="Architect" tilewidth="32" tileheight="32"> | ||
<image source="../images/tilesets/architect.png" width="64" height="64"/> | ||
<tileset name="Architect" tilewidth="16" tileheight="16"> | ||
<image source="../images/tilesets/architect.png" width="32" height="32"/> | ||
</tileset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<tileset name="Developer" tilewidth="32" tileheight="32"> | ||
<image source="../images/tilesets/developer.png" width="64" height="64"/> | ||
<tileset name="Developer" tilewidth="16" tileheight="16"> | ||
<image source="../images/tilesets/developer.png" width="32" height="32"/> | ||
</tileset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.