From 34faed4b450f60c7db445575bc5ad2070bb68538 Mon Sep 17 00:00:00 2001 From: Ian C Date: Fri, 12 Oct 2007 23:31:52 +0000 Subject: Updates for newer modules and bmax --- designer.bmx | 18 ++++++++---------- game.bmx | 30 +++++++++++++++--------------- main.bmx | 37 ++++++++++++++++++------------------- menu.bmx | 2 +- 4 files changed, 42 insertions(+), 45 deletions(-) diff --git a/designer.bmx b/designer.bmx index ff7db2f..b7d6f50 100644 --- a/designer.bmx +++ b/designer.bmx @@ -217,13 +217,13 @@ Type TDesShip Extends TDesObj End Method Method MouseOver:Int(x:Int, y:Int) - Return InSelBox(x,y,self.x,self.y) + Return InSelBox(x,y,Self.x,Self.y) End Method Method Drag(x:Int, y:Int) DrawCoord(x,y) - self.x=x - self.y=y + Self.x=x + Self.y=y End Method Method Edit() @@ -727,7 +727,7 @@ Function DoDesigner() sel.Drag(x,y) EndIf - If KeyHit(KEY_MOUSERIGHT) + If MouseDown(2) If sel<>Null If sel.removable Select GUIMenu("Object Menu",["Edit","Snap to grid","Delete"],x,y,GameGFX.pointer) @@ -760,11 +760,11 @@ Function DoDesigner() EndIf If Not drag - If KeyDown(KEY_MOUSELEFT) And sel<>Null + If MouseDown(1) And sel<>Null drag=True EndIf Else - If Not KeyDown(KEY_MOUSELEFT) + If Not MouseDown(1) drag=False EndIf EndIf @@ -773,7 +773,6 @@ Function DoDesigner() DrawImage(GameGFX.pointer,MouseX(),MouseY()) Flip - FlushMem Wend End Function @@ -811,7 +810,6 @@ Function TestCallback(w:TWidget) While res<>TGame.LEVEL_FINISHED And res<>TGame.LEVEL_CANCELLED Cls res=g.Play() - FlushMem Flip Wend @@ -866,8 +864,8 @@ End Function Function LoadCallback(w:TWidget) Try If GUIYesNo("Overwrite current level set?",GameGFX.pointer) - Local load:TLevelSet=TLevelSet.Load(Designer.fname_txt.text) - Designer.levelset=load + Local Load:TLevelSet=TLevelSet.Load(Designer.fname_txt.text) + Designer.levelset=Load Designer.levelindex=0 Designer.levnum.maxval=Designer.levelset.level.Count()-1 Designer.levnum.value=0 diff --git a/game.bmx b/game.bmx index fb0ada3..6dea787 100644 --- a/game.bmx +++ b/game.bmx @@ -103,7 +103,7 @@ Type TGame SetColor(255,col,col) DrawLine(x,y,lx,ly) - GameGFX.smallfont.DrawColoured(s,tx,ty+2,255,col,col) + GameGFX.smallfont.Draw(s,tx,ty+2,255,col,col) End Method Method Intro() @@ -122,10 +122,10 @@ Type TGame SetScale(2,2) - GameGFX.font.CentreColoured(level.name,y,col,col,255-col) + GameGFX.font.Centre(level.name,y,col,col,255-col) y:+yi - GameGFX.font.CentreColoured("Need "+level.winpercent+"% to clear",y,col/2,col,col) + GameGFX.font.Centre("Need "+level.winpercent+"% to clear",y,col/2,col,col) y:+yi Local n:Int=Int(level.shipmass) @@ -136,18 +136,18 @@ Type TGame w=-w EndIf - GameGFX.font.CentreColoured("Your ship has a mass of " + n + " Newtons",y,col/2,col,col) + GameGFX.font.Centre("Your ship has a mass of " + n + " Newtons",y,col/2,col,col) y:+yi If level.maxwave>1 - GameGFX.font.CentreColoured("You can fire "+level.maxwave+" Gravity Waves of " + w + " Newtons",y,col/2,col,col) + GameGFX.font.Centre("You can fire "+level.maxwave+" Gravity Waves of " + w + " Newtons",y,col/2,col,col) ElseIf level.maxwave=1 - GameGFX.font.CentreColoured("You can fire 1 Gravity Wave of " + w + " Newtons",y,col/2,col,col) + GameGFX.font.Centre("You can fire 1 Gravity Wave of " + w + " Newtons",y,col/2,col,col) EndIf y:+yi If level.wrap - GameGFX.font.CentreColoured("THE UNIVERSE IS WARPED!",y,col,col/2,col/2) + GameGFX.font.Centre("THE UNIVERSE IS WARPED!",y,col,col/2,col/2) y:+yi EndIf @@ -276,14 +276,14 @@ Type TGame EndIf GameGFX.font.Draw("PARTICLES",0,0) - GameGFX.font.DrawColoured(num-captured-lost,txtoff[0]+10,0,255,255,0) + GameGFX.font.Draw(num-captured-lost,txtoff[0]+10,0,255,255,0) GameGFX.font.Draw("CAPTURED",200,0) If percent10 GameGFX.font.Draw(timer,txtoff[2]+610,0) Else - GameGFX.font.DrawColoured(timer,txtoff[2]+610,0,255,0,0) + GameGFX.font.Draw(timer,txtoff[2]+610,0,255,0,0) EndIf Select done @@ -338,7 +338,7 @@ Type TGame Case LEVEL_WON If final_percent=100 SetScale(4,4) - GameGFX.font.CentreColoured("PERFECT!",50,col,255-col,col/2) + GameGFX.font.Centre("PERFECT!",50,col,255-col,col/2) col:+coli If col=255 Or col=0 @@ -350,8 +350,8 @@ Type TGame SetScale(2,2) SetAlpha(0.7) - GameGFX.font.CentreColoured("LEVEL COMPLETED!",GraphicsHeight()/2+20,255,255,0) - GameGFX.font.CentreColoured("You got the pass mark with "+pass_time+" left on the clock",GraphicsHeight()/2+40,255,255,0) + GameGFX.font.Centre("LEVEL COMPLETED!",GraphicsHeight()/2+20,255,255,0) + GameGFX.font.Centre("You got the pass mark with "+pass_time+" left on the clock",GraphicsHeight()/2+40,255,255,0) GameGFX.font.Centre("Press Space",GraphicsHeight()/2+80) SetScale(1,1) SetAlpha(1) @@ -363,7 +363,7 @@ Type TGame Case LEVEL_LOST SetScale(2,2) SetAlpha(0.7) - GameGFX.font.CentreColoured("LEVEL FAILED!",GraphicsHeight()/2+20,255,64,64) + GameGFX.font.Centre("LEVEL FAILED!",GraphicsHeight()/2+20,255,64,64) GameGFX.font.Centre("Press Space",GraphicsHeight()/2+60) SetScale(1,1) SetAlpha(1) diff --git a/main.bmx b/main.bmx index e44f596..2baf5a8 100644 --- a/main.bmx +++ b/main.bmx @@ -89,7 +89,7 @@ SetImageHandle(GameGFX.shock,3,3) TPoint.img=GameGFX.point TParticle.img=GameGFX.particle -TGUIFont.font=GameGFX.font +TSGUIFont.font=GameGFX.font Lookup.Init() TParticleMachine.Init() @@ -146,13 +146,13 @@ Function Error(s:String, fatal:Int=False) While Not KeyHit(KEY_ESCAPE) Cls - GameGFX.font.CentreColoured(s,GraphicsHeight()/4,255,255*f,255*f) + GameGFX.font.Centre(s,GraphicsHeight()/4,255,255*f,255*f) If fatal - GameGFX.font.CentreColoured("FATAL ERROR",0,255,255,255) - GameGFX.font.CentreColoured("Press ESCAPE to exit",GraphicsHeight()/4*3,255,255,255) + GameGFX.font.Centre("FATAL ERROR",0,255,255,255) + GameGFX.font.Centre("Press ESCAPE to exit",GraphicsHeight()/4*3,255,255,255) Else - GameGFX.font.CentreColoured("Press ESCAPE",GraphicsHeight()/4*3,255,255,255) + GameGFX.font.Centre("Press ESCAPE",GraphicsHeight()/4*3,255,255,255) EndIf t:+1 @@ -240,16 +240,16 @@ Function Menu() GameGFX.font.Centre("DEFINE KEYS",50) EndIf - GameGFX.font.DrawColoured("Left",250,100,255,255*(defkey=1),0) - GameGFX.font.DrawColoured("Right",250,120,255,255*(defkey=2),0) - GameGFX.font.DrawColoured("Thrust",250,140,255,255*(defkey=3),0) - GameGFX.font.DrawColoured("Reverse",250,160,255,255*(defkey=4),0) - GameGFX.font.DrawColoured("Gravity Wave",250,180,255,255*(defkey=5),0) - GameGFX.font.DrawColoured(KeySym(GameConfig.kleft),500,100,255,255*(defkey=1),0) - GameGFX.font.DrawColoured(KeySym(GameConfig.kright),500,120,255,255*(defkey=2),0) - GameGFX.font.DrawColoured(KeySym(GameConfig.kthrust),500,140,255,255*(defkey=3),0) - GameGFX.font.DrawColoured(KeySym(GameConfig.kreverse),500,160,255,255*(defkey=4),0) - GameGFX.font.DrawColoured(KeySym(GameConfig.kblast),500,180,255,255*(defkey=5),0) + GameGFX.font.Draw("Left",250,100,255,255*(defkey=1),0) + GameGFX.font.Draw("Right",250,120,255,255*(defkey=2),0) + GameGFX.font.Draw("Thrust",250,140,255,255*(defkey=3),0) + GameGFX.font.Draw("Reverse",250,160,255,255*(defkey=4),0) + GameGFX.font.Draw("Gravity Wave",250,180,255,255*(defkey=5),0) + GameGFX.font.Draw(KeySym(GameConfig.kleft),500,100,255,255*(defkey=1),0) + GameGFX.font.Draw(KeySym(GameConfig.kright),500,120,255,255*(defkey=2),0) + GameGFX.font.Draw(KeySym(GameConfig.kthrust),500,140,255,255*(defkey=3),0) + GameGFX.font.Draw(KeySym(GameConfig.kreverse),500,160,255,255*(defkey=4),0) + GameGFX.font.Draw(KeySym(GameConfig.kblast),500,180,255,255*(defkey=5),0) Local k:Int=0 @@ -318,20 +318,19 @@ Function Menu() End Select SetScale(2,2) - GameGFX.font.CentreColoured("PARTICLE PINCH",0,255,255,0) + GameGFX.font.Centre("PARTICLE PINCH",0,255,255,0) If defkey=0 - GameGFX.font.CentreColoured("Start Level",528,0,255,255) + GameGFX.font.Centre("Start Level",528,0,255,255) GameGFX.font.Centre(levelset.Get(selected_level).name,547) EndIf SetScale(1,1) - GameGFX.font.CentreColoured("Copyright (c) 2005 Ian Cowburn",20,255,0,0) + GameGFX.font.Centre("Copyright (c) 2005 Ian Cowburn",20,255,0,0) SetColor(255,255,255) DrawImage(GameGFX.pointer,MouseX(),MouseY()) Flip - FlushMem Wend End Function \ No newline at end of file diff --git a/menu.bmx b/menu.bmx index eea7aed..4f74595 100644 --- a/menu.bmx +++ b/menu.bmx @@ -53,7 +53,7 @@ Type TMenu If opt.InBox(mx,my) SetColor(255,255,255) - If KeyDown(KEY_MOUSELEFT) + If MouseDown(1) mbdown=True DrawImage(opt.i,opt.x,opt.y+2) any=True -- cgit v1.2.3