Skip to content

Commit

Permalink
cut down to only what is needed to work
Browse files Browse the repository at this point in the history
  • Loading branch information
John Owens committed Nov 5, 2024
1 parent 189a0be commit e734224
Showing 1 changed file with 2 additions and 55 deletions.
57 changes: 2 additions & 55 deletions both_webgpu/both_deno_gfx.mjs
Original file line number Diff line number Diff line change
@@ -1,61 +1,8 @@
"use strict";

import { main, getDeviceAndAdapter } from "./both.mjs";
import {
Canvas,
EventType,
PixelFormat,
Rect,
Texture,
TextureAccess,
Window,
WindowBuilder,
} from "../../../src/deno_sdl2/mod.ts";
import { main } from "./both.mjs";
import { EventType, WindowBuilder } from "../../../src/deno_sdl2/mod.ts";

class MinimumWindow {
dimensions = {
width: 800,
height: 800,
};
screenDimensions = {
width: 800,
height: 800,
};
texture;
canvas;
window;
constructor(device) {
const window = new WindowBuilder(
"Hi, Deno Minimum Window!",
this.dimensions.width,
this.dimensions.height
).build();
this.canvas = window.canvas();
this.window = window;
const creator = this.canvas.textureCreator();
this.sdl2texture = creator.createTexture(
PixelFormat.ABGR8888,
TextureAccess.Streaming,
this.dimensions.width,
this.dimensions.height
);
this.texture = this.device.createTexture({
label: "Capture",
size: this.dimensions,
format: "rgba8unorm-srgb",
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC,
});
const { padded } = getRowPadding(this.dimensions.width);
this.outputBuffer = this.device.createBuffer({
label: "Capture",
size: padded * this.dimensions.height,
usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST,
});
}
}

const { adapter, device } = await getDeviceAndAdapter(navigator);
// const minwin = new MinimumWindow(device);
const window = new WindowBuilder("Hello, Deno!", 640, 480).build();
const canvas = window.canvas();

Expand Down

0 comments on commit e734224

Please sign in to comment.