Hi Leo, to answer your questions:
- No it doesn't need Max GUI. Event-based input is standard in BMax, it doesn't need Max GUI :-)
- As for modules. I haven't told it which ones to load or not load, it simply uses whatever BMax chucks in as default (not very efficient I know) but you should be able to slim this down using the Framework keyword as long as you don't remove modules that my code uses...
- OK, there are 3 "framerates" to consider: 1) The screen refresh rate. In windowed mode this is the desktop Hz, and in full-screen it's 60 unless you change it. The refresh rate of the screen will not affect the game speed in any way. 2) The logic framerate, set to 200FPS for very smooth logic and mechanics etc. 3) the framerate you choose for your animations is independant of the other two. In fact there is even a TAnimation Type. Basically you setup a counter and a target in milliseconds that you adjust each logic frame by a delta amount, and when you draw your animated sprite you simply choose the appropriate frame depending on how far along the counter has got from 0 to the target millisecs. There are functions to do this for you and also examples. For example, when the counter is at 0, frame 0 is display, when the counter is halfway to the target, the middle frame is played etc. It's all specially worked out so that each frame displays for the correct amount of time. If you wanted to display some frames for longer, there are various techniques for doing this, the simplist being to build a list of frames to show from a possible list, and showing the same frame twice etc.
- Here's how easy it is to make a new screen:
Here's how to make an error dialog in your prefered style:
Here's a simple type to look at:
I hope this information helps. Have you tried the demo yet?
- No it doesn't need Max GUI. Event-based input is standard in BMax, it doesn't need Max GUI :-)
- As for modules. I haven't told it which ones to load or not load, it simply uses whatever BMax chucks in as default (not very efficient I know) but you should be able to slim this down using the Framework keyword as long as you don't remove modules that my code uses...
- OK, there are 3 "framerates" to consider: 1) The screen refresh rate. In windowed mode this is the desktop Hz, and in full-screen it's 60 unless you change it. The refresh rate of the screen will not affect the game speed in any way. 2) The logic framerate, set to 200FPS for very smooth logic and mechanics etc. 3) the framerate you choose for your animations is independant of the other two. In fact there is even a TAnimation Type. Basically you setup a counter and a target in milliseconds that you adjust each logic frame by a delta amount, and when you draw your animated sprite you simply choose the appropriate frame depending on how far along the counter has got from 0 to the target millisecs. There are functions to do this for you and also examples. For example, when the counter is at 0, frame 0 is display, when the counter is halfway to the target, the middle frame is played etc. It's all specially worked out so that each frame displays for the correct amount of time. If you wanted to display some frames for longer, there are various techniques for doing this, the simplist being to build a list of frames to show from a possible list, and showing the same frame twice etc.
- Here's how easy it is to make a new screen:
Type TCreditsScreen Extends TScreen Method Load() name = "credits" 'no loading text as it will be quick 'leave title screen music playing Menu = TMenu.Create("buttonMO", "buttonclick",0,0,0) OKButtonCreate(Menu) Game.FadeMusic = 0 'prevent music fading when escape pressed End Method Method Logic() Super.Logic() If Menu.Clicked("ok") Then Game.GameFade.Init(FADE_SPEED,1,Null, True) Game.DestinationTScreen = OptionsScreen EndIf EndMethod Method Draw() Cls SetImageFont(MainFont) ccDrawTextCentre("Credits", 10) ccDrawTextCentre("AOTMG", 240) ccDrawTextCentre("by Jake Birkett", 270) ccDrawTextCentre("(this will scroll soon)", 300) Menu.Draw() End Method Method SetEscDestination() 'overridden Game.DestinationTScreen = OptionsScreen End Method End Type
Here's how to make an error dialog in your prefered style:
Function ErrorDialog:TDialogOK(text$) 'Show an error dialog in my preferred style Local d:TDialogOK = TDialogOK.Create(text) d.Shadow = TShadow.Create(3,3,0.4) d.SetupCaption(MainFontSmall, TColor.Create(255,0,0), TShadow.Create(1,1,0.6)) d.Start() Game.FixedRateLogic.Init() 'call now in case of delay due to setup Return d End Function
Here's a simple type to look at:
Type TGameImage Field name$ 'for easy identification when stored in lists Field image:TImage Field w% 'width Field h% 'height Field w2# 'width/2 for use with MidHandle Field h2# 'height/2 for use with MidHandle Function Create:TGameImage(file$) 'file is full path Local gi:TGameImage = New TGameImage gi.Load(file) gi.MidHandle(True) Return gi End Function Method GetSize() 'sets w and h based on the current image If image <> Null Then w = ImageWidth(image) h = ImageHeight(image) w2 = w/2 h2 = h/2 EndIf End Method Method Load(file$, flags=-1) 'file should should be full path inc. extension name$ = Upper(StripAll(file)) 'store uppercase for ease of searching Image = ccLoadBitmap(file, flags) 'set the width and height GetSize() End Method Method LoadAnim(file$,w,h,start,total,flags=-1) 'file should should be full path inc. extension name$ = Upper(StripAll(file)) 'store uppercase for ease of searching Image = ccLoadAnimBitmap(file,w,h,start,total,flags) 'set the width and height GetSize() End Method Method MidHandle(On%) If On Then MidHandleImage(Image) Else SetImageHandle(Image,0,0) EndIf End Method End Type
I hope this information helps. Have you tried the demo yet?