Jump to content

smateja

Members
  • Posts

    44
  • Joined

  • Last visited

Posts posted by smateja

  1. Hello @ all,

     

    i try with Leadwerks and Purebasic - now i´ve got a little problem - maybe someone can help or have any ideas to fix.

     

    I have an application window and i want to put a smaller leadwerks engine window on it - with Leadwerks Graphic Command i think - there is no chance to define a parent window or?

     

    thx for any kind of ideas.

  2. Daamn ! i'm teaching purebasic with a trial version after reading a pdf documentation 10 minutes ;) crazy me !

     

    Yes Man - your good in :lol: - sorry but i am not a programmer - i am a network technican and a little bit hobby programming learner.

     

    what is *y .playerpos ? why not playerpos\Y ?

     

    i tried playerpos\Y - but it want work - i defined

     

    Structure playerpos

    X.f

    Y.f

    Z.f

    EndStructure

     

    but it also don´t work.

     

     

    mmhm - think i am a little lost - because i don´t understand how to get 3 variables into one -> playerpos=LEEntityPosition(player,Vec3(VResult)) and then use them with LEPositionEntity(camera,playerpos,0)

     

    This want work:

     

    playerpos=LEEntityPosition(player,Vec3(VResult))

    playerpos\y=playerpos\y+1.75

    LEPositionEntity(camera,playerpos,0)

     

     

     

    my actual complete code - looks like:

     

    
    EnableExplicit
    
    XIncludeFile ("hw_engine.pbi")
    
    
    ;XIncludeFile ("hw_controlcam.pbi")
    ;XIncludeFile ("hw_screenrequester.pbi")
    
    
    Define VResult.TVec3   ;if an expression requires more than one vec3 then define VResult2.TVec3, VResult3TVec3, etc ... for each vec3
    Define sx.i
    Define sy.i
    Define framework.i
    Define Lua.i
    Define Camera.i
    Define scene.i
    Define player.i
    Define font.i
    
    Define move.f
    Define strafe.f
    Define jump.f
    
    Define camrotation
    Define camrotation_x.f
    Define camrotation_y.f
    
    Define mouse_x.f
    Define mouse_y.f
    
    Define playerpos
    
    LERegisterAbstractPath(GetCurrentDirectory())
    LESetAppTitle("Hiveworx Framework")
    
    sx = 1024
    sy = 768
    
    
    
    If LEGraphics(sx,sy)>0
      framework = LECreateFramework()
    
      If framework>0    
    
         Lua = LEGetLuaState()
         LELua_pushobject(Lua, framework);
         LELua_setglobal(Lua, "fw");
         LELua_pop(Lua, 1);
    
         Camera = LEGetLayerCamera(LEGetFrameworkLayer(0))
         LEPositionEntity(camera, Vec3(VResult,0, 350,0))
    
    
         scene = LELoadScene("abstract::test001.sbx")
         LEEntityType(scene,2,1)
    
         player = LECreateController(1.8,0.4,0.5,45,0)
         LEEntityType(player,1)
    
         LESetStats(2)
    
         font=LELoadFont("abstract::Arial12Shadow")
         LESetFont(font)
    
         move.f=0.0
         strafe.f=0.0
         jump.f=0.0
    
    
         LEMoveMouse(LEGraphicsWidth()/2,LEGraphicsHeight()/2)
    
         LEHideMouse()
    
        XIncludeFile ("hw_grafikoptionen.pbi")
    
        While (LEKeyHit(#KEY_ESCAPE)=0) And (LEAppTerminate()=0)
    
    
      ;-Mouse Look
    
             mouse_x.f=Curve(LEMouseX()-LEGraphicsWidth()/2,mouse_x.f,6.0)
             mouse_y.f=Curve(LEMouseY()-LEGraphicsHeight()/2,mouse_y.f,6.0)
    
            LEMoveMouse(LEGraphicsWidth()/2,LEGraphicsHeight()/2)
            camrotation=LEEntityRotation(camera,Vec3(VResult, mouse_y.f, mouse_x.f, 0))
            camrotation_x.f=camrotation_x.f-mouse_x/10
            camrotation_y.f=camrotation_y.f+mouse_y/10
            LERotateEntity(camera,Vec3(VResult, camrotation_y.f, camrotation_x.f, 0))
    
    
    ;-Player movement        
          move=LEKeyDown(#KEY_W)-LEKeyDown(#KEY_S)
          strafe=LEKeyDown(#KEY_D)-LEKeyDown(#KEY_A)
    
     ;-Set controller Input     
          LEUpdateController(player,Vec3(VResult, camrotation_y.f, camrotation_x.f, 0),move,strafe,jump,0.5);
    
          ;- Position Camera
    
          playerpos=LEEntityPosition(player,Vec3(VResult))
          ;playerpos\y=playerpos\y+1.75
          LEPositionEntity(camera,playerpos,0)
    
           LEUpdateFramework() ;Update timing And world
            LERenderFramework() ;Render
    
    
    
            LESetBlend(1)
    
            LEDrawText("CamPosX: ",800,20)
            LEDrawText("CamPosY: ",800,40)
            LEDrawText("CamPosZ: ",800,60)
    
            LESetBlend(0)
    
            LEFlip(0) ;Send to screen
    
    
    
    
         Wend      
    
       Else
         LEAppLog("ERROR: Failed to create Framework")
      EndIf
    
      LEFreeFramework(framework)
    Else
      LEAppLog("ERROR: Failed to create or set graphics mode")
    EndIf
    
    
    LEEndRender()
    CloseLibrary(#Engine_Library)
    

     

     

    i commented out playerpos\y=playerpos\y+1.75 because don´t know how to define the structure.

    Line LEPositionEntity(camera,playerpos,0) causes crashing the engine.

     

    grettings

  3. you can call your variable framework

     

    only here LELua_setglobal(Lua, "fw");

     

    "fw" is not a variable, it's leadwerks engine internally predefined name used to link the engine framework to your external variable. So this "fw" within quotes cannot be changed, it must match the name defined in the engine.

     

    Thx for explaining me. I now renamed it to framework and all works fine.

    But now i got another Problem - if i include i the headgen with xinclude i mmust correct to set the leadwerks.pb variables global - otherwise it crashes. Mybay you can correct this in new headgen version. try use enableexplecit command in PB.

     

     

    2nd: i got a litte problem 2 handle vec3 results.

    My code:

     

    
     While (LEKeyHit(#KEY_ESCAPE)=0) And (LEAppTerminate()=0)
    
    
      ;-Mouse Look
    
             mouse_x.f=Curve(LEMouseX()-LEGraphicsWidth()/2,mouse_x.f,6.0)
             mouse_y.f=Curve(LEMouseY()-LEGraphicsHeight()/2,mouse_y.f,6.0)
    
            LEMoveMouse(LEGraphicsWidth()/2,LEGraphicsHeight()/2)
            camrotation=LEEntityRotation(camera,Vec3(VResult, mouse_y.f, mouse_x.f, 0))
            camrotationx.f=camrotationx.f-mouse_x/10
            camrotationy.f=camrotationy.f+mouse_y/10
            LERotateEntity(camera,Vec3(VResult, camrotationy.f, camrotationx.f, 0))
    
    
    ;-Player movement        
          move=LEKeyDown(#KEY_W)-LEKeyDown(#KEY_S)
          strafe=LEKeyDown(#KEY_D)-LEKeyDown(#KEY_A)
    
     ;-Set cntroller Input     
          LEUpdateController(player,Vec3(VResult, camrotationy.f, camrotationx.f, 0),move,strafe,jumo,0.5);
    
     ;- PosCam 
          playerpos=LEEntityPosition(player,Vec3(VResult))
    [b]      ; *y.playerpos=*y.playerpos+1.75
         ; LEPositionEntity(camery,playerpos)[/b]
    
    

     

    when i un-rem the bolden codelines (the last 2 lines) i get enginecrashes - don´t know @ this time how to handle correct 2 use the playercontroller und position wit Vec3.

    Maybe someone can help me out.

     

    Thx a lot

     

    PS: i added as attachment the updated leadwerks-include with global variables if someone would like to xinclude in projects (And as backup for myself ;) - i like backups in the cloud G*).

    leadwerks_pb_include.txt

  4. okay -

     

    i found my problem why i don´t see water etc. - i thx wchriss for his working example.

     

    My Fault was - that i do this code:

     

     

    framework = LECreateFramework()

     

    If framework >0

     

    Lua = LEGetLuaState()

    LELua_pushobject(Lua, framework );

    LELua_setglobal(Lua, "framework ");

    LELua_pop(Lua, 1);

     

     

    if i renamed framework to fw - all works fine - water - sky etc. - sorry for this and thx.

  5. Cool :) where were you ? Did you have sun ?

     

    Now you'r back with plenty of energy to write the first Purebasic LE game ! ;)

     

    What kind of game will it be ? do you already have an idea ?

     

    Hi Wchris,

     

    yes - there was a lot of sun - and i got some burnings on my skin ;)

     

    I tried the actual headgen - there is a little problem with the Procedure LE_Engine_Stop(). The Command LEEndRender() Could not be found - i check later why.

     

    Second - i check your SimpleFWExample - works fine.

    Is it possible that you can give a pb example that loads a map that comes with the LE sdk - or makes an example wirh water - both don´t work at this time for me.

     

    I have no plans yet for a game - more for an application leadwerks + pb + sql. A kind of Sandbox Editor with multiuser - later maybe a game. People can upload models textures sounds etc. and use them to make a kind of virtuall city or an architactual marketplace.

     

    At the moment i experementing with the engine. The sql code is ready - server with 100 mbit direct connect is ready - now i must get firm with the engine.

     

    If you like my project - your a welcome to help - i buy you a pb version :)

     

    so on....

  6. He he, Paul is also good in purebasic ;) his help is precious. :)

     

    did you try my latest simpleFWexample from post #40 ? do you see a rotating cube ? can you make a screenshot ? Thanks

     

    Sorry - i went for a few days in holiday - so now i am back again.

    Tomorrow i test all and report back to you - when i remember correctly befor my holiday - your example works fine - i test it again and tomorrow i will report you back.

     

    so on....

  7. Yes, and I sold some programs coded with purebasic. But I bought Blitmax because there were not leadwerks wrapper for purebasic, and other usefull things like OOP.

     

     

    - no need for a wrapper - open the dll and go

    - PB can oop - search forums @ purebasic.fr/english for explanings and tutorials

  8. Hi @ all,

     

    i tested some commands - some work some not - maybe someone can test this:

     

    works:

     

    LESetStats(2)

    LESetNearDOF(1)

    LESetNearDOFStrength(0.2)

    LESetNearDOFRange(0.5, 1)

    LESetFarDOF(1)

    LESetFarDOFStrength(1)

    LESetFarDOFRange(1.5, 5)

    LESetGodRays(1)

    LESetAntialias(8)

    LESetSaturation(1)

    LESetBrightness(1)

    LESetContrast(1)

    LESetBloom(1)

    LESetHDR(1)

    LESetDistanceFog(1)

    LESetZoom(1)

    LESetBackgroundMode(0)

     

    not working:

     

    LESetWater(1)

    LESetSSAO(1)

     

    not working correctly:

     

    LEGetGraphicsVendor() = shows at debut at me 3 (i have an nvidia)

    LEGetShaderModel()

    LEMaxAFilter() => show with debug at me 1 (i think x>8 will work fine at me)

    LEMaxTextureUnits() => shows 0 - no texture units?

    LEMaxColorBuffers() => shows 0 - no maxcolor ?

     

     

     

    Also i have problems with the LELoadScene command - it loads the scene - i get stats about a lot of polygons - but i only see a black screen?!

     

    thanx

  9. @Wchris

     

    i tested your new version of the headergen.

     

    mmh where should i begin - okay - looks very good :blink: - your my hero ;)

    2nd - your right - no need for the macros

     

    okay - litte problem - you forgot an enumeration at line 83 - befor the #engine_library

    and.... no need for the procedures:

     

    - LE_Engine_Stop

    - LE_Engine_Functions_List

     

    they where only for testing for my beginnings of testing the engine with pb - so u can delete line from 1161 to 1179.

     

    By the way - the command lines at the beginnig - line 3 to 8 have problems with the spaces at the end

    - line 847 - comment helper funtions i think can deleted also

    - comment line 835 - 837 - mapping declaration --- mmhm must be move to 1186 - better - delet it :)

     

    can u correct the procedure names? it looks like this: LEGetGraphicsVendor ( ) - better without spaces like LEGetGraphicsVendor() -thx

     

    greetings

  10. #Engine_library isn't assigned a number, plus its in a function

    #Engine_library without a number worked in smateja header and in the simpleFWexample in my post 24. something must be missing now.

     

    for the Init_Engine_Enum() usage, i think i'll let smateja answer

     

     

     

    #Engine_library without a number worked <- SM: because i enumerated it

    plus its in a function <- SM: not really? why a function - its only a variable that becomes thru the enumeration an fixed number @ compilation time => konstante

     

    .. fu** - i think the google translater works better than my bloody english - *narf*

     

     

    I think you have cleand out the code - and so the init_enum procedure will not be called? - so the #Engine_library did not get a number at compilation.

  11.  

    Edit : OK got it ! i forgot the # in LEKeyHit(#KEY_ESCAPE)

    The compiler does not complain, he just ignores it ! :P This behaviour can lead easily to hidden bugs.

    Is there a way to force him to complain ?

     

    nopes - because the compiler think its an variable without the #

     

    by hte way - have you tried the command - LESetSSAO(1) - *G freezes my app ;)

  12. Update :)

     

    okay - works also fine - shows full stats etc.

    but only shows a black screen - maybe the graphiccard drivers @ my work pc seems to be broken :blink: - i will try this @ home this evening

     

     

     

    
    XIncludeFile ("hwengine.pb")
    
    
    
    
    
    LERegisterAbstractPath(GetCurrentDirectory())
    
    LESetAppTitle("Test")
    LEGraphics(640,480)
    ;LECreateWorld()
    
    framework = LECreateFramework()
    
    
      If framework>0    
    
         Lua = LEGetLuaState()
         LElua_pushobject(Lua,framework)
         LElua_setglobal(Lua, ""+Str(framework))
         LElua_pop(Lua, 1)
    
      EndIf    
    
    
    LESetBackgroundMode(1)   
    LESetStats(2)
    
    mesh=LECreateCube()
    
    light=LECreateSpotLight() 
    
    LESetFarDOF(1)
    LESetFarDOFStrength(1)
    LESetFarDOFRange(1.5, 5)
    LESetGodRays(1) 
    ;LESetSSAO(1)
    ;LESetAntialias(1)
    
    Repeat
    
     LETurnEntity(mesh,Vec3(0.5))
     LETurnEntity(light,Vec3(-0.25))
    
    
     LEUpdateFramework()
     LERenderFramework()
     LEFlip()
    
    Until Quit = 1 Or LEAppTerminate()
    
    LEFreeFramework(framework)
    
    

  13. your code does still not use UpdateFramework; RenderFramework;

     

    so you create the framework but you don't use it

     

    UpdateFramework; RenderFramework; call updateworld and renderworld internaly

     

     

    okay....

     

    XIncludeFile ("hwengine.pb")
    
    
    LERegisterAbstractPath(GetCurrentDirectory())
    
    LESetAppTitle("Test")
    LEGraphics(640,480)
    
    
    framework = LECreateFramework()
    
    
      If framework>0    
    
         Lua = LEGetLuaState()
         LElua_pushobject(Lua,framework)
         LElua_setglobal(Lua, ""+Str(framework))
         LElua_pop(Lua, 1)
    
      EndIf    
    
    
    Repeat
    
     LEDrawText("Hello World!",32,32)
    
     LEUpdateFramework()
     LERenderFramework()
     LEFlip()
    
    
    Until Quit = 1 Or LEAppTerminate()
    

     

     

    runs - and shows the framerate - don´t know why - and don´t show the draw text text - because of the fps?

  14. arg - sorry - i found an error in my code

     

    in the line LElua_setglobal(Lua,"Framework") <- this is false :)

     

    corrected code:

     

    
    XIncludeFile ("hwengine.pb")
    
    
    LERegisterAbstractPath(GetCurrentDirectory())
    
    LESetAppTitle("Test")
    LEGraphics(640,480)
    
    
    framework = LECreateFramework()
    
    
      If framework>0    
    
         Lua = LEGetLuaState()
         LElua_pushobject(Lua,framework)
         LElua_setglobal(Lua, ""+Str(framework))
         LElua_pop(Lua, 1)
    
      EndIf    
    
    
    Repeat
    
     LEDrawText("Hello World!",32,32)
    
     LEUpdateWorld()
     LERenderWorld()
     LEFlip()
    
    Until Quit = 1 Or LEAppTerminate()
    
    

  15. The only différence with my code is that you create a world, wich is not necessary when using framework.

    maybe i crash because eof my trial version, or because it's an old 4.31 ?

    hmm ... i forgot the bracket () with LEGetLuaState ... maybe it's the problem ? will try this evening

     

    LERegisterAbstractPath("C:\Program Files\Leadwerks Engine SDK");
    LESetAppTitle("SimpleFWexample")
    
    If LEGraphics(640,480)>0 
      fw = LECreateFramework()
    
      If fw>0    
    
         Lua = LEGetLuaState
         LElua_pushobject(Lua, @fw);
         LElua_setglobal(Lua, "fw");
         LElua_pop(Lua, 1);
    

     

     

    I have tested it without the createworld command - will run without errors.

     

    Attention - the difference ist the @ - symbol in my code, also there is no need for the ; at the line end - this ist pascal statemante or delphi i think.

     

    try this :

    LElua_pushobject(Lua, fw)
    

  16. By the way - u can use xincludefile in Purebasic...

     

    in engine.pb - the code for the functions macros and so on....

     

    The main programm file looks then like:

     

    
    XIncludeFile ("engine.pb")
    
    LESetAppTitle("Test")
    LEGraphics(640,480)
    LECreateWorld() 
    
      framework = LECreateFramework()
    
      If framework>0    
    
         Lua = LEGetLuaState()
         LElua_pushobject(Lua,framework)
         LElua_setglobal(Lua,"framework")
         LElua_pop(Lua, 1)
    
      EndIf    
    
    Repeat
     LEDrawText("Hello World!",32,32)
    
     LEUpdateWorld()
     LERenderWorld()
     LEFlip()
    
    Until Quit = 1 Or LEAppTerminate()
    
    

  17. Ok i think i reached my purebasic limits and need some help

     

    the stripped out purebasic sample attached crashes when Lua_pushobject command tries to access the fw memory address (read error at address 12).

     

    I don't know what's wrong with my PB pointer and i need help from purebasic programmers

    post-44-029895200 1283805061_thumb.jpg

     

    source code

    SimpleFWExample.zip

     

     

    Try this in combination with my first attachment in this post:

     

    LESetAppTitle("Test")

    LEGraphics(640,480)

    LECreateWorld()

     

    fw = LECreateFramework()

     

    If fw>0

     

    Lua = LEGetLuaState()

    LElua_pushobject(Lua, fw)

    LElua_setglobal(Lua,"fw")

    LElua_pop(Lua, 1);

     

    EndIf

     

    I have tested it and it will work fine.

     

    No need for the @.

  18. Code is now working, maybe a little buggy and can be a lot of optimized :lol: - i updated the attachment.

     

    I only have a problem with the tframework structure - then it´s done.

     

    Greetings

     

     

    PPS to Wchris: no no - i will stay at pb. C++ is to complex at this time for me.

  19. Hi @ all,

     

    first sorry about my bad english :) - i will try....

     

    i try to use Leadwerks Engine with PureBasic - and i have a little Problem with.

     

    1. TFramework needs a Structure - don´t know atm how to fix this.

    2. When i use graphics command it shows up correclty - but want responding - if i use apptitel command - nothing appears ....

     

    so on - i will show you - maybe someone can use this for himself...

    plz help me to get it work - thanks a lot.

    code.txt

×
×
  • Create New...