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
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:
@@ -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,14 +320,14 @@ function joinServer() {
|
||||
}
|
||||
|
||||
$_.contact(contact_fn, {
|
||||
address: "localhost",
|
||||
address: "192.168.0.149",
|
||||
port: 5678
|
||||
});
|
||||
}
|
||||
|
||||
var os = use('os')
|
||||
|
||||
// Set up IO actor subscription
|
||||
// Set up IO actor subscription
|
||||
var ioguy = {
|
||||
__ACTORDATA__: {
|
||||
id: os.ioactor()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user