BSCS 514- Computer Graphics. Course Supervisor : Dr. Humera Tariq Hands on Lab Sessions: Mr. Faraz Naqvi

Similar documents
Topics of Discussion

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation

Chapter 5 Flashing Neon FrameLayout

M.A.D ASSIGNMENT # 2 REHAN ASGHAR BSSE 15126

Arrays of Buttons. Inside Android

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology

User Interface Development in Android Applications

Intents. Your first app assignment

SD Module-1 Android Dvelopment

INTRODUCTION TO ANDROID

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen

AdFalcon Android Native Ad SDK Developer's Guide. AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group

Lecture 14. Android Application Development

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015

Overview. What are layouts Creating and using layouts Common layouts and examples Layout parameters Types of views Event listeners

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator.

Hello World. Lesson 1. Android Developer Fundamentals. Android Developer Fundamentals. Layouts, and. NonCommercial

Chapter 8 Positioning with Layouts

Android UI: Overview

Mobile Software Development for Android - I397

EMBEDDED SYSTEMS PROGRAMMING UI Specification: Approaches

Android UI Development

Our First Android Application

Android Development Crash Course

android-espresso #androidespresso

AdFalcon Android Native Ad SDK Developer's Guide. AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group

Android + TIBBO + Socket 建國科技大學資管系 饒瑞佶

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 2

Programming with Android: Introduction. Layouts. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State


Graphical User Interfaces

Comp 595MC/L: Mobile Computing CSUN Computer Science Department Fall 2013 Midterm

Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University.


05. RecyclerView and Styles

Tip Calculator. xmlns:tools=" android:layout_width="match_parent"

Sizing and Positioning

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

Upon completion of the second part of the lab the students will have:

Android Workshop: Model View Controller ( MVC):

Android Application Development

Adapter.

Android Basics. Android UI Architecture. Android UI 1

M.A.D Assignment # 1

Programming with Android: Layouts, Widgets and Events. Dipartimento di Scienze dell Informazione Università di Bologna

South Africa

PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE)

When programming in groups of people, it s essential to version the code. One of the most popular versioning tools is git. Some benefits of git are:

Text Properties Data Validation Styles/Themes Material Design

MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs

ListView (link) An ordered collection of selectable choices. key attributes in XML:

Software Practice 3 Before we start Today s lecture Today s Task Team organization

Learning Android Canvas

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Create Parent Activity and pass its information to Child Activity using Intents.

MotionEvents Touch Handling Gestures

Practical 1.ListView example

Android HelloWorld - Example. Tushar B. Kute,

Android Programs Day 5

Creating a Custom ListView

Hangman Requirements

Android & iphone. Amir Eibagi. Localization

Notification mechanism

ANDROID USER INTERFACE

Java & Android. Java Fundamentals. Madis Pink 2016 Tartu

FORT Mobile SDK for Android

Created By: Keith Acosta Instructor: Wei Zhong Courses: Senior Seminar Cryptography

Android Data Binding: This is the DSL you're looking for

Android Navigation Drawer for Sliding Menu / Sidebar

EMBEDDED SYSTEMS PROGRAMMING Android Services

Fragments. Lecture 11

package import import import import import import import public class extends public void super new this class extends public super public void new

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Android DP SDK Integration Guide

ActionBar. import android.support.v7.app.actionbaractivity; public class MyAppBarActivity extends ActionBarActivity { }

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

DEPARTMENT OF COMPUTER SCIENCE THE UNIVERSITY OF HONG KONG. CSIS0801 Final Year Project. WhozzUp - A Novel Big Data App for HK (Individual Report)

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University. Overview (Review)

API Guide for Gesture Recognition Engine. Version 1.3

Applied Cognitive Computing Fall 2016 Android Application + IBM Bluemix (Cloudant NoSQL DB)

API Guide for Gesture Recognition Engine. Version 2.0

Teaching Kids to Program. Lesson Plan: Catch the Ball

Programming with Android: Introduction. Layouts. Luca Bedogni. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

Five-in-a-row Game on Android System

Android CardView Tutorial

MOBILE COMPUTING 1/20/18. How many of you. CSE 40814/60814 Spring have implemented a command-line user interface?

Open Lecture Mobile Programming. Intro to Material Design

COMP4521 EMBEDDED SYSTEMS SOFTWARE

Let s take a display of HTC Desire smartphone as an example. Screen size = 3.7 inches, resolution = 800x480 pixels.

Create new Android project in Android Studio Add Button and TextView to layout Learn how to use buttons to call methods. Modify strings.

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University

Tłumaczenie i adaptacja materiałów: dr Tomasz Xięski. Na podstawie prezentacji udostępnionych przez Victor Matos, Cleveland State University.

TextView Control. EditText Control. TextView Attributes. android:id - This is the ID which uniquely identifies the control.

Intents, Intent Filters, and Invoking Activities: Part I: Using Class Name

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs

FORT Mobile SDK for Android

android:orientation="horizontal" android:layout_margintop="30dp"> <Button android:text="button2"

Android Volley Tutorial

Basic GUI elements - exercises

Transcription:

BSCS 514- Computer Graphics Course Supervisor : Dr. Humera Tariq Hands on Lab Sessions: Mr. Faraz Naqvi

Lab 01 Running your First App on Android to Handle Text and Images

Content Android studio setup Creating new project Desired output /Imaginiation Resources / Assets/ Models Project Main_Layout.xml(background) Main.java Framelayout (foreground objects) Touch Screen Event ( User Interaction) HitBomb() Score_card.xml Score_card.java Ball.java setxy() sety() Collision.java Rectangle vs Rectangle. Collision handling of ball with paddle. Scoring (In future you can handle it some other class)

Android Studio Setup Link to download: https://developer.android.com/studio/instal l.html Download android studio and the SDK.

First Screen

Select Options

Setup your location for SDK and Android Studio

Downloading Screen

Desired Output/Imagination-I

Desired Output/Imagination-II

Resources/Assets/Models Bounded Rectangle Paddle Orange Ball Pink Ball Bomb

Catch The Ball ALWAYS THINK FIRST BEFORE STARTING IMPLEMENTATION

Code Organization, Patterns

Example AI That May Works Behind

Logics that Work Behind For e.g. Rectangle vs. Rectangle collision

Catch The Ball TOWARDS ANDROID IMPLEMENTATION

Your First Sight At Xml TextView Linear Layout Relative Layout Table Layout Grid View Tab Layout List View

Your First Sight At Xml <TextView android:id="@+id/answer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text= Hello world! > <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=http://schemas.android.com/apk /res/android xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent android:layout_height="match_parent tools:context="com.faraz.cg.main android:orientation="vertical"> <TextView > </LinearLayout>

Setting Up Our Layout File Adding a textview in the tag of Linear Layout. <TextView android:id="@+id/scorelabel" android:layout_width="match_parent" android:layout_height="50dp" android:text="score : 300" android:textsize="18sp" android:padding="10dp" android:gravity="center_vertical" />

Adding a Frame Layout/ FG Setup Add a frame layout under the TextView above. <FrameLayout android:id="@+id/frame" android:layout_width="match_parent" android:layout_height="match_parent">?????????????????????????????????????? </FrameLayout>

Adding TextView <TextView android:id="@+id/startlabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="tap to Start" android:textsize="30sp" android:layout_gravity="center_horizontal" android:layout_margintop="130dp" /> <TextView android:id="@+id/answer" android:layout_width="wrap_content" android:layout_height="wrap_content" /> Add the above code of TextView and ImageView in Frame Layout

Adding ImageView <ImageView android:id="@+id/paddle" android:layout_width="50dp" android:layout_height="50dp" android:src="@drawable/box" android:layout_gravity="center_vertical"/> <ImageView android:id="@+id/orange_balls" android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/orange"/> <ImageView android:id="@+id/black_bomb" android:layout_width="24dp" android:layout_height="25dp" android:adjustviewbounds="true" android:scaletype="fitxy" android:src="@drawable/black"/> <ImageView android:id="@+id/pink_balls" android:layout_width="16dp" android:layout_height="20dp" android:src="@drawable/pink"/>

Linking XML Layout to Main Class Lets connect all the element on the Main Layout with their respective variables for controlling their properties.

Declare all the variables main.java private TextView scorelabel; private TextView startlabel; private TextView answer; private ImageView paddle; private ImageView orange_balls; private ImageView pink_balls; private ImageView black_bomb; private int orange_ballsx; private int orange_ballsy; private int pink_ballsx; private int pink_ballsy; private int black_bombx; private int black_bomby; private int frameheight; private int screenwidth; private int screenheight; private boolean action_flag = false; private boolean start_flag = false; private Timer timer = new Timer(); private int paddlesize; private int paddley; XML ID Cast Into Our Declared Variables

Initialize all the variables

Set Images to their Initial Position Main.Java Ball.Java

Handling Touch Screen Event Flag Variable Main Game Loop Action Down/Action Up

Assignment Draw Simple but complete UML for the popular Game ball and paddle. Propose some AI to be implemented in this game. Try to add some code for: - animate ball and paddle - random bombs & blasting - Displaying Score Card.