Roland Posted January 20, 2010 Share Posted January 20, 2010 Hi all great Leadwerks programmers. As you know or may not know, I'm making an update to the ProjectWizard (see my blog). Here is the new look of the ProjectWizard. Now I need you help. What I want is you to suggest template code for the different cases that the ProjectWizard can generate. Current version of the ProjectWizard produces a project showing a rotating cube. Creating same game output for the different cases is a good idea I think. However there is no law telling that the produced project must produce a rotating cube, so thats up to you think about. Here the different cases that needs code (including sample project) LUA loaded by Engine.exe C++ using engine.h only C++ LEO using Framework (internal Framewerk) C++ LEO using Framewerk (Framewerk files) C++ Gamelib There is no C# here, but It can be added if anyone produces code and a sample project for it I wish us good luck with this. Roland 1 Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Canardia Posted January 20, 2010 Share Posted January 20, 2010 Example02.lua in the SDK can be used as the Lua template. C++ example (add engine.cpp): #include "engine.h" int main() { if( !Initialize() ) return 1; // Set graphics mode if( !Graphics(1024,768) ) { MessageBox( 0, "Failed to set graphics mode.", "Error", 0 ); return 1; } // Create framework object and set it to a global object so other scripts can access it TFramework fw = CreateFramework(); if( fw == NULL ) { MessageBox( 0, "Failed to initialize engine.", "Error", 0 ); return 1; } // Set Lua framework object SetGlobalObject( "fw", fw ); // Set Lua framework variable BP lua = GetLuaState(); lua_pushobject( lua, fw ); lua_setglobal( lua, "fw" ); lua_pop( lua, 1 ); // Get framework main camera TCamera camera = GetLayerCamera( GetFrameworkLayer(0) ); PositionEntity( camera, Vec3(0,0,-2) ); TMaterial material = LoadMaterial( "abstract::cobblestones.mat" ); TMesh mesh = CreateCube(); PaintEntity( mesh, material ); TMesh ground = CreateCube(); ScaleEntity( ground, Vec3(10,1,10) ); PositionEntity( ground, Vec3(0,-2,0) ); PaintEntity( ground, material ); TLight light = CreateDirectionalLight(); RotateEntity( light, Vec3(45,45,45) ); while( !AppTerminate() ) { TurnEntity( mesh, Vec3( AppSpeed()*0.5f ) ); UpdateFramework(); RenderFramework(); Flip( 0 ); } return Terminate(); } C++ LEO example (add leo.cpp, engine.cpp): #include "leo.h" using namespace LEO; int main() { // Set graphics mode Engine engine("Example - LEO with Framework",1024,768); if( !engine.IsValid() ) { MessageBox( 0, "Failed to set graphics mode.", "Error", 0 ); return 1; } // Create framework object and set it to a global object so other scripts can access it Framework fw; fw.Create(); if( fw == NULL ) { MessageBox( 0, "Failed to initialize engine.", "Error", 0 ); return 1; } // Set Lua framework object engine.SetObject( "fw", fw ); // Set Lua framework variable Lua lua; lua.Create(); lua.PushObject( fw ); lua.SetGlobal( "fw" ); lua.Pop( 1 ); // Get framework main camera fw.main.camera.SetPosition( Vec3(0,0,-2) ); Material material( "abstract::cobblestones.mat" ); Cube mesh( CREATENOW ); mesh.Paint( material ); Cube ground( CREATENOW ); ground.Scale( Vec3(10,1,10) ); ground.SetPosition( Vec3(0,-2,0) ); ground.Paint( material ); DirectionalLight light( CREATENOW ); light.SetRotation( Vec3(45) ); while( !engine.IsTerminated() ) { mesh.Turn( Vec3( AppSpeed()*0.5f ) ); fw.Update(); fw.Render(); engine.Flip( 0 ); } return engine.Free(); } C++ LEO with Framewerk example (add leo.cpp, engine.cpp, framework.cpp, layer.cpp, renderer.cpp): #include "leo.h" #include "framewerk.h" using namespace LEO; using namespace leadwerks; int main() { // Set graphics mode Engine engine("Example - LEO with Framewerk",1024,768); if( !engine.IsValid() ) { MessageBox( 0, "Failed to set graphics mode.", "Error", 0 ); return 1; } // Create framewerk object and set it to a global object so other scripts can access it Framewerk fw; if( !fw.Create() ) { MessageBox( 0, "Failed to initialize engine.", "Error", 0 ); return 1; } // Note! Lua is not supported when using Framewerk // Get framewerk main camera Camera camera( fw.GetMain().GetCamera() ); camera.SetPosition( Vec3(0,0,-2) ); Material material( "abstract::cobblestones.mat" ); Cube mesh( CREATENOW ); mesh.Paint( material ); Cube ground( CREATENOW ); ground.Scale( Vec3(10,1,10) ); ground.SetPosition( Vec3(0,-2,0) ); ground.Paint( material ); DirectionalLight light( CREATENOW ); light.SetRotation( Vec3(45) ); while( !engine.IsTerminated() ) { mesh.Turn( Vec3( AppSpeed()*0.5f ) ); fw.Update(); fw.Render(); engine.Flip( 0 ); } return engine.Free(); } C++ GameLib example (add gamelib.cpp): #include "gamelib.h" int main() { Game game(CREATENOW); if( !game.engine.IsValid() ) { MessageBox( 0, "Failed to initialize engine.", "Error", 0 ); return 1; } // Set graphics mode game.Initialize(1024,768); // Get framework main camera game.scene.framewerk.main.camera.SetPosition( Vec3(0,0,-3) ); Material material( "abstract::cobblestones.mat" ); Cube mesh( CREATENOW ); mesh.Paint( material ); Cube ground( CREATENOW ); ground.Scale( Vec3(10,1,10) ); ground.SetPosition( Vec3(0,-2,0) ); ground.Paint( material ); DirectionalLight light( CREATENOW ); light.SetRotation( Vec3(45) ); while( !game.engine.IsTerminated() ) { mesh.Turn( Vec3( AppSpeed()*0.5f ) ); game.scene.Update(); game.scene.Render(); game.scene.Flip( 0 ); } return game.Free(); } Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Wchris Posted January 20, 2010 Share Posted January 20, 2010 I wish us good luck with this. Roland Hi Roland, Here's my little contribution to your project program exemple1; {$ifdef FPC} {$mode delphi} {$endif} {$H+} uses Classes, SysUtils, LeadWerks; var Framework: TFramework = 0; Lua: Pointer; Camera: TCamera; Light: TLight; Material: TMaterial; Mesh: TMesh; Ground: Tmesh; begin RegisterAbstractPath('C:\Program Files\Leadwerks Engine SDK'); SetAppTitle('Exemple1'); try // Set graphics mode if Graphics(1024, 768)=0 then Exception.Create('ERROR: Failed to create set graphics mode.'); // Create framewerk object and set it to a global object so other scripts can access it Framework := CreateFramework; if Framework=0 then Exception.Create('ERROR: Failed to create Framework'); if Framework<>0 then begin // Set Lua variable Lua := GetLuaState; lua_pushobject(Lua, pointer(Framework)); lua_setglobal(Lua, 'fw'); lua_pop(Lua, 1); end; Camera := GetLayerCamera(GetFrameworkLayer(0)); PositionEntity(Camera, Vec3(0, 0, -2)); Light := CreateSpotLight(10); RotateEntity(Light, Vec3(45, 55, 0), 0); PositionEntity(Light, Vec3(5, 5, -5), 0); Material := LoadMaterial('abstract::cobblestones.mat'); Mesh := CreateCube; PaintEntity(Mesh, Material, 0); Ground := CreateCube; ScaleEntity(Ground, Vec3(10, 1, 10)); PositionEntity(Ground, Vec3(0, -2, 0), 0); PaintEntity(Ground, Material, 0); Light := CreateDirectionalLight(0); RotateEntity(Light, Vec3(45, 45, 45), 0); // Activate Framework Postfilter Effects //SetAntialias(1); //SetDistanceFog(1); //SetStats(2); //SetHDR(1); //SetGodRays(1); //SetBloom(1); //SetSSAO(1); while (KeyHit(KEY_ESCAPE)=0) and (AppTerminate=0) do begin TurnEntity(Mesh, Vec3(AppSpeed*0.5, AppSpeed*0.5, AppSpeed*0.5), 0); UpdateFramework; RenderFramework; Flip(0); end; except on E: exception do begin Applog(PAnsiChar(' Exception occured ! '+E.message)); end; end; end. I wonder if there is a difference in FPS between the C++ versions Framewerk/framework ? Good luck too PS: i did not test this with delphi, only lazarus/freepascal Quote Windows 7 home - 32 bits Intel Quad Q6600 - nVidia GTX 460 1GB - 2 GB RAM Link to comment Share on other sites More sharing options...
Canardia Posted January 21, 2010 Share Posted January 21, 2010 Here's another version written in the Easy language (which I invented a few hours ago): #include "gamelib.h" #include "easy.h" Begin Define( Engine, engine ) Call( engine.Create ) // Set graphics mode Define( TGame, game ) Call( game.Initialize, 1024, 768 ) If( Not Check( engine.IsValid ) ) ErrorPopUp( "Failed to set graphics mode." ) Return( 1 ) End // Get framework main camera Call( game.scene.framewerk.main.camera.SetPosition, Vec3(0,0,-3) ) Define( Material, material( "abstract::cobblestones.mat" ) ) Define( Cube, mesh( CREATENOW ) ) Call( mesh.Paint, material ) Define( Cube, ground( CREATENOW ) ) Call( ground.Scale, Vec3(10,1,10) ) Call( ground.SetPosition, Vec3(0,-2,0) ) Call( ground.Paint, material ) Define( DirectionalLight, light( CREATENOW ) ) Call( light.SetRotation, Vec3(45) ) While( Not Check( engine.IsTerminated ) ) Call( mesh.Turn, Vec3( RealTime*0.5f ) ) Call( game.scene.Update ) Call( game.scene.Render ) Call( engine.Flip, 0 ) End Return( Check( engine.Free ) ) End The source code for the Simple language is as simple as: // simple.h 0.0.0.0 #pragma once #include "stdio.h" #define Begin int main(){ #define End } #define Print(f,s) printf(f,s); #define PrintText(s) printf("%s\n",s); #define PrintInt(i) printf("%d\n",i); #define ForInt(i,b,e) for(int i=b;i<=e;i++){ #define If(s) if(s){ #define While(s) while(s){ #define Not ! #define Return(s) return(s); #define RealTime AppSpeed() #define ErrorPopUp(s) MessageBoxA(0,s,"Error",0); #define Call(s,...) s(__VA_ARGS__); #define Define(s,t) s t; #define Check(s,...) s(__VA_ARGS__) Here are some benefits of this new language: - the Simple language is cross-language compatible (you can use the same source code of Simple programs in C, C++, C#, Delphi, Pascal, etc..., basically in all languages which support variadic macros (all real programming languages do that) ) - you can write short and easy to understand code, which everyone should understand without even knowing any programming language - it will run as fast as C++ programs when used with a C++ compiler - you can mix all your own language commands with it, so it works from the first version (which is this) on, to all coming versions - you don't have to use Simple syntax everywhere, you can always fall back to your own language at any line of code - it can be used as a pseudo, generic, universal, human understandable language, also in the tutorials, since then nobody can complain the tutorials are not written in his/her language (since Simple works in all languages) Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted January 21, 2010 Share Posted January 21, 2010 Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Roland Posted January 22, 2010 Author Share Posted January 22, 2010 Thanks Guys for your contributions. I will work a bit on this during this weekend Lumooja... Who else could make an own language. Well you know my touch about defines.... they should only be used in absolute weird seldom circumstances where a typed variable or constant can't be used. In fact I think the world should have been a better place without defines. Is this the successor to C++ to that you have been talking about Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Canardia Posted January 22, 2010 Share Posted January 22, 2010 Lumooja... Who else could make an own language.Well you know my touch about defines.... they should only be used in absolute weird seldom circumstances where a typed variable or constant can't be used. In fact I think the world should have been a better place without defines. Is this the successor to C++ to that you have been talking about Variadic Macros can be used for certain things, and even Boost uses them, but in a way that it doesn't break the C++ language, so type checks still work.Easy is just an approach to make a generic language which is as powerful as C++, but easier to code with. A possible successor of C++ could be D, but it's not official, and also just a one man invention. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
macklebee Posted January 22, 2010 Share Posted January 22, 2010 you should call yours E so it makes it seem even more impressive! Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Canardia Posted January 22, 2010 Share Posted January 22, 2010 But then it would be like electronic language (e-language) I've thought also of other names for it, like: Phasic (a bit wierd) Generic (quite ok) Human (actually I have plans to make a real Human language too, so this should be reserver for that) C+++ (too long) C* (quite ok, since C# is also a mix of BASIC and C++ ) C+- (a bit indifferent) XD (kinda like a extra version of D, but maybe too funny also) Strict (maybe too strict) Formal (maybe too boring) Pseudo (would make sense since it works from many langugages) Abstract (not very descriptive for the language, but not bad either) Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Marleys Ghost Posted January 22, 2010 Share Posted January 22, 2010 What about E- ? Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
macklebee Posted January 23, 2010 Share Posted January 23, 2010 Hey Roland, here are the other couple of bmax templates I had talked to you about adding. bmax + framework ' ==================================================================== ' This file was generated by Leadwerks C++/LEO/BlitzMax Project Wizard ' Written by Rimfrost Software ' http://www.rimfrost.com ' ==================================================================== SuperStrict Framework leadwerks.ENGINE Import "$(MediaDir)\BMX\Framework\Framework.bmx" GCSetMode(2) RegisterAbstractPath("$(MediaDir)") Graphics($(ScreenWidth), $(ScreenHeight)) Global fw:TFramework = CreateFramework() If Not fw RuntimeError "Failed to initialize engine." Local mesh:TMesh Local light:TLight Local ground:TMesh Local material:TMaterial PositionEntity fw.Main.camera, [0.0, 0.0, - 2.0] material=LoadMaterial("abstract::cobblestones.mat") mesh=CreateCube() PaintEntity mesh,material ground=CreateCube() ScaleEntity ground,[10.0,1.0,10.0] PositionEntity ground,[0.0,-2.0,0.0] PaintEntity ground,material light=CreateDirectionalLight() RotateEntity light,[45.0,45.0,45.0] Repeat TurnEntity mesh,[AppSpeed()*0.5,AppSpeed()*0.5,AppSpeed()*0.5] If KeyHit(KEY_ESCAPE) Exit If AppTerminate() Exit fw.Update() fw.Render() Flip(0) Forever fw.renderer.gbuffer = Null FreeEntity light GCCollect() End and also bmax + framework + lua integration: ' ==================================================================== ' This file was generated by Leadwerks C++/LEO/BlitzMax Project Wizard ' Written by Rimfrost Software ' http://www.rimfrost.com ' ==================================================================== SuperStrict Framework leadwerks.ENGINE Import "$(MediaDir)\BMX\Framework\Framework.bmx" 'To create a new lua-gluefunctions.bmx file, comment and uncomment the following lines. Include "lua-gluefunctions.bmx" '--Comment this line out to create new lua-gluefunctions.bmx 'Import lugi.generator '--Uncomment this line to create new lua-gluefunctions.bmx 'GenerateGlueCode("lua-gluefunctions.bmx") '--Uncomment this line to create new lua-gluefunctions.bmx 'Notify("All Done", 0) '--Uncomment this line to create new lua-gluefunctions.bmx 'End '--Uncomment this line to create new lua-gluefunctions.bmx GCSetMode(2) RegisterAbstractPath("$(MediaDir)") Graphics($(ScreenWidth), $(ScreenHeight)) Global fw:TFramework = CreateFramework() If Not fw RuntimeError "Failed to initialize engine." SetScriptObject("fw", fw) Local mesh:TMesh Local light:TLight Local ground:TMesh Local material:TMaterial PositionEntity fw.Main.camera, [0.0, 0.0, - 2.0] material=LoadMaterial("abstract::cobblestones.mat") mesh=CreateCube() PaintEntity mesh,material ground=CreateCube() ScaleEntity ground,[10.0,1.0,10.0] PositionEntity ground,[0.0,-2.0,0.0] PaintEntity ground,material light=CreateDirectionalLight() RotateEntity light,[45.0,45.0,45.0] Repeat TurnEntity mesh,[AppSpeed()*0.5,AppSpeed()*0.5,AppSpeed()*0.5] If KeyHit(KEY_ESCAPE) Exit If AppTerminate() Exit fw.Update() fw.Render() Flip(0) Forever fw.renderer.gbuffer = Null FreeEntity light GCCollect() End 'this enables lua framework to work inside bmax Function SetScriptObject(name:String, o:Object) Local size:Int=GetStackSize() lua_pushbmaxobject(luastate.L,o) lua_setglobal(luastate.L,name) SetStackSize(size) EndFunction Function GetStackSize:Int() Return lua_gettop(luastate.L) EndFunction Function SetStackSize(size:Int) Local currentsize:Int=GetStackSize() If size<currentsize lua_pop(luastate.L,currentsize-size) EndIf EndFunction Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Roland Posted January 23, 2010 Author Share Posted January 23, 2010 Thanks macklebee for putting the Blitz code up Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Paul Posted January 23, 2010 Share Posted January 23, 2010 Here's another version written in the Simple language (which I invented a few hours ago) You're not the first. Quote Intel Core i7 975 @ 3.33GHz, 6GB ram, GTX 560 Super OC, Windows 7 Pro 64bit Link to comment Share on other sites More sharing options...
Rick Posted January 23, 2010 Share Posted January 23, 2010 I like the VB++ lol http://thedailywtf.com/Articles/VB_0x2b__0x2b_.aspx Quote Link to comment Share on other sites More sharing options...
Roland Posted January 23, 2010 Author Share Posted January 23, 2010 The ProjectWizard will not contain any macro-languages. Its absolute enough to support the existing languages. Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Canardia Posted January 23, 2010 Share Posted January 23, 2010 Well, not now, but in future Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
carlb Posted January 23, 2010 Share Posted January 23, 2010 lol some how i dont think so not the first time i seen someone try what you doing lumooja anyway good luck Quote Asus ROG STRIX B350-F GAMMING AMD Ryzen 7 1700x 32 gb ddr4 15 TB raid 5 HD Nvidia EVGA 1060GTX Win10 64bit Link to comment Share on other sites More sharing options...
Canardia Posted January 23, 2010 Share Posted January 23, 2010 Well, so far it's much better than C++. It's faster than C++, and less to code. I will see if there will be any major barriers when expanding the language, but theoretically it's not possible, since you can always fallback to C++. What Roland doesn't realize is that macros are actually inlines. And standard inlines are not even close to the inlinability of Easy, since you can't inline everything in C++. That's why Easy is faster than C++. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Rick Posted January 23, 2010 Share Posted January 23, 2010 What's C++ about what you have so far? Looks like C to me. You don't seem to be using any C++ features yet. So you are trying to say that "Easy" is faster than C++ even though it's made from C++? Your macros are replaced by what you have them defined as. So it's not faster, it's the same. Quote Link to comment Share on other sites More sharing options...
Canardia Posted January 23, 2010 Share Posted January 23, 2010 It's faster in that sense, that no C++ programmer would repeat the same code, but they would put them in functions instead, and that makes things a bit slower. Even if those functions were declared as inline, there would be still some overhead as compared to direct pasting of code. But of course in practice, you wouldn't notice the speed difference, it's more a theoretical thing, but still Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Roland Posted January 23, 2010 Author Share Posted January 23, 2010 Well, so far it's much better than C++. It's faster than C++, and less to code. I will see if there will be any major barriers when expanding the language, but theoretically it's not possible, since you can always fallback to C++. What Roland doesn't realize is that macros are actually inlines. And standard inlines are not even close to the inlinability of Easy, since you can't inline everything in C++. That's why Easy is faster than C++. Macros and inline's are definitely not the same thing. It's faster in that sense, that no C++ programmer would repeat the same code, but they would put them in functions instead, and that makes things a bit slower. Even if those functions were declared as inline, there would be still some overhead as compared to direct pasting of code. But of course in practice, you wouldn't notice the speed difference, it's more a theoretical thing, but still Back to the 80's Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Paul Posted January 24, 2010 Share Posted January 24, 2010 'Call()' to call a function? 'Define()' to make a variable? Who in their right mind would use this abomination? Quote Intel Core i7 975 @ 3.33GHz, 6GB ram, GTX 560 Super OC, Windows 7 Pro 64bit Link to comment Share on other sites More sharing options...
Canardia Posted January 24, 2010 Share Posted January 24, 2010 'Call()' to call a function? 'Define()' to make a variable? Who in their right mind would use this abomination? In C++ it's '();' to call a function, and '=;' to define a variable. Sure, they are a bit shorter, but someone who has never programmed would not know what they mean. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Paul Posted January 24, 2010 Share Posted January 24, 2010 In C++ it's '();' to call a function, and '=;' to define a variable. Sure, they are a bit shorter, but someone who has never programmed would not know what they mean. '=' assigns the variable a value.If they choose this preprocessor mess to program in they should never be allowed to program. Quote Intel Core i7 975 @ 3.33GHz, 6GB ram, GTX 560 Super OC, Windows 7 Pro 64bit Link to comment Share on other sites More sharing options...
Roland Posted January 26, 2010 Author Share Posted January 26, 2010 Hi Roland, Here's my little contribution to your project program exemple1; {$ifdef FPC} {$mode delphi} {$endif} {$H+} uses Classes, SysUtils, LeadWerks; var Framework: TFramework = 0; Lua: Pointer; Camera: TCamera; Light: TLight; Material: TMaterial; Mesh: TMesh; Ground: Tmesh; begin RegisterAbstractPath('C:\Program Files\Leadwerks Engine SDK'); SetAppTitle('Exemple1'); try // Set graphics mode if Graphics(1024, 768)=0 then Exception.Create('ERROR: Failed to create set graphics mode.'); // Create framewerk object and set it to a global object so other scripts can access it Framework := CreateFramework; if Framework=0 then Exception.Create('ERROR: Failed to create Framework'); if Framework<>0 then begin // Set Lua variable Lua := GetLuaState; lua_pushobject(Lua, pointer(Framework)); lua_setglobal(Lua, 'fw'); lua_pop(Lua, 1); end; Camera := GetLayerCamera(GetFrameworkLayer(0)); PositionEntity(Camera, Vec3(0, 0, -2)); Light := CreateSpotLight(10); RotateEntity(Light, Vec3(45, 55, 0), 0); PositionEntity(Light, Vec3(5, 5, -5), 0); Material := LoadMaterial('abstract::cobblestones.mat'); Mesh := CreateCube; PaintEntity(Mesh, Material, 0); Ground := CreateCube; ScaleEntity(Ground, Vec3(10, 1, 10)); PositionEntity(Ground, Vec3(0, -2, 0), 0); PaintEntity(Ground, Material, 0); Light := CreateDirectionalLight(0); RotateEntity(Light, Vec3(45, 45, 45), 0); // Activate Framework Postfilter Effects //SetAntialias(1); //SetDistanceFog(1); //SetStats(2); //SetHDR(1); //SetGodRays(1); //SetBloom(1); //SetSSAO(1); while (KeyHit(KEY_ESCAPE)=0) and (AppTerminate=0) do begin TurnEntity(Mesh, Vec3(AppSpeed*0.5, AppSpeed*0.5, AppSpeed*0.5), 0); UpdateFramework; RenderFramework; Flip(0); end; except on E: exception do begin Applog(PAnsiChar(' Exception occured ! '+E.message)); end; end; end. I wonder if there is a difference in FPS between the C++ versions Framewerk/framework ? Good luck too PS: i did not test this with delphi, only lazarus/freepascal Hi I dont know if there is any difference is FPS between Framewerk/framework. My best guess is that if there is a difference its very small and can be ignored. But that's just my guess. There are currently no plans for supporting Delphi or Pascal in ProjectWizard. But if you could send a complete sample with project files included I may add it. My biggest problem here is that I have no knowledge of Delphi. Roland Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.