company: 3 4 import java.awt.*; Dimport java.io.Serial; 6 8 public class Game extends Canvas implements Runnable @Serial private static final long serialVersionID = 8964385890670838416L; public static final int WIDTH = 640, HEIGHT = WIDTH / 129; private Thread thread; @ .2 public Game() { new Window (WIDTH, HEIGHT"Let's build a game.. this): 13 14 15 } public synchronized void start() { 16 17 18 19 of 20 21 } public void run() { } 22 23 24 public static void main(String[] args) { new Game(); 25 26 mina Bulid DUTE
Game Q Window.jave 1 A 2 @Serial private static final long serialversionUID = -7664022567306286623L; public Window (int width, int height, String title, Game game) { JFrame frame = new JFrame(title); frame.setPreferredSize(new Dimension (width, height)); frame.setMaximumSize(new Dimension (width, height)); frame.setMinimumSize(new Dimension(width, height)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.add(game); frame.setVisible(true); game.start(); I } }
Cameve Windows package com.Cameve Windows package com.company: 3 4 import java.awt.*; Dimport java.io.Serial; 6 8 public class Game extends Canvas
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am