Changeset 3a0d468 in galcon-client for src/com/example/helloandroid/GameView.java


Ignore:
Timestamp:
Jun 20, 2010, 6:29:03 PM (14 years ago)
Author:
dportnoy <devnull@…>
Branches:
master
Children:
a4f5200, b87af8a
Parents:
9d030cb
Message:

Added code to connect to the game server.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/com/example/helloandroid/GameView.java

    r9d030cb r3a0d468  
    8181       
    8282        int mFleetSize;
     83       
     84        public boolean connectionStarted;
     85        public String connMessage;
    8386
    8487        public DrawingThread(SurfaceHolder surfaceHolder, Context context,
     
    107110           
    108111            mFleetSize = 50;
     112           
     113            connectionStarted = false;
     114            connMessage = "";
    109115        }
    110116
     
    346352                }
    347353                }
    348                
     354       
     355                //draw the fleet size bar on the bottom of the screen
    349356                float textSize = mTextPaint.getTextSize();
    350357                mTextPaint.setTextSize(24);
     
    355362               
    356363                mTextPaint.setTextSize(textSize);
    357                
     364       
    358365                mLinePaint.setColor(Color.YELLOW);
    359366                canvas.drawRoundRect(new RectF(70, mCanvasHeight-15, mCanvasWidth-70, mCanvasHeight-5), 5, 5, mLinePaint);
     
    361368                mLinePaint.setColor(Color.GREEN);
    362369                canvas.drawRoundRect(new RectF(70, mCanvasHeight-15, 70+(mCanvasWidth-140)*mFleetSize/100, mCanvasHeight-5), 5, 5, mLinePaint);
     370               
     371                //draw connection info
     372                if(connectionStarted) {
     373                        canvas.drawText(connMessage, (mCanvasWidth-mTextPaint.measureText(connMessage))/2, mCanvasHeight-200-(metrics.ascent+metrics.descent), mTextPaint);
     374                }
    363375        }
    364376
Note: See TracChangeset for help on using the changeset viewer.