Commits

VideroBoy committed cda0572

Renamed graphics functions

  • Participants
  • Parent commits 5bca4a6

Comments (0)

Files changed (6)

File Space Ninja.tmproj

 			<key>filename</key>
 			<string>actor.lua</string>
 			<key>lastUsed</key>
-			<date>2010-12-03T16:34:56Z</date>
+			<date>2010-12-03T17:37:15Z</date>
 		</dict>
 		<dict>
 			<key>filename</key>
 			<key>filename</key>
 			<string>constants.lua</string>
 			<key>lastUsed</key>
-			<date>2010-12-03T17:15:16Z</date>
+			<date>2010-12-03T17:37:07Z</date>
 		</dict>
 		<dict>
 			<key>filename</key>
 			<key>filename</key>
 			<string>levels.lua</string>
 			<key>lastUsed</key>
-			<date>2010-12-03T17:15:04Z</date>
+			<date>2010-12-03T17:49:47Z</date>
 		</dict>
 		<dict>
 			<key>filename</key>
 			<string>main.lua</string>
 			<key>lastUsed</key>
-			<date>2010-12-03T17:15:32Z</date>
+			<date>2010-12-04T23:31:38Z</date>
+			<key>selected</key>
+			<true/>
 		</dict>
 		<dict>
 			<key>filename</key>
 	<key>showFileHierarchyDrawer</key>
 	<true/>
 	<key>windowFrame</key>
-	<string>{{701, 123}, {632, 1019}}</string>
+	<string>{{995, 159}, {632, 1019}}</string>
 </dict>
 </plist>
     August 28, 2010
 ]]
 
-require('graphics')
+require('gfx')
 require('animation')
 require('constants')
 require('utility')
 end
 
 function actor.buildType(baseType)
-    local spriteSheet = graphics.loadImage(baseType.spriteSheet)
+    local spriteSheet = gfx.loadImage(baseType.spriteSheet)
 
     local actWidth = baseType.spriteWidth
     local actHeight = baseType.spriteHeight
+--[[
+    Aaron MacDonald
+    August 28, 2010
+]]
+
+local GRAPHICS_DIR = 'graphics/'
+local GRAPHICS_TYPE = '.png'
+
+local FONT_SIZE = 24
+local FONT_FILE = 'fonts/Commodore Rounded v1-1.ttf'
+
+----------------------------------------------------------------------
+
+gfx = {}
+
+function gfx.loadImage(spriteName, haveExtension)
+    local path = GRAPHICS_DIR .. spriteName
+    if not haveExtension then
+        path = path .. GRAPHICS_TYPE
+    end
+    local image = love.graphics.newImage(path)
+    --image:setFilter("nearest", "linear")
+
+    return image
+end
+
+function gfx.loadFont()
+    love.graphics.setFont(FONT_FILE, FONT_SIZE)
+end
+
+function gfx.fontHeight(textAbove)
+    local result = love.graphics.getFont():getHeight()
+
+    if textAbove then
+        result = result + love.graphics.getFont():getLineHeight()
+    end
+
+    return result
+end
+
+function gfx.setColourWhite()
+    love.graphics.setColor(255, 255, 255)
+end

File graphics.lua

---[[
-    Aaron MacDonald
-    August 28, 2010
-]]
-
-local GRAPHICS_DIR = 'graphics/'
-local GRAPHICS_TYPE = '.png'
-
-local FONT_SIZE = 24
-local FONT_FILE = 'fonts/Commodore Rounded v1-1.ttf'
-
-----------------------------------------------------------------------
-
-graphics = {}
-
-function graphics.loadImage(spriteName, haveExtension)
-    local path = GRAPHICS_DIR .. spriteName
-    if not haveExtension then
-        path = path .. GRAPHICS_TYPE
-    end
-    local image = love.graphics.newImage(path)
-    --image:setFilter("nearest", "linear")
-
-    return image
-end
-
-function graphics.loadFont()
-    love.graphics.setFont(FONT_FILE, FONT_SIZE)
-end
-
-function graphics.fontHeight(textAbove)
-    local result = love.graphics.getFont():getHeight()
-
-    if textAbove then
-        result = result + love.graphics.getFont():getLineHeight()
-    end
-
-    return result
-end
-
-function graphics.setColourWhite()
-    love.graphics.setColor(255, 255, 255)
-end
 ]]
 
 require('constants')
-require('graphics')
+require('gfx')
 require('utility')
 
 local LEVEL_DIR = 'levels/'
 
     if not levels.TILESETS[tilesetName] then
         levels.TILESETS[tilesetName] = {
-          image = graphics.loadImage(tilesetName, true),
+          image = gfx.loadImage(tilesetName, true),
           quads = {}
         }
     end
     August 18, 2010
 ]]
 
-require('graphics')
+require('gfx')
 require('constants')
 require('actor')
 require('levels')
     accumulatedTime = 0
     isPaused = false
 
-    graphics.loadFont()
+    gfx.loadFont()
 
     initActorTypes()