Use new coding style in game modules

Lots of refactoring and changes
Remove docs folder
This commit is contained in:
Eduardo Bart
2012-07-24 02:30:08 -03:00
parent 1c3e630237
commit c54cd1fdf1
69 changed files with 1629 additions and 2634 deletions

View File

@@ -1,7 +1,5 @@
Shaders = {}
local HOTKEY = 'Ctrl+X'
local MAP_SHADERS = {
HOTKEY = 'Ctrl+X'
MAP_SHADERS = {
{ name = 'Default', frag = 'shaders/default.frag' },
{ name = 'Bloom', frag = 'shaders/bloom.frag'},
{ name = 'Sepia', frag ='shaders/sepia.frag' },
@@ -16,23 +14,23 @@ local MAP_SHADERS = {
{ name = 'Noise', frag ='shaders/noise.frag' },
}
local ITEM_SHADERS = {
ITEM_SHADERS = {
{ name = 'Fake 3D', vert = 'shaders/fake3d.vert' }
}
local shadersPanel
shadersPanel = nil
function Shaders.init()
function init()
g_ui.importStyle('shaders.otui')
g_keyboard.bindKeyDown(HOTKEY, Shaders.toggle)
g_keyboard.bindKeyDown(HOTKEY, toggle)
shadersPanel = g_ui.createWidget('ShadersPanel', GameInterface.getMapPanel())
shadersPanel = g_ui.createWidget('ShadersPanel', modules.game_interface.getMapPanel())
shadersPanel:hide()
local mapComboBox = shadersPanel:getChildById('mapComboBox')
mapComboBox.onOptionChange = function(combobox, option)
local map = GameInterface.getMapPanel()
local map = modules.game_interface.getMapPanel()
map:setMapShader(g_shaders.getShader(option))
end
@@ -51,16 +49,15 @@ function Shaders.init()
mapComboBox:addOption(opts.name)
end
local map = GameInterface.getMapPanel()
local map = modules.game_interface.getMapPanel()
map:setMapShader(g_shaders.getShader('Default'))
end
function Shaders.terminate()
function terminate()
g_keyboard.unbindKeyDown(HOTKEY)
shadersPanel:destroy()
shadersPanel = nil
end
function Shaders.toggle()
function toggle()
shadersPanel:setVisible(not shadersPanel:isVisible())
end

View File

@@ -3,13 +3,6 @@ Module
description: Manage game shaders
author: edubart
website: www.otclient.info
dependencies:
- game_interface
@onLoad: |
dofile 'shaders'
Shaders.init()
@onUnload: |
Shaders.terminate()
scripts: [ shaders.lua ]
@onLoad: init()
@onUnload: terminate()