Z ZPaul2Fresh8 Member Licensed User Longtime User Feb 9, 2014 #1 First off, I am a beginner so go easy Now I'm going through the tutorials of the GameView library since it seems easier for a beginner when dealing with Bitmaps and such associated with game creation. Now my question deals with loading a BACKGROUND into the GameView and making it scroll. I get it to the background to show by declaring the variable in Process_Globals as so: Code: Dim space as Bitmap and then in the Activity_Create: Code: space.Initialize(File.DirAssets, "space.png") gv.SetBackgroundImage(space) Now my problem is that if I declare the variable as a bitmap instead of a BitmapData then I don't have the member SrcRect which is required to move the image and if I declare it as a BitmapData and use the following code: Code: space.Bitmap = LoadBitmap(File.DirAssets, "space.png") gv.SetBackgroundImage(space) I get an error that says the SetBackgroundImage was expecting a Bitmap but found BitmapData... OR If I use these lines I get a crash when launching Code: space.Bitmap.Initialize(File.DirAssets, "space.png") 'space.Bitmap = LoadBitmap(File.DirAssets, "space.png") <---Doesn't work either gv.SetBackgroundImage(space) Any ideas? Is there a limit to what can be initialized at once? Like I said I am really green to using GameView...
First off, I am a beginner so go easy Now I'm going through the tutorials of the GameView library since it seems easier for a beginner when dealing with Bitmaps and such associated with game creation. Now my question deals with loading a BACKGROUND into the GameView and making it scroll. I get it to the background to show by declaring the variable in Process_Globals as so: Code: Dim space as Bitmap and then in the Activity_Create: Code: space.Initialize(File.DirAssets, "space.png") gv.SetBackgroundImage(space) Now my problem is that if I declare the variable as a bitmap instead of a BitmapData then I don't have the member SrcRect which is required to move the image and if I declare it as a BitmapData and use the following code: Code: space.Bitmap = LoadBitmap(File.DirAssets, "space.png") gv.SetBackgroundImage(space) I get an error that says the SetBackgroundImage was expecting a Bitmap but found BitmapData... OR If I use these lines I get a crash when launching Code: space.Bitmap.Initialize(File.DirAssets, "space.png") 'space.Bitmap = LoadBitmap(File.DirAssets, "space.png") <---Doesn't work either gv.SetBackgroundImage(space) Any ideas? Is there a limit to what can be initialized at once? Like I said I am really green to using GameView...
stevel05 Expert Licensed User Longtime User Feb 9, 2014 #2 Setting the background image in that way will result in a static background. You should look at the related subs (CreateBackground and Timer1_Tick) in the gameviewsmiley example Upvote 0
Setting the background image in that way will result in a static background. You should look at the related subs (CreateBackground and Timer1_Tick) in the gameviewsmiley example
timwil Active Member Licensed User Longtime User Feb 13, 2015 #3 I am trying to get my head around scrolling myself. I think you need to DIM space as BitmapData I am still trying to understand the SrcRect Upvote 0
I am trying to get my head around scrolling myself. I think you need to DIM space as BitmapData I am still trying to understand the SrcRect
timwil Active Member Licensed User Longtime User Feb 14, 2015 #4 OK I have a better understanding of the SrcRect now. I have attached a project that (I hope) shows exactly what it is about. I create a tall image that is composed of six separate images with the bottom image being a copy of the top image. The SrcRect selects a sub-image from the while image to be displayed where the DestRect points to. So we are basically looking at a viewport of the whole image. Most of the image is masked and out of view - we can only see the sub-set that the SrcRect points to. Hopefully this helps. It is a step closer to my slot machine! Attachments skrollin.zip skrollin.zip 261.6 KB · Views: 565 Upvote 0
OK I have a better understanding of the SrcRect now. I have attached a project that (I hope) shows exactly what it is about. I create a tall image that is composed of six separate images with the bottom image being a copy of the top image. The SrcRect selects a sub-image from the while image to be displayed where the DestRect points to. So we are basically looking at a viewport of the whole image. Most of the image is masked and out of view - we can only see the sub-set that the SrcRect points to. Hopefully this helps. It is a step closer to my slot machine!