Trouble with gamewindow

tinmanjo

Member
Licensed User
Im having trouble understanding why the game window wont display the backdrop image.

B4X:
Sub App_Start
  centx=form1.Width/2
  centy=form1.Height/2
 Form1.Show
 flb.New1("form1",B4pobject(1))
 addbutton("form1","btn",centx-25,centy,50,50,"close")
 addevent("btn",click,"btn_click")
 btnm.text="still"
 gw.New1("form1",0,0,form1.width,form1.Height)
 gw.DrawBackgroundImage(appPath & "\Backdrop.jpg")
 gw.SetTransparentColor1(cBlack)
 myspr.New2(AppPath & "\block.bmp",1,30,30,1)
 myspr.X=100
 myspr.Y=100
 myspr.IsActive=true
gw.SpriteAdd(myspr.Value)

msgbox(appPath)
flb.FullScreen(cPPC)
End Sub

This does contain a gw.tick in timer1 sub.

Is the the formlib compatible with sprite.dll

all I get is a white blank window covering the main form plus the button ive created.
 
Last edited:

tinmanjo

Member
Licensed User
:sign0104:

the tick wasnt working because timer.interval was 0

so basically you need a gw.tick with at least an interval for is to work.
 

tinmanjo

Member
Licensed User
something else I'm having issue with is focus with the game window, when I click a form1 button the gw looses focus, how can I get back focus to game window?

Or is there another way i can display images and move them about similar, the problem i had in imagelib was there is no way of setting a small image to x,y location and move it around like a sprite. Dose anyone know of a better way than the sprite library.
 
Last edited:

klaus

Expert
Licensed User
Longtime User
You shouldn't have trouble when clicking on a button on the form.

Do you use a Timer to call GameWindow.Tick ?
As long as Timer.Enabled=True and GameWindow.Tick is called it works.
There is no Focus parameter for GameWindow.

You should post your project so we could have a closer look it and see what happens.

With the ImageLibEx you can draw small images onto the foreground of a form, erase it and redraw it on another place.

Best regards.
 

tinmanjo

Member
Licensed User
Do you use a Timer to call GameWindow.Tick ?
As long as Timer.Enabled=True and GameWindow.Tick is called it works.
There is no Focus parameter for GameWindow.

Yes i put the gw.tick() in the timer procedure.

if there is not focus for gw, then how do i switch between the buttons on the form and the gw, i have a game window which is the main player screen and a quit button at the bottom plus a some arrow buttons for general movement, but as soon as the main form or buttons has focus then the gw cease to work.
 

klaus

Expert
Licensed User
Longtime User
Can you post your code, so we can have a look at it to see what happens.
What are you doing with the movement buttons ?
I had added a Button and a TextBox in the small sprite program I posted here, post #8, http://www.b4x.com/forum/questions-help-needed/5039-making-game-b4ppc.html with no problem when clicking on the Button or click in the TextBox. The display in the GameWindow is triggered by GameWindow.Tick.

Best regards.
 
Top