> With those values, *tell* the canvas how big you want it to be (via 
setCoordinateSpaceHeight/setCoordinateSpaceWidth)

Depending on your game, you might want to have 
fixed setCoordinateSpaceHeight / setCoordinateSpaceWidth sizes, so every 
device gets the same game detail (plus make programming the game easier).  
Then set the width and height of the canvas element to fit the screen size:

canvas.getElement().getStyle().setWidth(xxx, Unit.PX);
canvas.getElement().getStyle().setHeight(xxx, Unit.PX);

On Friday, 13 December 2024 at 9:15:38 am UTC+11 Neil Aggarwal wrote:

> Colin:
>
>  
>
> > To get the "real" size, use getOffsetWidth() and getOffsetHeight(). 
>
> > With those values, *tell* the canvas how big you want it to be (via 
> setCoordinateSpaceHeight/setCoordinateSpaceWidth)
>
>  
>
> Ahh, got it. 
>
>  
>
> I called the get offset width and height in onAttachOrDetach and
> then multiplied those values by a constant and called the 
> setCoordinateSpace
> methods.  Now it makes sense.
>
>  
>
> It is interesting the ClickEvent.getX() and getY() are giving me 
> coordinates in the
> screen space instead of the coordinate space, but that is an easy 
> multiplication
> to do.
>
>  
>
> Thank you,
>
>  Neil 
>
>  
>
> --
>
> Neil Aggarwal, (972) 834-1565, http://www.propfinancing.com
>
> We offer 30 year loans on single family houses!
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/google-web-toolkit/1859340a-5b2e-4156-9bf6-5acd9a33c6c2n%40googlegroups.com.

Reply via email to