bright-restaurant-79188
01/25/2023, 12:37 AMbright-restaurant-79188
01/25/2023, 12:38 AMable-action-74275
01/25/2023, 12:40 AMable-action-74275
01/25/2023, 12:40 AMable-action-74275
01/25/2023, 12:40 AMsmooth = false
by defaultable-action-74275
01/25/2023, 12:41 AMable-action-74275
01/25/2023, 12:41 AMable-action-74275
01/25/2023, 12:42 AMable-action-74275
01/25/2023, 12:43 AMbright-restaurant-79188
01/25/2023, 12:47 AMable-action-74275
01/25/2023, 12:47 AMbright-restaurant-79188
01/25/2023, 12:48 AMimg.smooth = false
might actually be the intended way to do pixelated scaling in HaxePunkbright-restaurant-79188
01/25/2023, 12:48 AMbright-restaurant-79188
01/25/2023, 12:48 AMoverride public function begin()
{
var tilemap = new Tilemap("graphics/tiles.png", 840, 512, 60, 60, 4, 4);
for (x in 0 ... Std.int(840/60))
{
for (y in 0 ... Std.int(480/60))
{
tilemap.setTile(x, y, Std.random(4));
}
}
tilemap.smooth = false;
// make any seams caused by scaling obvious
tilemap.scale = 1.1;
addGraphic(tilemap);
label = new Text("Default\nClick to change scale mode.");
label.smooth = false;
addGraphic(label);
label.y = HXP.height/2;
setScaleMode();
}
bright-restaurant-79188
01/25/2023, 12:48 AMbright-restaurant-79188
01/25/2023, 12:49 AMbright-restaurant-79188
01/25/2023, 12:49 AMable-action-74275
01/25/2023, 12:49 AMbright-restaurant-79188
01/25/2023, 12:55 AMbright-restaurant-79188
01/25/2023, 12:56 AMbright-restaurant-79188
01/25/2023, 12:56 AMpowerful-morning-89
01/25/2023, 7:12 AMsmooth
property doesn't seem to have anything to do with anti-aliasing, what it actually controls is linear vs point sampling.
(minification filtering seems to be always linear, but smooth = true will make it use linear filtering for magnification too.)
(But in the screenshots half shared it seems to be doing the opposite... maybe the smooth property is inverted somewhere?)elegant-cat-63914
01/25/2023, 6:57 PMAssets.loadBitmapData
doesn't work on the first try when using Future<T>.result()
, but succeeds any try after that?able-action-74275
01/25/2023, 7:05 PMelegant-cat-63914
01/25/2023, 7:06 PMvar loadingBitmap:Future<BitmapData> = OpenFlAssets.loadBitmapData(path).onError(loadingError);
var newBitmap:BitmapData = loadingBitmap.result();
var newGraphic:FlxGraphic;
if (newBitmap == null)
return FlxG.bitmap.add("flixel/images/logo/default.png"); //get the flixel default image to prevent crashes
newGraphic = FlxGraphic.fromBitmapData(newBitmap, false, path);
newGraphic.persist = true;
able-action-74275
01/25/2023, 7:19 PMhx
var future = Assets.loadBitmapData(path);
uture.onError(error -> {
// handle error if there was one
});
future.onComplete(asset ->
{
// handle asset now it is loaded
newGraphic = FlxGraphic.fromBitmapData(asset)
});
able-action-74275
01/25/2023, 7:19 PMable-action-74275
01/25/2023, 7:20 PMloadingBitmap.result();
is probably null the first time because it didn't finish loading
by using the onComplete event it will have finished loadingable-action-74275
01/25/2023, 7:20 PMelegant-twilight-61392
01/25/2023, 7:21 PM