Board Gradient

Although I like the wooden board textures that I use for chess and checkers, I was never quite happy with the board texture I used for Reversi for Android (some called it a dirty pool table :-). Therefore, I am trying something new in version 2.3. Instead of using a texture, I use a radial gradient on the board, which gives the impression that the board has been placed under a lamp.


This new approach also slightly reduces the size of the binary. Let me know what you think.

Comments

Anonymous said…
Hi, I have a noobie question. how do you create your board? which view do you use.

I want to write a statergy card game and dont know which view to use.

thanks
Aart Bik said…
I am setting up my view "programmatically" (in contrast with defining views declaratively through XML). In my activity, I set the content to my own view, called MyView, as shown below:

public class MyActivity extends Activity {
@Override
public void onCreate(Bundle state) {
super.onCreate(state);
view = new MyView(...);
setContentView(view);
}
....
}

In my MyView class, I have to define how the view should draw itself. The drawing methods get a Canvas as parameter, and I am free to paint and draw whatever I like on there. So in my gaming apps, I would draw the board and pieces, and some notation text.

public class MyView extends View {
@Override
public void onDraw(Canvas canvas) {
....
}
}

If you want define more elaborate views that consist of several parts (like buttons, text windows, etc). I would also have a look at the XML approach (with Eclipse, you can simply construct the views graphically, and use the automatically generated XML).

Hope this gets you started!

Popular posts from this blog

Checkers Move Generation

Connecting Chess for Android to a Remote Server

Connecting with the DGT Board