Results 1 to 10 of 45

Thread: ZenGL

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Currently playing around with point in poly (which seems to work), but I am very confused with mouse_x()/y() and mouse_dx()/dy().

    Here's a scenario:
    Code:
    if(col2d_PointInTriangle(mouse_X(),mouse_Y(),p1,p2,p3)) then
    begin
       // Visual response
    end;
    
    text_Draw( fntMain, 0, 64, 'FPS: ' + u_IntToStr( zgl_Get( SYS_FPS ) ) +' | '+u_inttostr(mouse_x())+','+u_inttostr(mouse_y()));
    The mouse coords initialize to where the mouse was when the game was launched, but never update after.

    Code:
    if(col2d_PointInTriangle(mouse_DX(),mouse_DY(),p1,p2,p3)) then
    begin
       // Visual response
    end;
    
    text_Draw( fntMain, 0, 64, 'FPS: ' + u_IntToStr( zgl_Get( SYS_FPS ) ) +' | '+u_inttostr(mouse_dx())+','+u_inttostr(mouse_dy()));
    Coords output are changing as I move the mouse, but still no collision response.

    Code:
    if(col2d_PointInTriangle(mouse_X(),mouse_Y(),p1,p2,p3)) then
    begin
       // Visual response
    end;
    No collision response

    Code:
    if(col2d_PointInTriangle(mouse_X(),mouse_Y(),p1,p2,p3)) then
    begin
       // Visual response
    end;
    
    text_Draw( fntMain, 0, 64, 'FPS: ' + u_IntToStr( zgl_Get( SYS_FPS ) ) +' | '+u_inttostr(mouse_dx())+','+u_inttostr(mouse_dy()));
    For some reason this works the way I want it to.

    Anyway, I can't really find docs anywhere so I'm a bit confused about their behaviors, but at least I got it working the way I wanted after some very random guessing.

  2. #2
    The mouse coords initialize to where the mouse was when the game was launched, but never update after.
    Did you watch this demo - "02 - Input"? There are few lines of code in function Timer(at end of it) that very important:
    Code:
      // EN: Necessarily clear all the states.
      key_ClearState();
      mouse_ClearState();
      joy_ClearState();
    Last edited by Andru; 12-11-2010 at 07:14 PM.

  3. #3
    I guess I had misunderstood its function based on the source. I thought it only cleared button states, at any rate it works nicely with mouse_clearState.

  4. #4
    Quote Originally Posted by dazappa
    I thought it only cleared button states
    Under Windows it also clearing yet another state, because WinAPI GetCursorPos is slow function, and ZenGL call it only one time per iteration.

  5. #5
    New font generator have just released Here the source code of it. Just create directory "tools" in ZenGL directory and unpack archive there. After you can compile it with Lazarus 0.9.29. Little bit later I will provide GNU/Linux and Windows binary archives, because now I want to sleep
    Last edited by Andru; 14-11-2010 at 10:31 AM.

  6. #6
    Fantastic Project. What about shader?

    Thanks
    Sesilla

  7. #7
    this framework looks elegant , thanks for sharing
    but i was hoping that the bin directory is full of exe

  8. #8
    virtual
    Ok, next release will be with binaries for Windows(and maybe for other OS'es) in separate package. And this minor release will be soon, because I have already found and fixed some errors in svn(text rendering using font with more than one page and "problem" with tiles2d_Draw)

  9. #9
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Thank you so much for the font creator. I'm just curious: but could I use some of your audio and font code in Prometheus? (along with the editor?).

    Just a thought, since I can see this speeding up development and making it easier to use. Perhaps even a chance for easy porting from Prometheus to ZenGl if projects get serious even...

    cheers,
    code_glitch
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  10. #10
    Quote Originally Posted by code_glitch
    I'm just curious: but could I use some of your audio and font code in Prometheus? (along with the editor?).
    You can use it while all modified ZenGL units(or units, that use ZenGL code) have copyrights. But audio... I think it won't be easy to port without using a lot of ZenGL units, but you can try to do this
    Last edited by Andru; 15-11-2010 at 06:18 AM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •