Author Topic: Screen trouble  (Read 3946 times)

0 Members and 1 Guest are viewing this topic.

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Screen trouble
« on: September 27, 2012, 02:32:29 pm »
Lately I've been running into some trouble with my lua programs on startup. When running the script from the editor in the TINCS, it runs fine. But on startup the screen is all messed up and not how its supposed to be. The code (also in attachment) and screenshots are included below. I don't know what's causing this problem, so any help would be appreciated :)
Code:
Code: [Select]
-- BetterLuaAPI for TI-Nspire
-- Version 2.2 (Aug 28th 2011)
-- Adriweb 2011 -- Thanks to Jim Bauwens and Levak
-- [email protected]
-- Put all this or some of this (be careful, though, some functions use each other) in your code and thank me ;)
-- Remember to put "myGC = gc" in the  on.paint(gc)  function.

-- See the use of that device table in the on.paint function
local function drawPoint(x, y)
myGC:fillRect(x, y, 1, 1)
end

local function drawCircle(x, y, diameter)
myGC:drawArc(x - diameter/2, y - diameter/2, diameter,diameter,0,360)
end

local function drawCenteredString(str)
myGC:drawString(str, (pww() - myGC:getStringWidth(str)) / 2, pwh() / 2, "middle")
end

local function pww()
    return platform.window:width()
end

local function drawXCenteredString(str,y)
myGC:drawString(str, (pww() - myGC:getStringWidth(str)) / 2, y, "top")
end

local function verticalBar(x)
myGC:fillRect(x,0,1,platform.window:height())
end

local function horizontalBar(y)
myGC:fillRect(0,y,platform.window:width(),1)
end

local function drawSquare(x,y,l)
myGC:drawPolyLine({(x-l/2),(y-l/2), (x+l/2),(y-l/2), (x+l/2),(y+l/2), (x-l/2),(y+l/2), (x-l/2),(y-l/2)})
end

local function drawRoundRect(x,y,wd,ht,rd)  -- wd = width, ht = height, rd = radius of the rounded corner
x = x-wd/2  -- let the center of the square be the origin (x coord)
y = y-ht/2 -- same for y coord
if rd > ht/2 then rd = ht/2 end -- avoid drawing cool but unexpected shapes. This will draw a circle (max rd)
myGC:drawLine(x + rd, y, x + wd - (rd), y);
myGC:drawArc(x + wd - (rd*2), y + ht - (rd*2), rd*2, rd*2, 270, 90);
myGC:drawLine(x + wd, y + rd, x + wd, y + ht - (rd));
myGC:drawArc(x + wd - (rd*2), y, rd*2, rd*2,0,90);
myGC:drawLine(x + wd - (rd), y + ht, x + rd, y + ht);
myGC:drawArc(x, y, rd*2, rd*2, 90, 90);
myGC:drawLine(x, y + ht - (rd), x, y + rd);
myGC:drawArc(x, y + ht - (rd*2), rd*2, rd*2, 180, 90);
end

local function fillRoundRect(x,y,wd,ht,radius)  -- wd = width and ht = height -- renders badly when transparency (alpha) is not at maximum >< will re-code later
if radius > ht/2 then radius = ht/2 end -- avoid drawing cool but unexpected shapes. This will draw a circle (max radius)
    myGC:fillPolygon({(x-wd/2),(y-ht/2+radius), (x+wd/2),(y-ht/2+radius), (x+wd/2),(y+ht/2-radius), (x-wd/2),(y+ht/2-radius), (x-wd/2),(y-ht/2+radius)})
    myGC:fillPolygon({(x-wd/2-radius+1),(y-ht/2), (x+wd/2-radius+1),(y-ht/2), (x+wd/2-radius+1),(y+ht/2), (x-wd/2+radius),(y+ht/2), (x-wd/2+radius),(y-ht/2)})
    x = x-wd/2  -- let the center of the square be the origin (x coord)
y = y-ht/2 -- same
myGC:fillArc(x + wd - (radius*2), y + ht - (radius*2), radius*2, radius*2, 1, -91);
    myGC:fillArc(x + wd - (radius*2), y, radius*2, radius*2,-2,91);
    myGC:fillArc(x, y, radius*2, radius*2, 85, 95);
    myGC:fillArc(x, y + ht - (radius*2), radius*2, radius*2, 180, 95);
end

local function drawLinearGradient(color1,color2)
-- syntax would be : color1 and color2 as {r,g,b}.
  -- don't really know how to do that. probably converting to hue/saturation/light mode and change the hue.
  -- todo with unpack(color1) and unpack(color2)
end
---------------  End of BetterLuaAPI

--------------- Start of application

--Variables used throughout the application
--Set api level
platform.apilevel = '1.0'
--'System' variables
width = platform.window:width()
height = platform.window:height()
--Define the various screens and set the main screen
main, blocks, items, mobs, terrain, title = 0, 1 ,2, 3, 4, 5
screen = main
--Array of paint, which will hold all the paint functions for different screens
paint = {}
--All images used in the application
SectionBlocks = image.new("&\000\000\000&\000\000\000\000\000\000\000L\000\000\000\016\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000)\174)\174)\174\204\186\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\165J\178)\174\009\170j\178\139\182\009\174\232\169\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000*\174J\178\232\165\232\165\009\170\232\169\009\170*\174\009\170\232\169\232\169\233\169\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\165\200\165\009\174*\174\233\169\009\174\009\174\009\170\232\169\232\169\009\174\009\170\232\169\009\170\200\165\200\165\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000J\178J\178\009\170\232\169)\174*\174\232\169)\174\009\174\009\174*\174\009\174\009\170\232\169\009\170\009\174\232\165\009\170)\174*\174\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000*\174)\174)\174)\174)\174*\174*\174)\174\009\174)\174\009\170\009\174j\178J\178\232\169\232\165\009\170\009\170\232\169\232\169J\174)\174\009\170\232\169\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\172\182J\178\232\169J\174*\174\009\174k\178k\178j\178J\174\009\170\009\170\232\169\232\169\009\174\009\174*\174j\178)\174\232\165\009\170J\174j\178J\178\009\170\232\169\232\169\232\169\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000J\178\009\170\009\170k\178*\174*\174\009\170)\174J\178\009\170\009\170*\174\009\170\232\169)\174)\174\232\165\232\169\009\170)\174*\174\200\165\232\165\009\170J\178j\178*\174\139\182)\174J\174\009\170\135\161\000\000\000\000\000\000\000\000\000\000\200\165\009\170J\174J\178J\178\200\165\232\169\009\170*\174)\174\232\169J\178J\178J\178J\178J\178)\174\009\174\009\174\009\170\009\170)\174\232\169\232\169J\178*\174\009\170\232\169\200\165\232\169\232\169\200\165\232\165\167\161\000\000\000\000\000\000\000\000f\157\200\165\009\170)\174j\178\232\169\009\174\232\169\009\174\009\174\232\169\009\174\009\170\009\174\009\170\232\169*\174k\178j\178*\174)\174k\178J\174\232\169\232\169*\174\232\169\233\169)\174\233\169J\178\232\169%\153\228\144\000\000\000\000\000\000\000\000f\157\167\161\135\161\135\161\232\169J\174k\182J\178*\174\232\169\233\169\200\165\232\169\009\174k\178)\174\232\169)\174\009\170\233\169\233\169\232\169\009\174)\174)\174\009\170\233\169\233\169\009\170\167\161F\157\004\149\195\144\228\144\000\000\000\000\000\000\000\000\134\157E\157f\157f\157E\153\167\161\009\170)\174)\174\009\174\139\182J\178\009\170\009\170\009\174\009\170)\174)\174)\174J\174\009\170\009\170)\174)\174\009\170)\174\009\170\232\169E\153\228\144\228\148\228\144\195\144\131\144\000\000\000\000\000\000\000\000F\157\196\156%\157f\157f\157E\157E\153\135\161\232\169\009\170\232\169\009\170)\174*\174\009\174\232\169\200\165\009\170*\174\009\170)\174j\178)\174)\174\232\169\009\174f\157\228\148\228\144\004\149\005\149\195\144\163\144b\148\000\000\000\000\000\000\000\000\163\156\230\156\005\153E\153F\157\228\156\005\157F\153f\157\167\165k\178)\174\009\170\009\174)\174)\174)\174J\178)\174\200\165\232\169\009\174\009\170\167\161%\153\228\148\228\148\004\149\004\149\228\148\130\144\163\144\130\144\131\152\000\000\000\000\000\000\000\000\005\173\230\164\164\156\195\152%\153\228\156\005\157F\157E\153f\157f\157\134\157)\174\009\174*\174J\178\009\170)\174\009\174\200\165\232\169\200\165E\153\195\144\195\144\195\144\228\148\004\149\004\149\195\148b\148b\144b\148\131\152\000\000\000\000\000\000\000\000\229\168\196\164\229\168\228\168%\157\228\156\228\156\004\157\004\153f\157\135\161f\157F\153\135\161\232\169\009\170\009\170\009\170J\178)\174F\157\228\144\163\144\195\144\195\144\195\144\228\148\228\148\195\144b\148\131\152\131\152b\148\196\160\000\000\000\000\000\000\000\000\005\173\163\156\229\168&\181\228\164\196\160\163\156\163\156\228\156f\157\135\161\135\161f\157\135\161\135\161f\157\009\170\232\165f\157\228\148\228\144\228\148\130\144\195\144\130\144\163\144\163\144\130\144\163\144\164\148\131\152\131\152\131\152\196\164\000\000\000\000\000\000\000\000G\185\228\168\229\168\005\173\196\164\228\168\229\168\163\160\228\152%\153F\157\135\161\135\161\167\165F\157%\153F\157\228\148\005\149\004\149\228\148\228\144\130\144\131\144b\144\130\144\130\144b\144c\148\131\148\131\152\131\152\131\152\163\156\000\000\000\000\000\000\000\000\196\164\196\164\196\164\196\164\229\168\229\168\196\164\196\164\196\160\195\152\196\156F\157%\161\163\152%\153E\153F\157\228\144\195\144\228\144\195\144\228\144\130\144b\144b\148b\148b\144\130\148\130\148\131\152\131\152\163\156\163\156\163\156\000\000\000\000\000\000\000\000\005\173\196\164&\181\006\177(\169\007\169\196\164\131\156\163\156\131\156\163\156\228\156\163\156\196\160\004\153%\153\228\156\004\149b\144\163\144b\144\195\144\163\152\131\152\130\148b\148b\148\163\156\196\164\164\160\131\152\131\152\163\152\131\152\000\000\000\000\000\000\000\000\229\168\228\164\229\168&\181&\177\005\173\196\164\229\172\228\168\163\160\196\160\196\156\007\161\196\164\163\156\163\156\163\156\195\148\164\148b\144\131\156b\148\163\152\130\148b\144\131\152\163\156\163\156\196\160\163\156\131\152\130\148b\148\163\156\000\000\000\000\000\000\000\000\196\164\005\173\196\164\229\168\229\168\005\173\229\168\229\168&\181\006\177\196\164\196\164\164\156\228\164\229\172\131\156\196\164b\144\132\148\163\156\196\164\131\152\163\156\130\152\163\160\196\164\131\152\131\152\163\156\131\152\131\152\163\156\131\152\163\156\000\000\000\000\000\000\000\000\196\164\005\173\196\160\196\160\196\164\229\168\229\168\196\164\229\168\229\172\229\168&\181\229\168\196\164\228\168\163\156\196\164\163\156\130\152\163\156\163\156\164\152\163\152\131\152\131\152\163\156\131\152\163\156\163\156\163\156\196\164\196\160\165\152\131\152\000\000\000\000\000\000\000\000\005\173\229\168\228\168\005\173\229\168\163\160\164\160\163\160\196\160\196\164\196\160&\177&\181\196\164\229\168\196\164&\181\131\152b\144\131\152\131\152\197\156\164\156\131\152\130\148\130\148\131\152\163\156\131\152\163\156\196\160\164\156\164\152b\144\000\000\000\000\000\000\000\000\229\168\196\164\196\164\006\177G\185\229\168\163\160\163\160\196\164\229\168\005\173\005\173\005\173\196\164\005\173\196\164&\181\163\156\131\152\131\152\164\160\164\160\163\156\131\152b\148\130\148\131\152\163\156\131\156b\148\163\156\163\156\131\152\163\156\000\000\000\000\000\000\000\000\196\164\163\156\228\168\005\173\005\177\005\173\006\177\006\177\196\164\196\164\229\168\229\172\196\164\196\164\196\164\229\172\005\173\196\164\131\152\196\164\196\164\131\152\163\156\130\148\130\148\130\152\163\156\196\164\163\156b\148b\148\163\156\196\164\196\164\000\000\000\000\000\000\000\000\196\164\229\168\229\168\228\168\005\173&\181\006\177\005\173\196\164\196\164\229\168\196\164\196\164\228\168\196\164\229\168\005\173\131\152\131\152\131\152\163\156\131\152b\148\130\148\163\156\131\152\163\152\164\160\163\156\131\152\131\152\163\156\164\160\163\156\000\000\000\000\000\000\000\000\005\173\229\168\196\164\196\164\229\168\005\173\006\177\005\173\006\169\006\169G\185\005\177\196\164G\185\005\173\163\156\228\168\163\156\131\152b\148\130\152\163\156\131\152\164\160\164\160\164\152\164\152\131\152\131\152\130\152\163\156\196\164\163\156\163\156\000\000\000\000\000\000\000\000\005\173\228\168\163\156\229\168\229\164\229\164\006\177\005\177\229\164\006\165\005\177\005\173\163\160&\177&\181\196\164\229\168\163\156\163\156b\148\164\160\196\164\164\160\163\156\163\156\131\152\131\152\131\152\163\156b\148\131\152\131\152\163\156b\148\000\000\000\000\000\000\000\000\005\173\196\164\005\173&\177\005\173\196\160\229\168\005\173\228\168\196\164\228\168\229\168\196\164\228\164\006\173(\169\005\173\131\152\163\156\131\152\196\160\164\160\196\160\196\160\163\156\131\152b\148\131\152\163\156\163\156\131\152\163\156\130\152b\144\000\000\000\000\000\000\000\000\000\000\196\164&\181&\177\005\173\196\160\164\160\228\168\229\168\196\160\196\164\196\164\196\164\163\160\005\173\007\169\196\164\131\152\163\156\131\152\163\156\163\156\163\156\196\160\163\156\163\156\163\160\163\156\131\152\163\156\163\156\163\156\131\152\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\005\173\005\173\229\168\006\165\197\160\228\168\005\173\229\168\006\177\196\160\196\164\229\168\228\168\163\156\163\156\130\152\163\156\131\152\163\152\131\152\163\156\131\152\163\156\196\164\163\156\131\152\131\152\163\156\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\196\164(\169\007\169\229\168&\181&\181\229\168\163\160\228\168\005\173G\185\005\173\131\152b\144\163\156\131\152\131\152b\148\130\148\130\148\163\156\163\156\163\156\131\152\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\196\164\229\168\005\173\005\173\228\168\005\173\228\168&\181\006\177&\181\131\152\163\156\131\152\163\156\131\152b\148\165\152\164\152\131\152\163\156\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\005\173\229\168\196\164\228\168\228\168\228\164\005\173\005\173\131\152\131\152b\144\196\160\163\156\131\152\165\152\198\152\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\196\164\228\168\005\173\005\173\005\173\005\173\163\156\131\152\196\160\164\160\163\156\163\156\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\005\173\005\173\196\164\163\160\163\156\131\152\196\164\196\160\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\196\160\131\156\163\156\131\152\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")
SectionItemsTemp = image.new("<\000\000\000<\000\000\000\000\000\000\000x\000\000\000\016\000\001\000\031|\031|\031|\031|\031|\031|\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\031|\031|\031|\031|\031|\031|\031|\031|\031|\031|\031|\031|\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\031|\031|\031|\031|\031|\031|\031|\031|\031|\031|\031|\031|\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\031|\031|\031|\031|\031|\031|\031|\031|\031|\000\128\000\128\000\128\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\000\128\000\128\000\128\031|\031|\031|\031|\031|\031|\000\128\000\128\000\128\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\000\128\000\128\000\128\031|\031|\031|\031|\031|\031|\000\128\000\128\000\128\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\000\128\000\128\000\128\031|\031|\031|\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\2278\2278\2279\2278\2279\2279\2279\227\025\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\025\227\025\2279\2279\2239\2239\2239\2239\2239\2239\2239\2239\2239\2238\2278\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\231\024\227\024\2278\2279\223\230\140\230\136\230\136\230\136\230\136\230\136\230\136\230\136\230\136\230\1409\2239\227\024\227\024\227\024\227\024\227\024\227\024\227\008\161\008\161\008\161\008\161\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\023\231\023\231\023\231\023\231\023\2278\223Y\215\007\133\007\129'\129'\129'\129'\129'\129'\129'\129\007\129Y\2159\2239\227\024\227\024\227\024\227\024\227\024\227\008\161\008\161\008\161\008\161\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\023\231'\173'\173\228\156\229\152\229\140\006\129\212\174\212\170\146\162\146\162\146\162\146\162\212\166\212\166X\1837\191\007\133\230\1409\223\024\227\024\227\024\227\008\161\008\161\255\255\255\255\255\255\255\255\024\227\024\227\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\023\231'\173&\173\227\160\004\153\004\137&\129\244\166\244\166\178\158\146\162\146\162\146\162\212\170\212\166W\1837\191\007\133\230\1409\223\024\227\024\227\024\227\008\161\008\161\255\255\255\255\255\255\255\255\023\227\024\227\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\023\231\129\144\128\144\169\181\234\169o\174\145\162\178\158\178\158'\129'\129'\129'\129'\129'\129'\129\007\129Y\2159\2239\227\024\227\008\161\008\161\255\255\255\255{\239{\239\024\227\023\227\255\255\255\255\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\2278\227\130\140\129\136\235\169\011\158\144\166\177\162\145\162q\170\006\133\230\132\230\136\230\136\230\136\230\132\230\136\230\1409\2239\227\024\227\024\227\008\161\008\161\255\255\255\255{\239{\239\024\227\024\227\255\255\255\255\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\2278\2278\223\229\140\005\133p\174\144\166\210\170\210\174F\133\006\1417\2198\2239\2239\2239\2239\2239\2239\2239\227\024\227\008\161\008\161\255\255\255\255z\239{\239\024\227\024\227{\239{\239\255\255\255\255\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\2278\2279\2279\223Y\215\006\129'\129\145\162\177\162\211\174\177\182\005\145\228\152\022\2317\227\024\227\024\2278\2279\2278\227\024\227\024\227\024\227\008\161\007\161\255\255\255\255z\239z\239\024\227\024\227{\239{\239\255\255\255\255\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\2279\223\230\140\007\133\212\174\244\166\178\158\146\162\196\128\162\132G\165F\173\195\160\196\160\023\231\024\231\024\227\024\227\024\227\024\227\024\227\024\227\024\231\023\231\229\156\197\156\022\227\023\227z\239{\239\255\255\255\255\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\2278\2279\223\230\136\007\129\212\170\244\166\178\158q\170\163\128\130\140F\173%\173\194\164\195\160\021\235\023\231\024\231\024\227\024\227\024\227\024\227\024\231\023\231\021\235\195\160\195\160\021\231\023\227z\239z\239\255\255\255\255\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\2278\2279\223\230\136'\129\146\162\178\158'\129\006\1298\2197\227`\148`\148\168\189\136\189\195\160\196\160\023\231\024\231\024\227\024\227\024\231\023\231\228\160\194\160\168\189\169\189a\148b\144\255\255\255\255\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\2278\2279\223\230\136'\129\146\162\146\162'\129\230\1328\2238\227b\144`\148\169\189\168\189\194\164\195\160\022\235\023\231\023\231\024\231\023\231\022\235\195\160\194\164\168\189\169\189a\148b\144\255\255\255\255\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\2278\2279\223\230\136'\129\146\162\146\162'\129\230\1369\2238\227\023\231\022\231`\148`\152%\177%\177\195\160\196\160\023\231\023\231\196\160\195\160%\177%\177`\148`\148\022\231\023\231\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\2278\2279\223\230\136'\129\146\162\146\162'\129\230\1369\2238\227\024\227\023\231b\144a\148&\173%\177\194\164\195\160\021\235\021\235\195\160\194\164%\177&\173a\148b\144\023\231\024\231\008\161\008\161\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\2278\2279\223\230\136'\129\212\170\212\170'\129\230\1369\2239\227\024\227\024\227\023\231\023\231a\148`\148\168\189\136\189\194\164\194\164\168\189\168\189`\152a\148\023\231\023\231\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\2278\2279\223\230\136'\129\212\166\212\166'\129\230\1369\2239\227\024\227\024\227\024\227\023\231b\144`\148\169\189\168\189\193\164\193\164\167\189\168\189`\148b\144\023\231\024\227\024\2278\227\024\227\023\227\023\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\2278\2279\223\230\136'\129W\183W\183'\129\230\1369\223\025\227\024\227\024\227\024\227\024\231\023\231\022\235`\148`\152$\177$\177\193\164\194\164\021\235\023\231\024\227\024\227\024\227\023\227\229\156\228\156\228\156\229\1567\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\2278\223\230\140\007\1297\1917\191\007\129\230\1409\223\025\227\024\227\024\227\024\227\024\231\023\231\022\235`\148`\152%\177$\177\193\164\194\164\021\235\023\231\023\231\024\227\023\2275\231\002\157\000\161\000\157\002\1575\2317\227\024\227\024\227\024\227\025\227\025\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\2278\2278\2279\223Y\211\007\133\007\133Y\2159\2239\227\024\227\024\227\024\227\024\227\023\231\196\160\195\160&\173&\173`\148`\152\168\189\168\189\195\160\196\160\023\231\023\231\228\156\226\156\148\243\145\243\145\243\147\243\001\157\227\156\023\227\024\227\024\227\024\227\025\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\2279\2279\223\230\140\230\1409\2239\227\024\227\024\227\024\227\024\231\023\231\021\235\195\160\194\164%\177&\173`\148`\148\169\189\136\189\194\164\195\160\021\231\022\231\227\160\000\161\146\243\175\243\174\243\176\243\000\161\001\1615\2317\227\024\227\024\227\024\227\025\227\025\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\2279\2279\2239\2279\227\024\227\024\227\024\227\024\231\023\231\196\160\195\160\168\189\168\189`\148a\148\022\235\022\235`\148`\152%\177%\177\195\160\195\160\226\160\000\161-\231K\231\008\223\009\223\176\243\146\243\001\161\227\1567\227\024\227\024\227\024\227\025\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\2278\227\024\227\024\227\024\227\024\227\024\227\024\231\023\231\022\235\195\160\194\164\168\189\169\189`\148b\144\023\231\023\231b\144a\148&\173%\177\194\164\194\160\225\160\000\161.\231,\231\008\223\008\223\174\243\176\243\000\161\001\1575\2317\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\231\023\231\228\160\195\160%\173%\177`\152`\148\022\231\023\231\024\227\024\231\023\231\023\231a\148`\148\168\189\167\189\224\160\224\160\236\222\234\222\233\222\009\223\008\223\009\223\176\243\147\243\002\157\229\156\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\231\023\231\021\235\195\160\194\160%\177&\173a\148b\144\023\231\024\227\024\227\024\227\024\227\023\231b\144`\148\168\189\167\189\224\160\224\160\236\222\234\222\234\222\233\222\008\223\008\223\174\243\145\243\000\161\228\156\023\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227(\165(\165\197\156\195\160\169\189\168\189`\148a\148\023\231\023\231\024\227\024\227\024\227\024\227\024\227\024\231\023\231\021\231\128\148\128\148\205\222\236\222h\206g\210\234\222\234\222,\231K\231\175\243\145\243\000\161\228\156\023\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227(\165(\165\197\156\195\160\169\189\169\189`\148b\144\023\231\024\227\024\227\024\227\024\227\024\227\024\227\024\227\023\2315\231\128\144\128\148\236\222\235\222g\206h\210\236\222\236\222.\231-\231\146\243\148\243\002\157\229\156\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227(\165(\165\239\193\238\193/\202.\202a\148a\148\022\231\023\231\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\229\156\227\156\207\222\237\222h\206h\206\235\222\236\222\224\160\224\160\000\161\000\161\000\161\226\1565\231\023\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227(\165'\165\237\193\237\193/\202/\198b\144b\144\023\231\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\023\227\228\156\001\161\238\222\235\222g\206h\206\237\222\206\226\224\160\225\160\227\160\227\156\228\156\229\156\023\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\023\231b\144a\148\170\185\170\185\237\193\239\193\239\193\239\193(\165)\165\025\227\024\227\024\227\024\227\024\227\024\227\024\227\023\227\228\156\001\161\238\222\236\222\236\222\237\222\128\148\128\148E\173F\173\022\231\023\231\023\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\023\231a\148`\148\169\189\169\185\237\193\015\194\239\189\239\189(\165)\165\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\229\156\226\156\239\218\238\222\238\222\207\222\128\144\128\148'\173'\173\023\231\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\023\231'\173&\173\194\160\195\160'\169(\1651\1981\198\239\189\239\189)\165)\165)\165)\165\024\227\024\227\024\227\024\227\023\2275\231\227\156\225\160\225\160\227\1565\231\022\231\023\231\023\231\023\231\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\023\231'\173'\173\196\160\229\156'\165(\1651\1981\198\239\189\239\189)\165)\165)\165)\165\024\227\024\227\024\227\024\227\024\2277\227\229\156\228\156\228\156\229\156\023\227\023\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\023\231\023\231\023\231\023\231\023\231\024\231\024\227)\165)\1651\1981\1981\1981\198s\206s\206)\165)\165\024\227\024\227\024\227\024\227\024\2278\231\023\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\231\024\227\024\227\024\227\024\227)\165)\1651\1981\1981\1981\198s\206s\206)\165)\165\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227)\165)\165)\165)\165)\165)\165\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227)\165)\165)\165)\165)\165)\165\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\000\128\000\128\000\128\255\255\255\255\255\255\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227\024\227J\169J\169J\169\000\128\000\128\000\128\031|\031|\031|\000\128\000\128\000\128J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169\000\128\000\128\000\128\031|\031|\031|\031|\031|\031|\000\128\000\128\000\128J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169\000\128\000\128\000\128\031|\031|\031|\031|\031|\031|\000\128\000\128\000\128J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169J\169\000\128\000\128\000\128\031|\031|\031|\031|\031|\031|\031|\031|\031|\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\031|\031|\031|\031|\031|\031|\031|\031|\031|\031|\031|\031|\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\031|\031|\031|\031|\031|\031|\031|\031|\031|\031|\031|\031|\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\000\128\031|\031|\031|\031|\031|\031|")
    SectionItems = image.copy(SectionItemsTemp, SectionItemsTemp:width()*0.6, SectionItemsTemp:height()*0.6)
    SectionItemsTemp = nil
--
--Some functions that make life easier
--
--[[
function on.create()
    screen = main
end
]]--

local function refresh()
    platform.window:invalidate()
end
function on.timer()
    refresh()
end
--
--Classes used throughout the app with their belonging functions
--
HitBoxSquare = class()
function HitBoxSquare:init(xIn, yIn, width, height)
     self.x = xIn
     self.y = yIn
     self.width = width
     self.height = height
end

function HitBoxSquare:contains(xMouse, yMouse)
    local sw = self.width
    local sh = self.height
    return (xMouse>=(self.x)) and xMouse<=(self.x+sw) and yMouse>=(self.y) and yMouse<=(self.y+sh)
end
--
--Actual application starting point
hitBoxBlocks = HitBoxSquare(width*0.20, height*0.30, SectionBlocks:width(), SectionBlocks:height())
hitBoxItems = HitBoxSquare(width*0.40, height*0.30, SectionItems:width(), SectionBlocks:height())

function checkSelection()
 if(screen == main) then
    if hitBoxBlocks:contains(mouseX, mouseY) then
        screen = blocks
    end
    if hitBoxItems:contains(mouseX, mouseY) then
        screen = items
    end
 end
 if (screen == blocks) then
 
 end
 if (screen == items) then
 
 end
 if (screen == mobs) then
 
 end
 if (screen == terrain) then
 
 end
end

function on.paint(gc)
    myGC = gc
    paint[screen](gc)
    timer.start(1)
end

function on.mouseDown(x, y)
    mouseX = x
    mouseY= y
    checkSelection()
end

--Screen painting
function on.escapeKey()
    if (screen == main) then
        screen = title
    elseif (screen ~= title) then
        screen = main
    end
end
function on.enterKey()
    if (screen == title) then
        screen = main
    end
end
--Title screen.
paint[title] = function(gc)
    gc:setFont("serif", "bi", 12)
    drawXCenteredString("Minecraft Encyclopedia", height*0.05)
end
--Main screen.    
paint[main] = function(gc)
    gc:setFont("serif", "bi", 12)
    drawXCenteredString("Minecraft Encyclopedia", height*0.05)
    imgX=width*0.20
    imgY=height*0.30
    gc:drawImage(SectionBlocks,imgX, imgY)
    imgX=width*0.40
    gc:drawImage(SectionItems, imgX, imgY)
    timer.start(1)
end
--Blocks screen
paint[blocks] = function(gc)
    gc:setFont("serif", "bi", 12)
    drawXCenteredString("Blocks Section", height*0.01, "top")
    gc:drawRect(0,0, width, height*0.1)
    timer.start(1)
end
--Items screen
paint[items] = function(gc)
    gc:setFont("serif", "bi", 12)
    drawXCenteredString("Items Section", height*0.01, "top")
    gc:drawRect(0,0, width, height*0.1)
    refresh()
end

Screenshots:
How it's supposed to be:
http://imgur.com/WB3ah
How it looks on startup:
http://imgur.com/GR4pC
« Last Edit: October 07, 2012, 10:18:37 am by ElementCoder »

Some people need a high five in the face... with a chair.
~EC

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Screen trouble on startup
« Reply #1 on: September 27, 2012, 05:07:01 pm »
Uh, let me reply quickly (I believe I'll have time to reply more deeply later) :
I see you're using BetterLuaAPI (:D), however it's been updated in FormulaPro (maybe I forgot to update it on its repo :o), and here's the new version, using a good gc :

Code: [Select]

a_acute = string.uchar(225)
a_circ  = string.uchar(226)
a_tilde = string.uchar(227)
a_diaer = string.uchar(228)
a_ring  = string.uchar(229)
e_acute = string.uchar(233)
e_grave = string.uchar(232)
o_acute = string.uchar(243)
o_circ  = string.uchar(244)
l_alpha = string.uchar(945)
l_beta = string.uchar(946)
l_omega = string.uchar(2126)
sup_plus = string.uchar(8314)
sup_minus = string.uchar(8315)
right_arrow = string.uchar(8594)


Color = {
["black"] = {0, 0, 0},
["red"] = {255, 0, 0},
["green"] = {0, 255, 0},
["blue "] = {0, 0, 255},
["white"] = {255, 255, 255},
["brown"] = {165,42,42},
["cyan"] = {0,255,255},
["darkblue"] = {0,0,139},
["darkred"] = {139,0,0},
["fuchsia"] = {255,0,255},
["gold"] = {255,215,0},
["gray"] = {127,127,127},
["grey"] = {127,127,127},
["lightblue"] = {173,216,230},
["lightgreen"] = {144,238,144},
["magenta"] = {255,0,255},
["maroon"] = {128,0,0},
["navyblue"] = {159,175,223},
["orange"] = {255,165,0},
["palegreen"] = {152,251,152},
["pink"] = {255,192,203},
["purple"] = {128,0,128},
["royalblue"] = {65,105,225},
["salmon"] = {250,128,114},
["seagreen"] = {46,139,87},
["silver"] = {192,192,192},
["turquoise"] = {64,224,208},
["violet"] = {238,130,238},
["yellow"] = {255,255,0}
}
Color.mt = {__index = function () return {0,0,0} end}
setmetatable(Color,Color.mt)

function copyTable(t)
  local t2 = {}
  for k,v in pairs(t) do
    t2[k] = v
  end
  return t2
end

function deepcopy(t) -- This function recursively copies a table's contents, and ensures that metatables are preserved. That is, it will correctly clone a pure Lua object.
if type(t) ~= 'table' then return t end
local mt = getmetatable(t)
local res = {}
for k,v in pairs(t) do
if type(v) == 'table' then
v = deepcopy(v)
end
res[k] = v
end
setmetatable(res,mt)
return res
end -- from http://snippets.luacode.org/snippets/Deep_copy_of_a_Lua_Table_2

function utf8(nbr)
return string.uchar(nbr)
end

function test(arg)
return arg and 1 or 0
end

function screenRefresh()
return platform.window:invalidate()
end

function pww()
return platform.window:width()
end

function pwh()
return platform.window:height()
end

function drawPoint(gc, x, y)
gc:fillRect(x, y, 1, 1)
end

function drawCircle(gc, x, y, diameter)
gc:drawArc(x - diameter/2, y - diameter/2, diameter,diameter,0,360)
end

function drawCenteredString(gc, str)
gc:drawString(str, .5*(pww() - gc:getStringWidth(str)), .5*pwh(), "middle")
end

function drawXCenteredString(gc, str, y)
gc:drawString(str, .5*(pww() - gc:getStringWidth(str)), y, "top")
end

function setColor(gc,theColor)
if type(theColor) == "string" then
theColor = string.lower(theColor)
if type(Color[theColor]) == "table" then gc:setColorRGB(unpack(Color[theColor])) end
elseif type(theColor) == "table" then
gc:setColorRGB(unpack(theColor))
end
end

function verticalBar(gc,x)
gc:fillRect(gc,x,0,1,pwh())
end

function horizontalBar(gc,y)
gc:fillRect(gc,0,y,pww(),1)
end

function nativeBar(gc, screen, y)
gc:setColorRGB(128,128,128)
gc:fillRect(screen.x+5, screen.y+y, screen.w-10, 2)
end

function drawSquare(gc,x,y,l)
gc:drawPolyLine(gc,{(x-l/2),(y-l/2), (x+l/2),(y-l/2), (x+l/2),(y+l/2), (x-l/2),(y+l/2), (x-l/2),(y-l/2)})
end

function drawRoundRect(gc,x,y,wd,ht,rd)  -- wd = width, ht = height, rd = radius of the rounded corner
x = x-wd/2  -- let the center of the square be the origin (x coord)
y = y-ht/2 -- same for y coord
if rd > ht/2 then rd = ht/2 end -- avoid drawing cool but unexpected shapes. This will draw a circle (max rd)
gc:drawLine(x + rd, y, x + wd - (rd), y);
gc:drawArc(x + wd - (rd*2), y + ht - (rd*2), rd*2, rd*2, 270, 90);
gc:drawLine(x + wd, y + rd, x + wd, y + ht - (rd));
gc:drawArc(x + wd - (rd*2), y, rd*2, rd*2,0,90);
gc:drawLine(x + wd - (rd), y + ht, x + rd, y + ht);
gc:drawArc(x, y, rd*2, rd*2, 90, 90);
gc:drawLine(x, y + ht - (rd), x, y + rd);
gc:drawArc(x, y + ht - (rd*2), rd*2, rd*2, 180, 90);
end

function fillRoundRect(gc,x,y,wd,ht,radius)  -- wd = width and ht = height -- renders badly when transparency (alpha) is not at maximum >< will re-code later
if radius > ht/2 then radius = ht/2 end -- avoid drawing cool but unexpected shapes. This will draw a circle (max radius)
    gc:fillPolygon({(x-wd/2),(y-ht/2+radius), (x+wd/2),(y-ht/2+radius), (x+wd/2),(y+ht/2-radius), (x-wd/2),(y+ht/2-radius), (x-wd/2),(y-ht/2+radius)})
    gc:fillPolygon({(x-wd/2-radius+1),(y-ht/2), (x+wd/2-radius+1),(y-ht/2), (x+wd/2-radius+1),(y+ht/2), (x-wd/2+radius),(y+ht/2), (x-wd/2+radius),(y-ht/2)})
    x = x-wd/2  -- let the center of the square be the origin (x coord)
y = y-ht/2 -- same
gc:fillArc(x + wd - (radius*2), y + ht - (radius*2), radius*2, radius*2, 1, -91);
    gc:fillArc(x + wd - (radius*2), y, radius*2, radius*2,-2,91);
    gc:fillArc(x, y, radius*2, radius*2, 85, 95);
    gc:fillArc(x, y + ht - (radius*2), radius*2, radius*2, 180, 95);
end

The main difference, again, is about the gc usage.
Passing gc to the functions is the *only* way to do things well :)


I'll get back to your main problem soon (also calling jim :P)
« Last Edit: September 27, 2012, 05:27:00 pm by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Screen trouble on startup
« Reply #2 on: September 27, 2012, 05:25:02 pm »
At the time that you call platform.window:height() / width() the window hasn't initialized yet, resulting in both functions returning 0. To fix this add this to your code:
Code: [Select]
function on.resize(w, h) width, height = w, h end
« Last Edit: September 27, 2012, 05:25:16 pm by Jim Bauwens »

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: Screen trouble on startup
« Reply #3 on: September 28, 2012, 10:25:34 am »
@adriweb: Thanks for poiting to it, to be honest I haven't checked for updates in a long time :P. I just found this copy on my old harddrive, and used it :) I'm now using the updated version :D
[edit] it gives me an error: attempt to call method 'getStringWidth' (a nil value) nvm, it works now. Forgot to pass gc to it.

@Jim: Thanks, that fixed the problem! You really know pretty much everything about nspire lua it seems :)
« Last Edit: September 28, 2012, 11:17:19 am by ElementCoder »

Some people need a high five in the face... with a chair.
~EC

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Screen trouble on startup
« Reply #4 on: September 28, 2012, 02:59:11 pm »
I've studied my share of it ;)

Also, there are much more secrets to Nspire Lua than many people think. But it takes some effort to find them. But when you find then, you can do magicz.

Offline ElementCoder

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 611
  • Rating: +42/-2
    • View Profile
Re: Screen trouble
« Reply #5 on: October 07, 2012, 10:24:28 am »
Now I'm having a different problem (or maybe I'm trying to do something that can't be done):
Code: [Select]
function on.paint(gc)
 if screenNeedUpdate then
     for i=1,2 do
         for ii=1,5,1 do
             tile = string.sub(map[i], ii, ii)
             if tile == "G" then
                 gc:drawImage(tileGrass, tileGrass:width()*ii, tileGrass:height()*i )
             end
             if tile == "W" then
                 gc:drawImage(tileWater, tileWater:width()*ii, tileWater:height()*i)
             end
         end
     end
     refreshScreen()
     screenNeedUpdate = false
 end
end
What I want to do is only update the screen when it is necesarry. I wanted to do this by setting a flag, screenNeedUpdate, with the idea being when this flag is true, that piece of code is executed and if not it isn't. The problem is,when I set the flag to true it paints everything but when set to false everything but on tile in the upper left corner disappears as soon as another key (or anything) happens.
[edit] they all disappear, the one staying there was because of wrongly placed code :P
[edit2] solved
« Last Edit: October 07, 2012, 10:54:16 am by ElementCoder »

Some people need a high five in the face... with a chair.
~EC