Question

I'm currently creating a game (Gomoku) where user needs to input his moves to a square grid of 15x15. I don't have much experience with GUI so I thought a good way to do it would be to create a lot of ImageViews, corresponding to each individual square, that would change the background picture from blank to X or O when a player moves.

However, this would be very hard in some cases (finger too big and/or screen too small), so I want to implement a pinch to zoom or double tap to zoom feature.

My questions is: is it possible to implement such feature to a ViewGroup where it would magnify all the Views within it? If yes how, else is there another way to go about implementing GUI for this game?

Was it helpful?

Solution

As a matter of fact I'm also developing a Gomoku for Android, well, kind of.

I'm drawing directly in the Canvas of a custom View, as Alok has also suggested. You may also use a SurfaceView if needing animations and fluid movement, or even OpenGL for the sake of portability.

Regarding zoom, I've not implemented pinch to zoom, just double tap. Why? Sorry for not being more techincal, but sometimes when pinching "weird" things would happen, messing with the scroll and square selection. It's also easier to play with one hand.

Offtopic: good luck with the artificial intelligence, it's quite hard to make it strong enough.

OTHER TIPS

A canvas would be a better option. It would allow you much more flexibility and the graphics can be updated. you can add multiple images and make up the grid in canvas. You can also add multitouch easily as seen on http://android-developers.blogspot.in/2010/06/making-sense-of-multitouch.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top