Friday, 21 February 2025

Stencyl topic update: Text drawing without G for Stencyl 4.0 - FLASH VERSION

 It has a month since there is the last post. The flash version of Prosperity Valley in was compiled in flash to see if we can optimise the game with JPEXS FFDEC the same flash decompiler we used to hack Gemcraft Chasing Shadows and GemCraft Frostborn Wrath resulting in easier and optimised gameplay. 

This is because we cannot play the game on the computer without the Stencyl Software the StencylWork HTML5 version without publishing on Kongregate.  

About the Stencyl Topic. 

FLASH VERSION
package scripts;

import com.stencyl.Config;  
import com.stencyl.Engine;
import com.stencyl.models.Font;
import openfl.display.BitmapData;  
import openfl.display.Graphics; 
import openfl.geom.Matrix; 

class F 
{
public var gr:Graphics = Engine.engine.transitionLayer.graphics; 
public var a:Float=1; public var c:Int=16777215; public var l:Int=-1; 
public var m:Matrix= new Matrix();  public var s:Float=1;   
public var f_de:Font = new Font(-1, 0, "", true); public var f_cu:Font = new Font(-1, 0, "", true); 
public var fontdata: Array<BitmapData> = []; 
public function new(){}

public function ds(s:String,x:Float,y:Float):Void
{
if(this.f_cu == null ||""+this.f_cu == "undefined"){this.f_cu = f_de;}
this.m.identity(); this.m.translate(x,y);
var toDraw:BitmapData = null;
var w = this.f_cu.font.getTextWidth(s,this.l,this.s);
var h = Std.int(this.f_cu.font.getFontHeight()*this.s);
if(w > 0 && h > 0)
{
// the highlighted is the oens being changed for flash version 
this.fontdata = this.f_cu.font.getPreparedGlyphs(this.s,this.c, true);
 toDraw = new BitmapData(w, h, true, 0);
 this.f_cu.font.render(toDraw,this.fontdata, s,this.c,this.a, 0, 0,this.l,this.s, 0); //0, false
}
if(toDraw != null)
{
this.gr.beginBitmapFill(toDraw, this.m, false, Config.antialias);
this.gr.drawRect(x,y, toDraw.width, toDraw.height);
this.gr.endFill();
}
}

public function g_textw(s:String):Int{return this.f_cu.font.getTextWidth(s,0,this.s) + this.l*s.length;}

For HTML 5 versions and other details

No comments:

Post a Comment