clean up graphics
Some checks failed
Build and Deploy / build-linux (push) Failing after 1m32s
Build and Deploy / build-macos (push) Failing after 7s
Build and Deploy / build-windows (CLANG64) (push) Has been cancelled
Build and Deploy / package-dist (push) Has been cancelled
Build and Deploy / deploy-itch (push) Has been cancelled
Build and Deploy / deploy-gitea (push) Has been cancelled

This commit is contained in:
2025-05-22 01:28:03 -05:00
parent f5ee3aada6
commit 7bab2f1b7a
4 changed files with 10 additions and 39 deletions

View File

@@ -262,9 +262,12 @@ function drawPieces() {
}
}
var graphics = use('graphics')
prosperon.on('draw', function() {
drawBoard()
drawPieces()
draw2d.text("HELL", [100,100])
})
prosperon.on('key_down', function(e) {
@@ -317,7 +320,7 @@ function joinServer() {
}
$_.contact(contact_fn, {
address: "localhost",
address: "192.168.0.149",
port: 5678
});
}

View File

@@ -11,7 +11,6 @@ var os = use('os')
$_.receiver(e => {
if (e.type === "subscribe") {
if (!e.actor) throw Error('Got a subscribe message with no actor.');
console.log('subscribing: ' + json.encode(e.actor))
subscribers.push(e.actor)
return;
}

View File

@@ -419,33 +419,6 @@ draw.image = function image(image, rect = [0,0], rotation = 0, anchor = [0,0], s
render.image(image, rect, rotation, anchor, shear, info)
}
draw.images = function images(image, rects, config) {
if (!image) throw Error('Need an image to render.')
if (typeof image === "string") image = graphics.texture(image)
var bb = []
bb.width = image.texture.width
bb.height = image.texture.height
var sprites = []
for (var rect of rects) {
rect.__proto__ = bb
var sprite = graphics.make_sprite()
sprite.set_rect(rect)
sprite.set_image(image)
sprites.push(sprite)
}
var cmds = graphics.make_sprite_queue(sprites, prosperon.camera, undefined)
for (var i = 0; i < cmds.length; i++)
render.queue(cmds[i])
return sprites
}
draw.images[prosperon.DOC] = `
:param image: An image object or string path to a texture.
:param rects: An array of rectangle objects ({x, y, width, height}) to draw.
:param config: (Unused) Additional config data if needed.
:return: An array of sprite objects created and queued for rendering.
:raises Error: If no image is provided.
`
function software_circle(pos, radius)
{
if (radius <= 0) return // nothing to draw
@@ -486,15 +459,8 @@ var sysfont = graphics.get_font('fonts/c64.ttf', 8)
draw.text = function text(text, rect, font = sysfont, size = 0, color = Color.white, wrap = 0, pipeline) {
if (typeof font === 'string') font = graphics.get_font(font)
var mesh = graphics.make_text_buffer(text, rect, 0, color, wrap, font)
render.queue({
type: 'geometry',
mesh,
image: font,
texture: font.texture,
pipeline,
first_index:0,
num_indices:mesh.num_indices
})
console.log(json.encode(mesh))
render.geometry(font, mesh)
}
draw.text[prosperon.DOC] = `
:param text: The string to draw.

View File

@@ -308,6 +308,9 @@ graphics.get_font = function get_font(path, size) {
var font = graphics.make_font(data,size)
font.texture = render.load_texture(font.surface)
console.log('loaded font texture')
console.log(json.encode(font.texture))
fontcache[fontstr] = font
return font