Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Is there any way to adjust the deck size?

A topic by MrrPalta created 37 days ago Views: 185 Replies: 3
Viewing posts 1 to 3
(+1)

Me interesaría saber si hay alguna forma de programar una función para que puedas ajustar el tamaño del Dock desde el mismo decker sin tener que cambiar el tamaño desde el código del archivo

I'd like to know if there's a way to program a function so you can adjust the Dock's size directly from the Docker container without having to change the size in the file's code

Developer (1 edit) (+1)

Currently there is not a scripting API or user interface for altering the dimensions of a deck.

Technically you could use deck.encoded, newdeck[], and danger.open[] to serialize a deck to a string, manipulate it, decode it as a deck, and switch the active document to that modified deck, but I don't recommend this.

What are you trying to do which would need to dynamically resize a deck?

(+1)

y cómo funciona todo eso?

estoy haciendo una versión alterada de wigglypaint agregando muchas funciones extras como mas pinceles y mejor historial de cambios y en eso tambien tenia pensado poder ajustar el tamaño del deck para poder hacer dibujos más grandes pero quisiera que hubiera una forma más rapida y sencilla de hacer sin tener que recurrir a modificar el archivo .deck

And how does all that work?

I'm making an altered version of WigglyPaint, adding many extra features like more brushes and a better change history. I was also planning to be able to adjust the deck size to make larger drawings, but I'd like a faster and easier way to do that without having to modify the .deck file

(4 edits) (+2)

I also like making differently sized decks and wish there was more support for doing so - but I understand why it's better to stick to a standard resolution. Luckily, you only need to save the deck as the new size once and then it will continue being that size each time you open it. That being said, I recently made a contraption that allows you to export decks at a different size, if that helps you at all.

Edit: When I initially wrote my reply, I missed the part about wanting to change the size of the deck without having to close or reopen it - sorry! Here's a script that will do exactly what you're trying to do, but again - you may find some issues to work around if you plan on doing this.

on newres x y do
# cut the 'deck.encoded' output into chunks
 endeck:"\n\n" split deck.encoded
# get the first chunk, which is {deck}
 d:"\n" split endeck[0]
# find the 'size:' tag and edit it, though it's usually on the fourth line.
 each v k in d
  if v like "size*" d[k]:"" fuse "size:[",("," fuse x,y),"]" end
 end 
# rebuild the deck from the chunks.
 endeck[0]:"\n" fuse d
 endeck:"\n\n" fuse endeck
# open the newly edited deck and refresh the page.
 danger.open[newdeck[endeck]]
 danger.js["window.dispatchEvent(new Event('resize'));"]
end

Using the danger interface differs between native and web Decker, you can read more about it here. For testing purposes, I exported the Decker Tour as .html and changed 'DANGEROUS=0" to 'DANGEROUS=1' From the Listener or through a widget script, you can trigger 'newres[200 200]' or something similar to see how it affects the window.