Report bugs or give feedback for CrossCode.

[Suggestion] Pixel Size

no avatar





Sat Nov 07, 2015 3:46 am

[Suggestion] Pixel Size

by Hao » Sun Feb 12, 2017 2:01 am

For the pixel size option, I noticed that to change it between 1-4, it needs to restart the program each time. I played around with Impact a little and saw the way that weltmeister is able to resize using a cache of the different sizes. I know that that method would take up a lot of memory to store the resized images, but it is possible to at least resize it whenever the button is pressed instead of a restart. Since you resize the canvas to fit the window, it won't affect the way that works. This will just make it so that it will resize all images (and background prerenders if necessary) using the implemented image cache.
Code: Select all
resize: function (scale) {
   ig.system.resize(ig.system.width, ig.system.height, scale);
   //reloads images by size
   for (var i in ig.Image.cache) {
   //rerenders chunks
   for (var i = 0; i <; i++) {
      var bg =[i];
      bg.preRenderedChunks = null;

Code: Select all
   origData: null,
   load: function (loadCallback) {
      this.origData =;
   resize: function (scale) {
      // Retain the original image when scaling = this.origData;
         if (scale > 1) {
         // Nearest neighbor when zooming in
      } else {
         // Otherwise blur
         var scaled = ig.$new('canvas');
         scaled.width = Math.ceil(this.width * scale);
         scaled.height = Math.ceil(this.height * scale);
         var scaledCtx = scaled.getContext('2d');
         scaledCtx.drawImage(, 0, 0, this.width, this.height, 0, 0, scaled.width, scaled.height); = scaled;

I don't know, just a suggestion so that you can see the immediate effects of pixel size. Great game tho!

Who is online

Users browsing this forum: Google [Bot] and 4 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign