| 1 |
--[[ Copyright (c) 2014 Edvin "Lego3" Linge |
| 2 |
|
| 3 |
Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 4 |
this software and associated documentation files (the "Software"), to deal in |
| 5 |
the Software without restriction, including without limitation the rights to |
| 6 |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
| 7 |
of the Software, and to permit persons to whom the Software is furnished to do |
| 8 |
so, subject to the following conditions: |
| 9 |
|
| 10 |
The above copyright notice and this permission notice shall be included in all |
| 11 |
copies or substantial portions of the Software. |
| 12 |
|
| 13 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 19 |
SOFTWARE. --]] |
| 20 |
|
| 21 |
-- A stub implementation of the TH C++ object, to be able to run |
| 22 |
-- unit tests without any backend. |
| 23 |
|
| 24 |
local loadFont = function() |
| 25 |
return { |
| 26 |
draw = function() end, |
| 27 |
drawWrapped = function() end, |
| 28 |
} |
| 29 |
end |
| 30 |
|
| 31 |
TheApp = { |
| 32 |
gfx = { |
| 33 |
loadMainCursor = function() end, |
| 34 |
loadSpriteTable = function() end, |
| 35 |
loadFont = loadFont, |
| 36 |
loadFontAndSpriteTable = loadFont, |
| 37 |
}, |
| 38 |
runtime_config = {}, |
| 39 |
config = { |
| 40 |
width = 600, |
| 41 |
height = 800, |
| 42 |
ui_scale = 1, |
| 43 |
}, |
| 44 |
world = { |
| 45 |
speed = "Normal", |
| 46 |
isCurrentSpeed = function(self, s) return s == self.speed end, |
| 47 |
gameLog = function() end, |
| 48 |
}, |
| 49 |
animation_manager = { |
| 50 |
setPatientMarker = function(...) end, |
| 51 |
setStaffMarker = function(...) end, |
| 52 |
}, |
| 53 |
} |
| 54 |
|
| 55 |
local sub_S = setmetatable({key = ''}, { |
| 56 |
__index = function(t, k) |
| 57 |
t.key = t.key .. '.' .. k |
| 58 |
return t |
| 59 |
end, |
| 60 |
|
| 61 |
__tostring = function(t) |
| 62 |
return t.key |
| 63 |
end, |
| 64 |
}) |
| 65 |
|
| 66 |
_G['_S'] = setmetatable({key = ''}, { |
| 67 |
__index = function(_, k) |
| 68 |
sub_S.key = '_S.' .. k |
| 69 |
return sub_S |
| 70 |
end, |
| 71 |
|
| 72 |
__tostring = function(_) |
| 73 |
return '_S' |
| 74 |
end, |
| 75 |
}) |
| 76 |
|
| 77 |
return { |
| 78 |
animation = function() |
| 79 |
return { |
| 80 |
setHitTestResult = function() end, |
| 81 |
setAnimation = function() end, |
| 82 |
setTile = function() end, |
| 83 |
} |
| 84 |
end |
| 85 |
} |