c++ - Mouse handling on PixelToaster lib -
i'm using pixeltoaster (a c++ library draw framebuffer) simple 3d (ehm.. 2.5d) raycasting engine. use old school wasd key configuration move camera around (w=forward, s=backward, a=turn left, d=turn right) want use mouse modern freelock approach (wasd moving , strafing, mouse turn head around).
i noticed pixeltoaster gives mouselistener in absolute mouse coordinate x,y given (relative window width,height). using such coordinate system not want because turning stops mouse x coordinate reaches margin of screen. (in commercial games can turn around endlessly swiping continuously mouse in 1 direction).
how can same behaviour using pixeltoaster mouse listener?
what need simple implement.
simply reset mouse pointer centre of screen when hit margins.
note work should not "map" 2d screen space coordinates angular rotation of character. instead have accumulator keeps adding incremental changes in angle (calculated 2d screen space movements of mouse pointer).
alternate approach: detect when @ edges of screen , keep rotating character until leave edge. way don't need reset mouse pointer. reason assumed wouldn't have cross-hair in game suggested former approach first. :)
Comments
Post a Comment