I'm chipping away at this in tiny little chubks at the moment. I get just so far and my concentration seems to go. Never mind, we do waht we can.
Today's exercise is to write the GuiStage class. A while back I wrote about using a "Stage" class to abstract the game engine and let me test the adv engine. I have a TestStage which works and using it I have a lot of tests (many of which need updating - the XML format changed during the SceneEdit develoment)
Anyway, now I need a GuiStage class. This being Lua, there isn't an actual base class to work from, so I'm going to adapt the Test version.
--[[
* A Stage is where a Narrator might enact a Scene. So that's the
* metaphor - a Stage is the interface that the Narrator class uses
* to interact with the user (or test harness).
*
* in this case, we're interacting with the game GUI. Yayy!
--]]
module(..., package.seeall)
GuiStage = GuiStage or {}
GuiStage.__index = GuiStage
--[[
* Create the object. Not sure what data we need to store
--]]
function GuiStage:new()
self = { }
setmetatable(self, GuiStage)
return self
end
--[[
*
* This sets the background image for the adv window.
*
--]]
function GuiStage:image(file)
end
--[[
* This displays a message box
--]]
function GuiStage:text(string)
end
--[[
* This called when a choice is displayed, to test the display
* The result will be apparent from the text elements following the choice
--]]
function GuiStage:choice_show(options)
end
--[[
* This called when a the result of a choice is required
*
* What we'll do is pop the value off the front of the input queue
--]]
function GuiStage:choice_result(item)
end
--[[
* background image: not sure why this is here -
* or what the difference is with the image method.
--]]
function GuiStage:set_background(filepath)
end
That's what I have to work to. I'm a little nonplussed to find I wrote two methods to set the background image. That said the set_background one doesn't seem to be used anywhere - test or production code. I'm tempted to use the name for the other method ... but that leaves too much code to fix and too many possible bugs if I miss something.
Anyway, that's my worklist.
No comments:
Post a Comment