Loading .idea/deploymentTargetDropDown.xmldeleted 100644 → 0 +0 −17 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="deploymentTargetDropDown"> <runningDeviceTargetSelectedWithDropDown> <Target> <type value="RUNNING_DEVICE_TARGET" /> <deviceKey> <Key> <type value="SERIAL_NUMBER" /> <value value="R58N80QYJBZ" /> </Key> </deviceKey> </Target> </runningDeviceTargetSelectedWithDropDown> <timeTargetWasSelectedWithDropDown value="2023-04-25T02:38:44.600479Z" /> </component> </project> No newline at end of file app/src/main/java/com/example/game2d/Game.java +11 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ package com.example.game2d; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.util.Log; Loading @@ -22,6 +24,7 @@ Game manages all objects in the game and is responsible for updating all states and rendering all objects to the screen. */ public class Game extends SurfaceView implements SurfaceHolder.Callback { Bitmap background; private final Joystick joystick; private final Player player; private final Detector detector1; Loading @@ -40,12 +43,17 @@ public class Game extends SurfaceView implements SurfaceHolder.Callback { // new gameloop object gameLoop = new GameLoop(this, surfaceHolder); // check screen height and width int height = getScreenHeight(); int width = getScreenWidth(); Log.d("DIMENSION", String.valueOf(height)); Log.d("DIMENSION", String.valueOf(width)); // Set background Bitmap original = BitmapFactory.decodeResource(context.getResources(), R.drawable.classroom_menu); background = Bitmap.createScaledBitmap(original, width, height, false); // Initialize game objects // initialize joystick int joystickX = 150; Loading Loading @@ -114,6 +122,9 @@ public class Game extends SurfaceView implements SurfaceHolder.Callback { super.draw(canvas); drawUPS(canvas); drawFPS(canvas); // draw background Paint paint = new Paint(); canvas.drawBitmap(background, 0, 0, paint); // draw joystick joystick.draw(canvas); // draw player Loading Loading
.idea/deploymentTargetDropDown.xmldeleted 100644 → 0 +0 −17 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="deploymentTargetDropDown"> <runningDeviceTargetSelectedWithDropDown> <Target> <type value="RUNNING_DEVICE_TARGET" /> <deviceKey> <Key> <type value="SERIAL_NUMBER" /> <value value="R58N80QYJBZ" /> </Key> </deviceKey> </Target> </runningDeviceTargetSelectedWithDropDown> <timeTargetWasSelectedWithDropDown value="2023-04-25T02:38:44.600479Z" /> </component> </project> No newline at end of file
app/src/main/java/com/example/game2d/Game.java +11 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ package com.example.game2d; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.util.Log; Loading @@ -22,6 +24,7 @@ Game manages all objects in the game and is responsible for updating all states and rendering all objects to the screen. */ public class Game extends SurfaceView implements SurfaceHolder.Callback { Bitmap background; private final Joystick joystick; private final Player player; private final Detector detector1; Loading @@ -40,12 +43,17 @@ public class Game extends SurfaceView implements SurfaceHolder.Callback { // new gameloop object gameLoop = new GameLoop(this, surfaceHolder); // check screen height and width int height = getScreenHeight(); int width = getScreenWidth(); Log.d("DIMENSION", String.valueOf(height)); Log.d("DIMENSION", String.valueOf(width)); // Set background Bitmap original = BitmapFactory.decodeResource(context.getResources(), R.drawable.classroom_menu); background = Bitmap.createScaledBitmap(original, width, height, false); // Initialize game objects // initialize joystick int joystickX = 150; Loading Loading @@ -114,6 +122,9 @@ public class Game extends SurfaceView implements SurfaceHolder.Callback { super.draw(canvas); drawUPS(canvas); drawFPS(canvas); // draw background Paint paint = new Paint(); canvas.drawBitmap(background, 0, 0, paint); // draw joystick joystick.draw(canvas); // draw player Loading