Jump to content

Search the Community

Showing results for tags 'topaz'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Community
    • News
    • General
    • Random
  • Products
    • Topaz Game Toolkit
    • FreeStrike

Blogs

  • DevLog

Product Groups

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me

Found 2 results

  1. Topaz has a robust LuaJIT integration feature. With just two interfaces, you can interface the Lua programming language to Delphi with relative ease. Bind Delphi to Lua: type Color = class class procedure AutoSetup(aLua: ILua); class procedure Make(aContext: ILuaContext); class procedure Makef(aContext: ILuaContext); end; class procedure Color.AutoSetup(aLua: ILua); begin RegColor(aLua, 'WHITE', 255, 255, 255, 255); RegColor(aLua, 'RED', 255, 0, 0, 255); RegColor(aLua, 'GREEN', 0, 255, 0, 255); RegColor(aLua, 'BLUE', 0, 0, 255, 255); end; // function ColorMake(aRed: Byte; aGreen: Byte; aBlue: Byte; aAlpha: Byte): SDL_Color; class procedure Color.Make(aContext: ILuaContext); var aRed: Byte; aGreen: Byte; aBlue: Byte; aAlpha: Byte; begin aRed := Round(aContext.GetValue(vtDouble, 1).AsNumber); aGreen := Round(aContext.GetValue(vtDouble, 2).AsNumber); aBlue := Round(aContext.GetValue(vtDouble, 3).AsNumber); aAlpha := Round(aContext.GetValue(vtDouble, 4).AsNumber); PushColor(aContext, 1, aRed, aGreen, aBlue, aAlpha); end; // function ColorMake(aRed: Single; aGreen: Single; aBlue: Single; aAlpha: Single): SDL_Color; class procedure Color.Makef(aContext: ILuaContext); var aRed: Single; aGreen: Single; aBlue: Single; aAlpha: Single; begin aRed := aContext.GetValue(vtDouble, 1).AsNumber; aGreen := aContext.GetValue(vtDouble, 2).AsNumber; aBlue := aContext.GetValue(vtDouble, 3).AsNumber; aAlpha := aContext.GetValue(vtDouble, 4).AsNumber; PushColor(aContext, 1, Round(aRed*255.0), Round(aGreen*255.0), Round(aBlue*255.0), Round(aAlpha*255.0)); end; // register this class with LuaJIT Lua.RegisterRoutines('', Color, 'Color'); Then from Lua you can: color1 = Color.Make(210,20,58,255) color2 = Color.Makef(0.5, 0.5, 0.5, 1.0) print("Color1.r=" .. tostring(color1.r)) And using LuaJIT over regular Lua, you get the added advantage of increased performance. 😎
  2. Experimenting with Lua hot reload for Topaz Game Toolkit.
×
×
  • Create New...