Mouse Desktop Issue?

About Monkey 2 Forums Monkey 2 Programming Help Mouse Desktop Issue?

This topic contains 3 replies, has 2 voices, and was last updated by  Mark Sibly 2 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5653

    APC
    Participant

    Hello Mark,

    This Mouse test displays the mouse coodinate on the screen.
    When I build it for Desktop it does not update, but it runs fine when I build it for Emscriten and for Android too.

    [/crayon]

    Using std..
    Using mojo..

    Class MyWindow Extends Window
    Field x:Int
    Field y:Int
    Field lb:Int,rb:Int, md:Int
    <p style=”padding-left: 30px;”>Method OnRender( canvas:Canvas ) Override
    x=Mouse.X
    y=Mouse.Y
    lb=Mouse.ButtonDown(MouseButton.Left)
    rb=Mouse.ButtonDown(MouseButton.Right)</p>
    <p style=”padding-left: 60px;”>canvas.DrawText( “Mouse Test”,Width/2,Height/2,.5,.5 )
    canvas.DrawText( “x:”+ x + ” y:” + y,Width/2,Height*.3,.5,.5 )
    canvas.DrawText( “left button:”+lb+” right button”+rb ,Width/2,Height*.4,.5,.5 )</p>
    <p style=”padding-left: 30px;”>End</p>
    End

    Function Main()
    New AppInstance
    New MyWindow
    App.Run()
    End

    #5895

    Mark Sibly
    Keymaster

    The desktop version needs ‘RequestRender’ somewhere, either in a timer or you can just stick it at the top of OnRender, eg:

    Emscripten works a little differently and is ‘always rendering’.

    #5923

    APC
    Participant

    Hello Mark,

     

    Thank you that works. Below is the updated code.

     

    #5924

    Mark Sibly
    Keymaster

    Also, emscripten should be working again with last master branch!

    The emscripten compilers appear to have problems with long ‘relative’ paths (this has popped up a few times in the past too ), so I’ve made a few tweaks that should help – they do here anyway.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.