开发者

In Java Android OpenGL ES, my extended GLSurfaceView sees getHeight()/getWidth() as 0

开发者 https://www.devze.com 2023-01-18 18:07 出处:网络
Well, the title/subject pretty much covers the issue.Using various examples and and the API on googlecode, it seems like my extended GLSurfaceView class ought to be a good place to work my onTouchEven

Well, the title/subject pretty much covers the issue. Using various examples and and the API on googlecode, it seems like my extended GLSurfaceView class ought to be a good place to work my onTouchEvent inputs but when I try to set variables involving getHeight() and getWidth() when I make the call to my "where did the user touch class", the getHeight() and getWidth() are zero. I have verfied this by telling the class method to return the getHeight() or getWidth() int I passed it and it comes back as zero.

I am using an extended SpriteTextRenderer to display the values from my "where did the user touch class", and I know that it is working well because because I can change the other method to return event.getX() or event.getY() and those values display and update just fine.

My question is, is the 开发者_高级运维extended GLSurfaceView class the place where I should be asking to get the getHeight() and getWidth() values?


You can get height and width of GLSurfaceView from parameters in onSurfaceChanged and store them in private fields.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号