I’m making a simple game in Android Studio, my intention is to create a class that extends SurfaceView, then create a Canvas to the size of the game (not the phone screen) and then scale this Canvas up to the actual size of the screen and then render it on my custom view.
So, I’ve done the follwing;
gameBitmap = Bitmap.createBitmap(800, 450, Bitmap.Config.ARGB_8888); //16:9 gameCanvas = new Canvas(gameBitmap);
Now, this class implements runnable so I have a simple game loop which updates entities and then paints to this gameCanvas instance.
Then I scale this gameCanvas to the size of the phone screen I am using.
Now what I want to do is paint this scaled canvas to the Canvas from the SurfaceView, such as;
Now, I’ve looked at the Javadocs and can’t find a method that could accomplish this (as paint(Canvas) isn’t actually a method).
Is there a way to do this? Or to replace the visible canvas each time I call my rendering method?
I know there are probably easier ways to accomplish this but I’d like to try and do it my way if possible.