invaders: fix indention and spacing

this commits fixes invaders' indention and spacing (every \t has been
replaced by 4 spaces)
This commit is contained in:
Gregor Best 2008-10-27 16:42:02 +01:00 committed by Julien Danjou
parent 16a2eadb66
commit 2a839ad875
1 changed files with 65 additions and 44 deletions

View File

@ -63,7 +63,8 @@ local shots = { }
local enemies = { } local enemies = { }
function player.new () function player.new ()
p = wibox({ position = "floating", bg = gamedata.solidbg or "#12345600" }) p = wibox({ position = "floating",
bg = gamedata.solidbg or "#12345600" })
p:geometry({ width = 24, p:geometry({ width = 24,
height = 16, height = 16,
x = gamedata.field.x + (gamedata.field.w / 2), x = gamedata.field.x + (gamedata.field.w / 2),
@ -99,8 +100,12 @@ function player.fire()
end end
function shots.fire (x, y, color) function shots.fire (x, y, color)
local s = wibox({ position = "floating", bg = color }) local s = wibox({ position = "floating",
s:geometry({ width = 4, height = 10, x = x, y = y }) bg = color })
s:geometry({ width = 4,
height = 10,
x = x,
y = y })
s.screen = 1 s.screen = 1
for i = 1, gamedata.ammo_max do for i = 1, gamedata.ammo_max do
@ -114,8 +119,12 @@ end
function shots.fire_enemy (x, y, color) function shots.fire_enemy (x, y, color)
if gamedata.enemies.shots.fired < gamedata.enemies.shots.max then if gamedata.enemies.shots.fired < gamedata.enemies.shots.max then
gamedata.enemies.shots.fired = gamedata.enemies.shots.fired + 1 gamedata.enemies.shots.fired = gamedata.enemies.shots.fired + 1
local s = wibox({ position = "floating", bg = color }) local s = wibox({ position = "floating",
s:geometry({ width = 4, height = 10, x = x, y = y }) bg = color })
s:geometry({ width = 4,
height = 10,
x = x,
y = y })
s.screen = 1 s.screen = 1
for i = 1, gamedata.enemies.shots.max do for i = 1, gamedata.enemies.shots.max do
if not gamedata.enemies.shots[i] or gamedata.enemies.shots[i].screen == nil then if not gamedata.enemies.shots[i] or gamedata.enemies.shots[i].screen == nil then
@ -173,12 +182,15 @@ function shots.handle_enemy ()
end end
function enemies.new (t) function enemies.new (t)
e = wibox({ position = "floating", bg = gamedata.solidbg or "#12345600" }) e = wibox({ position = "floating",
e:geometry({ height = gamedata.enemies.h, width = gamedata.enemies.w, bg = gamedata.solidbg or "#12345600" })
e:geometry({ height = gamedata.enemies.h,
width = gamedata.enemies.w,
x = gamedata.field.x, x = gamedata.field.x,
y = gamedata.field.y }) y = gamedata.field.y })
e.screen = 1 e.screen = 1
w = widget({ type = "imagebox", name = "enemy"..t }) w = widget({ type = "imagebox",
name = "enemy"..t })
w.image = gamedata.enemies[t] w.image = gamedata.enemies[t]
e.widgets = w e.widgets = w
@ -379,12 +391,14 @@ function game.quit()
end end
function game.highscore_show () function game.highscore_show ()
gamedata.highscore.window:geometry({ height = 140, width = 200, gamedata.highscore.window:geometry({ height = 140,
width = 200,
x = gamedata.field.x + math.floor(gamedata.field.w / 2) - 100, x = gamedata.field.x + math.floor(gamedata.field.w / 2) - 100,
y = gamedata.field.y + math.floor(gamedata.field.h / 2) - 55 }) y = gamedata.field.y + math.floor(gamedata.field.h / 2) - 55 })
gamedata.highscore.window.screen = 1 gamedata.highscore.window.screen = 1
gamedata.highscore.table = widget({ type = "textbox", name = "highscore" }) gamedata.highscore.table = widget({ type = "textbox",
name = "highscore" })
gamedata.highscore.window.widgets = gamedata.highscore.table gamedata.highscore.window.widgets = gamedata.highscore.table
gamedata.highscore.table.text = " Highscores:\n" gamedata.highscore.table.text = " Highscores:\n"
@ -444,12 +458,14 @@ function game.highscore (score)
gamedata.highscore.window = wibox({ position = "floating", gamedata.highscore.window = wibox({ position = "floating",
bg = gamedata.btheme.bg_focus or "#333333", bg = gamedata.btheme.bg_focus or "#333333",
fg = gamedata.btheme.fg_focus or "#FFFFFF" }) fg = gamedata.btheme.fg_focus or "#FFFFFF" })
gamedata.highscore.window:geometry({ height = 20, width = 300, gamedata.highscore.window:geometry({ height = 20,
width = 300,
x = gamedata.field.x + math.floor(gamedata.field.w / 2) - 150, x = gamedata.field.x + math.floor(gamedata.field.w / 2) - 150,
y = gamedata.field.y + math.floor(gamedata.field.h / 2) }) y = gamedata.field.y + math.floor(gamedata.field.h / 2) })
gamedata.highscore.window.screen = 1 gamedata.highscore.window.screen = 1
gamedata.namebox = widget({ type = "textbox", name = "foobar" }) gamedata.namebox = widget({ type = "textbox",
name = "foobar" })
gamedata.namebox.text = " Name: |" gamedata.namebox.text = " Name: |"
gamedata.highscore.window.widgets = gamedata.namebox gamedata.highscore.window.widgets = gamedata.namebox
@ -504,10 +520,14 @@ function run(args)
y = gamedata.field.y - 15 }) y = gamedata.field.y - 15 })
gamedata.field.north.screen = 1 gamedata.field.north.screen = 1
gamedata.field.status = widget({ type = "textbox", name = "status", align = "right" }) gamedata.field.status = widget({ type = "textbox",
name = "status",
align = "right" })
gamedata.field.status.text = gamedata.score.." | "..gamedata.ammo .. " " gamedata.field.status.text = gamedata.score.." | "..gamedata.ammo .. " "
gamedata.field.caption = widget({ type = "textbox", name = "caption", align = "left" }) gamedata.field.caption = widget({ type = "textbox",
name = "caption",
align = "left" })
gamedata.field.caption.text = " Awesome Invaders" gamedata.field.caption.text = " Awesome Invaders"
gamedata.field.north.widgets = { gamedata.field.caption, gamedata.field.status } gamedata.field.north.widgets = { gamedata.field.caption, gamedata.field.status }
@ -515,7 +535,8 @@ function run(args)
gamedata.field.south = wibox({ position = "floating", gamedata.field.south = wibox({ position = "floating",
bg = gamedata.btheme.bg_focus or "#333333", bg = gamedata.btheme.bg_focus or "#333333",
fg = gamedata.btheme.fg_focus or "#FFFFFF" }) fg = gamedata.btheme.fg_focus or "#FFFFFF" })
gamedata.field.south:geometry({ width = gamedata.field.w, height = 5, gamedata.field.south:geometry({ width = gamedata.field.w,
height = 5,
x = gamedata.field.x, x = gamedata.field.x,
y = gamedata.field.y + gamedata.field.h - 5 }) y = gamedata.field.y + gamedata.field.h - 5 })
gamedata.field.south.screen = 1 gamedata.field.south.screen = 1