SlideShare a Scribd company logo
Game Development for
Nokia Asha Devices
with Java ME
                      Marlon Luz - INdT
              Nokia Developer Evangelist
                            @marlonluz
Low-Level UI API
• GUI to have control over each pixel in the screen

• Portable among MIDP devices when in the same screen
  resolution


                                             Displayable

                                 Screen             Canvas


                          Alert Form List TextBox   GameCanvas
Canvas
 • Canvas is a subclass of Displayable class

 • Have to extend the Canvas class
 public class Tela extends Canvas {
 }


 • Overwrite the paint() method
    protected void paint(Graphics g) {
         // do some painting!
    }
Drawing on the screen
  import javax.microedition.lcdui.*;
  class MyCanvas extends Canvas {
      public MyCanvas() {
          super();
          super.setFullScreenMode(true);
      }

      public void paint(Graphics g) {
          g.setColor(255, 255, 0);
          g.fillRect(0, 0, getWidth(),
              getHeight());
          g.setColor(0, 0, 0);
          g.drawString("Hello There",
              getWidth() / 2, 0,
              Graphics.TOP | Graphics.HCENTER);
      }
  }
Fonts
 • The Font class can be used to control the way text
   appears on the Canvas
 • Atributtes:
    • Style
    • Size
    • Face
 • Fonts usam âncoras com as coordenadas (x,y) para
   decidir ontem serão desenhadas
Fonts
public void paint(Graphics g) {
    Font f = Font.getFont(Font.FACE_PROPORTIONAL,
                          Font.STYLE_UNDERLINED,
                         Font.SIZE_LARGE);
    g.setFont(f);
    g.drawString("System Font",
            getWidth()/2, getHeight()/2,
             Graphics.TOP | Graphics.HCENTER);
}
Events
 • The developer is resposible to manage all input events

 • Input events are throw when:
    • A key is pressed ( for keyboard enabled devices)
    • The screen is touched (for touchscreen devices)
    • A command is chosen
Events
 • For keyboard enabled devices use the following methods
   to capture key events:
    • keyPressed(int keyCode)
    • keyReleased(int keyCode)
    • keyRepeated(int keyCode)

 • For touchscreen enabled devices use the following
   methods to capture touch events:
    • pointerPressed(int x, int y)
    • pointerReleased(int x, int y)
    • pointerDragged(int x, int y)
public class MyCanvas2 extends Canvas {

Events   int x,y;
         boolean firstTime = true;
         boolean userHasTouched = false;

         public void paint(Graphics g) {
            if (firstTime) {
                g.setColor(255, 255, 0);
                g.fillRect(0, 0, getWidth(),
                        getHeight());
                firstTime = false;
            }
            if (userHasTouched) {
               g.setColor(0, 0, 0);
               g.fillArc(x, y, 5, 5, 0, 360);
               userHasTouched = false;
            }
         }
         protected void pointerPressed(int x, int y) {
            this.x = x;
            this.y = y;
            userHasTouched = true;
            repaint();
         }
         }
Sample
 • Checkers Game
Game API
 • javax.microedition.lcdui.game package

 • Help to develop games quickly and help to reduce the
   size of the JAR file

 • Layers usage to create visual elements, for exemple:
    • Layer 1 – Background
    • Layer 2 – Enemy
    • Layer 3 – Player
Game API - Sample
GameCanvas            Sprite




             Sprite
Game loop
• Game loop is responible to:
  • Handle player events
  • Update game logics
  • Repaint the screen scene
  • It runs inside a separeted thread

  Graphics g = getGraphics();
  while (isRunning) {
      sleep();
      update();
      checkColisions();
      layerManager.paint(g,0,0);
      flushGraphics();
  }
Thread
 • Thread
Sprites - Frames



  {0,1,2,3,4,5,6,7,8,9,10,11,12}
Sprite
• Simplifies the Sprite management
   Image image = Image.createImage(“mysprite.png”);
   Sprite sprite = new Sprite(image, 5,5);
• Controls the Sprite movement
   sprite.move(10,10);
• Checks collisions
   sprite.collidesWith(otherSprite,false);
   sprite.collidesWith(tiledLayer,false);
   sprite.collidesWith(otherImage,20,20,false);
• Goes to the next frame of the sprite
   Sprite.nextFrame();
• Controls transformations of the sprite
   sprite.setTransform(Sprite.TRANS_ROT90);
Player inputs
• We have to get finger position

• The method pointerPressed(int x, int y) is called when
  the player touch the finger on the screen

• The method pointerDragged(int x, int y) is called when
  the player drags the finger on the screen

• The method pointerReleased(int x, int y) is called when
  the player takes the finger from the screen
      protected void pointerPressed(int x, int y) {
         move = true;
         moveTO_Y = y;
      }
Let’s code
Thanks
             Marlon Luz
 ext-marlon.luz@nokia.com
               @marlonluz

More Related Content

Similar to Game Development for Nokia Asha Devices with Java ME #2

libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
Jussi Pohjolainen
 
Developing games for Series 40 full-touch UI
Developing games for Series 40 full-touch UIDeveloping games for Series 40 full-touch UI
Developing games for Series 40 full-touch UI
Microsoft Mobile Developer
 
2011/11/20 modul8 workshop at Apple Store Ginza
2011/11/20 modul8 workshop at Apple Store Ginza2011/11/20 modul8 workshop at Apple Store Ginza
2011/11/20 modul8 workshop at Apple Store Ginza
opticious
 
CreateJS
CreateJSCreateJS
CreateJS
Jorge Solis
 
Applet life cycle
Applet life cycleApplet life cycle
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDX
Jussi Pohjolainen
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platformJussi Pohjolainen
 
Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)Marakana Inc.
 
Java4-Graphics.ppt
Java4-Graphics.pptJava4-Graphics.ppt
Java4-Graphics.ppt
DeekshithSkandaM
 
Scmad Chapter07
Scmad Chapter07Scmad Chapter07
Scmad Chapter07
Marcel Caraciolo
 
Processing and Processing.js
Processing and Processing.jsProcessing and Processing.js
Processing and Processing.js
jeresig
 
Getting Started with 3D Game Development on Nokia Series 40 Asha Phones
Getting Started with 3D Game Development on Nokia Series 40 Asha PhonesGetting Started with 3D Game Development on Nokia Series 40 Asha Phones
Getting Started with 3D Game Development on Nokia Series 40 Asha Phones
Microsoft Mobile Developer
 
Mapping the world with Twitter
Mapping the world with TwitterMapping the world with Twitter
Mapping the world with Twitter
carlo zapponi
 
Game development with Cocos2d
Game development with Cocos2dGame development with Cocos2d
Game development with Cocos2d
Vinsol
 
Silverlight as a Gaming Platform
Silverlight as a Gaming PlatformSilverlight as a Gaming Platform
Silverlight as a Gaming Platform
goodfriday
 
HTML5 Animation in Mobile Web Games
HTML5 Animation in Mobile Web GamesHTML5 Animation in Mobile Web Games
HTML5 Animation in Mobile Web Games
livedoor
 
Beginning android games
Beginning android gamesBeginning android games
Beginning android games
Mario Zechner
 
Cocos2d game programming 2
Cocos2d game programming 2Cocos2d game programming 2
Cocos2d game programming 2
Changwon National University
 

Similar to Game Development for Nokia Asha Devices with Java ME #2 (20)

libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
 
Real life XNA
Real life XNAReal life XNA
Real life XNA
 
Developing games for Series 40 full-touch UI
Developing games for Series 40 full-touch UIDeveloping games for Series 40 full-touch UI
Developing games for Series 40 full-touch UI
 
2011/11/20 modul8 workshop at Apple Store Ginza
2011/11/20 modul8 workshop at Apple Store Ginza2011/11/20 modul8 workshop at Apple Store Ginza
2011/11/20 modul8 workshop at Apple Store Ginza
 
CreateJS
CreateJSCreateJS
CreateJS
 
Applet life cycle
Applet life cycleApplet life cycle
Applet life cycle
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDX
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platform
 
Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)Graphicsand animations devoxx2010 (1)
Graphicsand animations devoxx2010 (1)
 
Java4-Graphics.ppt
Java4-Graphics.pptJava4-Graphics.ppt
Java4-Graphics.ppt
 
Scmad Chapter07
Scmad Chapter07Scmad Chapter07
Scmad Chapter07
 
Processing and Processing.js
Processing and Processing.jsProcessing and Processing.js
Processing and Processing.js
 
Java-Events
Java-EventsJava-Events
Java-Events
 
Getting Started with 3D Game Development on Nokia Series 40 Asha Phones
Getting Started with 3D Game Development on Nokia Series 40 Asha PhonesGetting Started with 3D Game Development on Nokia Series 40 Asha Phones
Getting Started with 3D Game Development on Nokia Series 40 Asha Phones
 
Mapping the world with Twitter
Mapping the world with TwitterMapping the world with Twitter
Mapping the world with Twitter
 
Game development with Cocos2d
Game development with Cocos2dGame development with Cocos2d
Game development with Cocos2d
 
Silverlight as a Gaming Platform
Silverlight as a Gaming PlatformSilverlight as a Gaming Platform
Silverlight as a Gaming Platform
 
HTML5 Animation in Mobile Web Games
HTML5 Animation in Mobile Web GamesHTML5 Animation in Mobile Web Games
HTML5 Animation in Mobile Web Games
 
Beginning android games
Beginning android gamesBeginning android games
Beginning android games
 
Cocos2d game programming 2
Cocos2d game programming 2Cocos2d game programming 2
Cocos2d game programming 2
 

More from Marlon Luz

Como a Microsoft faz software: Desgerenciando Pessoas
Como a Microsoft faz software: Desgerenciando PessoasComo a Microsoft faz software: Desgerenciando Pessoas
Como a Microsoft faz software: Desgerenciando Pessoas
Marlon Luz
 
Homo Appiens - O ser humano que desenvolve Apps. Você é um?
Homo Appiens - O ser humano que desenvolve Apps. Você é um?Homo Appiens - O ser humano que desenvolve Apps. Você é um?
Homo Appiens - O ser humano que desenvolve Apps. Você é um?
Marlon Luz
 
Microsoft & Internet of Things
Microsoft & Internet of ThingsMicrosoft & Internet of Things
Microsoft & Internet of Things
Marlon Luz
 
Construindo Universal Apps para Windows e Windows Phone
Construindo Universal Apps para Windows e Windows PhoneConstruindo Universal Apps para Windows e Windows Phone
Construindo Universal Apps para Windows e Windows Phone
Marlon Luz
 
Loja de aplicativos e portal do desenvolvedor
Loja de aplicativos e portal do desenvolvedorLoja de aplicativos e portal do desenvolvedor
Loja de aplicativos e portal do desenvolvedor
Marlon Luz
 
O que há de novo no Windows Phone
O que há de novo no Windows PhoneO que há de novo no Windows Phone
O que há de novo no Windows Phone
Marlon Luz
 
Agilidade em aplicativos mobile
Agilidade em aplicativos mobileAgilidade em aplicativos mobile
Agilidade em aplicativos mobile
Marlon Luz
 
Loja de Aplicativos e Portal do Desenvolvedor
Loja de Aplicativos e Portal do DesenvolvedorLoja de Aplicativos e Portal do Desenvolvedor
Loja de Aplicativos e Portal do Desenvolvedor
Marlon Luz
 
Desenvolvendo Apps para Windows phone
Desenvolvendo Apps para Windows phoneDesenvolvendo Apps para Windows phone
Desenvolvendo Apps para Windows phone
Marlon Luz
 
Desenvolvimento para Windows Phone
Desenvolvimento para Windows PhoneDesenvolvimento para Windows Phone
Desenvolvimento para Windows Phone
Marlon Luz
 
Babel fish, Guias e APIs
Babel fish, Guias e APIsBabel fish, Guias e APIs
Babel fish, Guias e APIs
Marlon Luz
 
Desenvolvimento de Apps para celulares Nokia Lumia & Nokia asha
Desenvolvimento de Apps para celulares Nokia Lumia & Nokia ashaDesenvolvimento de Apps para celulares Nokia Lumia & Nokia asha
Desenvolvimento de Apps para celulares Nokia Lumia & Nokia asha
Marlon Luz
 
Potencialidades de um telefone celular para pessoas com necessidades especiais
Potencialidades de um telefone celular para pessoas com necessidades especiaisPotencialidades de um telefone celular para pessoas com necessidades especiais
Potencialidades de um telefone celular para pessoas com necessidades especiais
Marlon Luz
 
Nokia Asha App Development - Part 2
Nokia Asha App Development - Part 2Nokia Asha App Development - Part 2
Nokia Asha App Development - Part 2
Marlon Luz
 
Nokia Asha App Development - Part 1
Nokia Asha App Development - Part 1Nokia Asha App Development - Part 1
Nokia Asha App Development - Part 1
Marlon Luz
 
Game Development for Nokia Asha Devices with Java ME #1
Game Development for Nokia Asha Devices with Java ME #1Game Development for Nokia Asha Devices with Java ME #1
Game Development for Nokia Asha Devices with Java ME #1
Marlon Luz
 
Distribua sua App para o mundo e ganhe $$
Distribua sua App para o mundo e ganhe $$Distribua sua App para o mundo e ganhe $$
Distribua sua App para o mundo e ganhe $$
Marlon Luz
 
Desenvolvendo Games para Nokia Asha
Desenvolvendo Games para Nokia AshaDesenvolvendo Games para Nokia Asha
Desenvolvendo Games para Nokia Asha
Marlon Luz
 
Programação para mobile: Serviços e Aplicativos
Programação para mobile: Serviços e AplicativosProgramação para mobile: Serviços e Aplicativos
Programação para mobile: Serviços e Aplicativos
Marlon Luz
 
In-app purchasing for java me apps
In-app purchasing for java me appsIn-app purchasing for java me apps
In-app purchasing for java me apps
Marlon Luz
 

More from Marlon Luz (20)

Como a Microsoft faz software: Desgerenciando Pessoas
Como a Microsoft faz software: Desgerenciando PessoasComo a Microsoft faz software: Desgerenciando Pessoas
Como a Microsoft faz software: Desgerenciando Pessoas
 
Homo Appiens - O ser humano que desenvolve Apps. Você é um?
Homo Appiens - O ser humano que desenvolve Apps. Você é um?Homo Appiens - O ser humano que desenvolve Apps. Você é um?
Homo Appiens - O ser humano que desenvolve Apps. Você é um?
 
Microsoft & Internet of Things
Microsoft & Internet of ThingsMicrosoft & Internet of Things
Microsoft & Internet of Things
 
Construindo Universal Apps para Windows e Windows Phone
Construindo Universal Apps para Windows e Windows PhoneConstruindo Universal Apps para Windows e Windows Phone
Construindo Universal Apps para Windows e Windows Phone
 
Loja de aplicativos e portal do desenvolvedor
Loja de aplicativos e portal do desenvolvedorLoja de aplicativos e portal do desenvolvedor
Loja de aplicativos e portal do desenvolvedor
 
O que há de novo no Windows Phone
O que há de novo no Windows PhoneO que há de novo no Windows Phone
O que há de novo no Windows Phone
 
Agilidade em aplicativos mobile
Agilidade em aplicativos mobileAgilidade em aplicativos mobile
Agilidade em aplicativos mobile
 
Loja de Aplicativos e Portal do Desenvolvedor
Loja de Aplicativos e Portal do DesenvolvedorLoja de Aplicativos e Portal do Desenvolvedor
Loja de Aplicativos e Portal do Desenvolvedor
 
Desenvolvendo Apps para Windows phone
Desenvolvendo Apps para Windows phoneDesenvolvendo Apps para Windows phone
Desenvolvendo Apps para Windows phone
 
Desenvolvimento para Windows Phone
Desenvolvimento para Windows PhoneDesenvolvimento para Windows Phone
Desenvolvimento para Windows Phone
 
Babel fish, Guias e APIs
Babel fish, Guias e APIsBabel fish, Guias e APIs
Babel fish, Guias e APIs
 
Desenvolvimento de Apps para celulares Nokia Lumia & Nokia asha
Desenvolvimento de Apps para celulares Nokia Lumia & Nokia ashaDesenvolvimento de Apps para celulares Nokia Lumia & Nokia asha
Desenvolvimento de Apps para celulares Nokia Lumia & Nokia asha
 
Potencialidades de um telefone celular para pessoas com necessidades especiais
Potencialidades de um telefone celular para pessoas com necessidades especiaisPotencialidades de um telefone celular para pessoas com necessidades especiais
Potencialidades de um telefone celular para pessoas com necessidades especiais
 
Nokia Asha App Development - Part 2
Nokia Asha App Development - Part 2Nokia Asha App Development - Part 2
Nokia Asha App Development - Part 2
 
Nokia Asha App Development - Part 1
Nokia Asha App Development - Part 1Nokia Asha App Development - Part 1
Nokia Asha App Development - Part 1
 
Game Development for Nokia Asha Devices with Java ME #1
Game Development for Nokia Asha Devices with Java ME #1Game Development for Nokia Asha Devices with Java ME #1
Game Development for Nokia Asha Devices with Java ME #1
 
Distribua sua App para o mundo e ganhe $$
Distribua sua App para o mundo e ganhe $$Distribua sua App para o mundo e ganhe $$
Distribua sua App para o mundo e ganhe $$
 
Desenvolvendo Games para Nokia Asha
Desenvolvendo Games para Nokia AshaDesenvolvendo Games para Nokia Asha
Desenvolvendo Games para Nokia Asha
 
Programação para mobile: Serviços e Aplicativos
Programação para mobile: Serviços e AplicativosProgramação para mobile: Serviços e Aplicativos
Programação para mobile: Serviços e Aplicativos
 
In-app purchasing for java me apps
In-app purchasing for java me appsIn-app purchasing for java me apps
In-app purchasing for java me apps
 

Recently uploaded

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 

Recently uploaded (20)

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 

Game Development for Nokia Asha Devices with Java ME #2

  • 1. Game Development for Nokia Asha Devices with Java ME Marlon Luz - INdT Nokia Developer Evangelist @marlonluz
  • 2. Low-Level UI API • GUI to have control over each pixel in the screen • Portable among MIDP devices when in the same screen resolution Displayable Screen Canvas Alert Form List TextBox GameCanvas
  • 3. Canvas • Canvas is a subclass of Displayable class • Have to extend the Canvas class public class Tela extends Canvas { } • Overwrite the paint() method protected void paint(Graphics g) { // do some painting! }
  • 4. Drawing on the screen import javax.microedition.lcdui.*; class MyCanvas extends Canvas { public MyCanvas() { super(); super.setFullScreenMode(true); } public void paint(Graphics g) { g.setColor(255, 255, 0); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(0, 0, 0); g.drawString("Hello There", getWidth() / 2, 0, Graphics.TOP | Graphics.HCENTER); } }
  • 5. Fonts • The Font class can be used to control the way text appears on the Canvas • Atributtes: • Style • Size • Face • Fonts usam âncoras com as coordenadas (x,y) para decidir ontem serão desenhadas
  • 6. Fonts public void paint(Graphics g) { Font f = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_UNDERLINED, Font.SIZE_LARGE); g.setFont(f); g.drawString("System Font", getWidth()/2, getHeight()/2, Graphics.TOP | Graphics.HCENTER); }
  • 7. Events • The developer is resposible to manage all input events • Input events are throw when: • A key is pressed ( for keyboard enabled devices) • The screen is touched (for touchscreen devices) • A command is chosen
  • 8. Events • For keyboard enabled devices use the following methods to capture key events: • keyPressed(int keyCode) • keyReleased(int keyCode) • keyRepeated(int keyCode) • For touchscreen enabled devices use the following methods to capture touch events: • pointerPressed(int x, int y) • pointerReleased(int x, int y) • pointerDragged(int x, int y)
  • 9. public class MyCanvas2 extends Canvas { Events int x,y; boolean firstTime = true; boolean userHasTouched = false; public void paint(Graphics g) { if (firstTime) { g.setColor(255, 255, 0); g.fillRect(0, 0, getWidth(), getHeight()); firstTime = false; } if (userHasTouched) { g.setColor(0, 0, 0); g.fillArc(x, y, 5, 5, 0, 360); userHasTouched = false; } } protected void pointerPressed(int x, int y) { this.x = x; this.y = y; userHasTouched = true; repaint(); } }
  • 11. Game API • javax.microedition.lcdui.game package • Help to develop games quickly and help to reduce the size of the JAR file • Layers usage to create visual elements, for exemple: • Layer 1 – Background • Layer 2 – Enemy • Layer 3 – Player
  • 12. Game API - Sample GameCanvas Sprite Sprite
  • 13. Game loop • Game loop is responible to: • Handle player events • Update game logics • Repaint the screen scene • It runs inside a separeted thread Graphics g = getGraphics(); while (isRunning) { sleep(); update(); checkColisions(); layerManager.paint(g,0,0); flushGraphics(); }
  • 15. Sprites - Frames {0,1,2,3,4,5,6,7,8,9,10,11,12}
  • 16. Sprite • Simplifies the Sprite management Image image = Image.createImage(“mysprite.png”); Sprite sprite = new Sprite(image, 5,5); • Controls the Sprite movement sprite.move(10,10); • Checks collisions sprite.collidesWith(otherSprite,false); sprite.collidesWith(tiledLayer,false); sprite.collidesWith(otherImage,20,20,false); • Goes to the next frame of the sprite Sprite.nextFrame(); • Controls transformations of the sprite sprite.setTransform(Sprite.TRANS_ROT90);
  • 17. Player inputs • We have to get finger position • The method pointerPressed(int x, int y) is called when the player touch the finger on the screen • The method pointerDragged(int x, int y) is called when the player drags the finger on the screen • The method pointerReleased(int x, int y) is called when the player takes the finger from the screen protected void pointerPressed(int x, int y) { move = true; moveTO_Y = y; }
  • 19. Thanks Marlon Luz ext-marlon.luz@nokia.com @marlonluz