Nessa apresentação demonstro como arquitetar uma aplicação Android utilizando as bibliotecas do Jetpack. O exemplo apresentado utiliza MVVM+Clean:
- Na camada de dados local, Room com Coroutines e Flow;
- View Model, Live Data e Data Binding na camada de apresentação;
- Fragments com a Navigation API na camada de UI.
O app também conta com uma implementação de banco de dados remoto utilizando Firebase.
See project site: www.heron-mc.org . Presentation of the Heron Mapping Client at the OSGeo Bolsena Codesprint 2012. Heron is a browser-based JavaScript client for visualizaing and manipullating geospatial maps and data. Heron MC is based on OpenLayers, GeoExt and ExtJS and is Open Source under the GPL v3 license.
Short intro to the Heron Mapping Client at the OpenGeoGroep Viewer Shootout event onDec 14, 2012. Heron is about Web Mapping, leveraging the power of great frameworks like GeoExt, ExtJS and OpenLayers.
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...gamifi.cc
gamifi.cc team - Rudolf & Matej presented on local tech/mobile/games conference experience with Unity & game development in general.
We also list some other tools that might help you. First part covers business tips & reasons to use Unity.
Nessa apresentação demonstro como arquitetar uma aplicação Android utilizando as bibliotecas do Jetpack. O exemplo apresentado utiliza MVVM+Clean:
- Na camada de dados local, Room com Coroutines e Flow;
- View Model, Live Data e Data Binding na camada de apresentação;
- Fragments com a Navigation API na camada de UI.
O app também conta com uma implementação de banco de dados remoto utilizando Firebase.
See project site: www.heron-mc.org . Presentation of the Heron Mapping Client at the OSGeo Bolsena Codesprint 2012. Heron is a browser-based JavaScript client for visualizaing and manipullating geospatial maps and data. Heron MC is based on OpenLayers, GeoExt and ExtJS and is Open Source under the GPL v3 license.
Short intro to the Heron Mapping Client at the OpenGeoGroep Viewer Shootout event onDec 14, 2012. Heron is about Web Mapping, leveraging the power of great frameworks like GeoExt, ExtJS and OpenLayers.
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...gamifi.cc
gamifi.cc team - Rudolf & Matej presented on local tech/mobile/games conference experience with Unity & game development in general.
We also list some other tools that might help you. First part covers business tips & reasons to use Unity.
Ten practical ways to improve front-end performanceAndrew Rota
Conference talk presented at PHP South Coast 2017. Ten concrete ways to improve web performance, split between quick tactical wins and longer-term overarching strategies.
Scene Graphs & Component Based Game EnginesBryan Duggan
A presentation I made at the Fermented Poly meetup in Dublin about Scene Graphs & Component Based Game Engines. Lots of examples from my own game engine BGE - where almost everything is a component. Get the code and the course notes here: https://github.com/skooter500/BGE
DrupalGap. How to create native application for mobile devices based on Drupa...DrupalCampDN
Рано или поздно каждый сайт нуждается в мобильной версии. Существует несколько способов реализации мобильной версии: адаптивный сайт, нативное приложение для iOS, Android etc.
В создании нативного приложения нам поможет отличная платформа под названием DrupalGap. DrupalGap - это платформа позволяющая создавать приложения для iOS и Android при помощи Drupal, PhoneGap, jQueryMobile, без непосредственного программирования на языке платформы.
Developing cross platform desktop application with RubyAnis Ahmad
A brief introduction and example of developing desktop application with Ruby programming language. JRuby and shoesrb is discussed as platform.
Prepared for and Presented on Ruby Conference Bangladesh 2003.
Why and when you need end-to-end tests, a spooky story with a 15 years software beast, and how to develop concise, maintainable functional tests using Groovy, Spock and Geb.
Ever wondered how to get rid of that spaghetti, single-filed JavaScript code? Wouldn't it be nice if you could write maintainable modules, easily test them, port them to different projects, handle its library dependencies, and have them decoupled from other modules?
In this talk, we'll see how using the AMD API and an event-driven design will help taming an application's JavaScript code and scaling it to the future and beyond.
Ten practical ways to improve front-end performanceAndrew Rota
Conference talk presented at PHP South Coast 2017. Ten concrete ways to improve web performance, split between quick tactical wins and longer-term overarching strategies.
Scene Graphs & Component Based Game EnginesBryan Duggan
A presentation I made at the Fermented Poly meetup in Dublin about Scene Graphs & Component Based Game Engines. Lots of examples from my own game engine BGE - where almost everything is a component. Get the code and the course notes here: https://github.com/skooter500/BGE
DrupalGap. How to create native application for mobile devices based on Drupa...DrupalCampDN
Рано или поздно каждый сайт нуждается в мобильной версии. Существует несколько способов реализации мобильной версии: адаптивный сайт, нативное приложение для iOS, Android etc.
В создании нативного приложения нам поможет отличная платформа под названием DrupalGap. DrupalGap - это платформа позволяющая создавать приложения для iOS и Android при помощи Drupal, PhoneGap, jQueryMobile, без непосредственного программирования на языке платформы.
Developing cross platform desktop application with RubyAnis Ahmad
A brief introduction and example of developing desktop application with Ruby programming language. JRuby and shoesrb is discussed as platform.
Prepared for and Presented on Ruby Conference Bangladesh 2003.
Why and when you need end-to-end tests, a spooky story with a 15 years software beast, and how to develop concise, maintainable functional tests using Groovy, Spock and Geb.
Ever wondered how to get rid of that spaghetti, single-filed JavaScript code? Wouldn't it be nice if you could write maintainable modules, easily test them, port them to different projects, handle its library dependencies, and have them decoupled from other modules?
In this talk, we'll see how using the AMD API and an event-driven design will help taming an application's JavaScript code and scaling it to the future and beyond.
“Intoduction To Game Development ”
This sesion will be covering some aspects of the theory and practice of game development and design .
- For those who are intersted in game development , This session will should be enough to get you started .
In dieser Session werfen wir einen Blick auf die Android Platform jenseits der Dalvik VM. Wir entdecken den Android Source Code und erklären wo sich interessante Beispiele und Referenzen für App-Entwickler sowie nützliche Tools verbergen. Ein High-Level Überblick über die Platform-Architektur und das Platform-Build-System runden die Session ab.
Presented by Brian Gupta (brian.gupta@brandorr.com) and Nathan Freitas (nathan@olivercoady.com)
Learn more at http://tinyurl.com/androidfaq
Android is a fully integrated and open source bundle of software significantly lowers the current costs of developing mobile devices (currently runs on a cellphone (the HTC Dream/T-Mobile G1), and a number of unofficial "ports". It consists of an operating system, middleware, a user-friendly interface and powerful applications.
The talk will start with a review of the internal architecture of the Android platform, breaking down the various components, and examine how they work. Then we will review the latest status of the open source project, including how to get and build the source code, and how to get involved.
Android 101 - Introduction to Android DevelopmentAndy Scherzinger
Introduction to Android development at the relaunch meetup of the Mobile Development FFM User Group in Frankfurt giving an introduction to basic principles like Activities, Fragments, life cycle, activity state, how to deal with fragmentation and some best practices and hints at the end.
Ionic Framework - get up and running to build hybrid mobile appsAndreas Sahle
Overview over frameworks for hybrid app development. Cordova, Supersonic, Ionic. Architecture, differences, setup and scaffolding for development. Angular based development for Apps with a web view.
Introduction to PhoneGap
Background
Setting up the environment for Android
Handling Events
Working With The Device, The Network, And Notifications
Getting Information from the Device
Determining the Connection Type
Using Notifications
Using Alerts
Using Confirmation Dialogs
Using Beeps
Using Vibrations
Accelerometer
Using the Acceleration Object
Using Accelerometer Methods
Media
The Media Object
Using Media Methods
Camera
Using The Camera Object
Using The Getpicture Method
Using Camera Options
Geolocation
Position, PositionError, Coord
Geolocation Methods
Geolocation Options
Deployment using Phonegap (Android)
Hands-on exercises
Storage
Available options
Db object
localStorage
Files
Filessystem
File read & write
Handling errors
Contacts
Creating contacts
Finding contacts
Handling errors
Capture
Video
Audio
Handling errors
Hands-on exercises
Introduction to PhoneGap
Background
Setting up the environment for Android
Handling Events
Working With The Device, The Network, And Notifications
Getting Information from the Device
Determining the Connection Type
Using Notifications
Using Alerts
Using Confirmation Dialogs
Using Beeps
Using Vibrations
Accelerometer
Using the Acceleration Object
Using Accelerometer Methods
Media
The Media Object
Using Media Methods
Camera
Using The Camera Object
Using The Getpicture Method
Using Camera Options
Geolocation
Position, PositionError, Coord
Geolocation Methods
Geolocation Options
Deployment using Phonegap (Android)
Hands-on exercises
Storage
Available options
Db object
localStorage
Files
Filessystem
File read & write
Handling errors
Contacts
Creating contacts
Finding contacts
Handling errors
Capture
Video
Audio
Handling errors
Hands-on exercises
Don Thorp & Marshall Culpepper: Advanced Titanium Development for AndroidAxway Appcelerator
In this presentation, we will provide an overview of native Android tooling and some of its uses. We will also cover several Android specific concepts and APIs and discuss how you can use them when creating a best of breed application.
Tooling
- DDMS
- adb (Android Debug Bridge)
- android (Downloading SDKs, Managing AVDs)
APIs
- Android Lifecycle Events
- Intents, Activities, Notifications
- Javascript Activities
- Resources
- Android Section of tiapp.xml
If you want to start a good career in Android Development, this presentation gives you a basic introduction about Android, and how you can develop your very first Android Application.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
8. libGDX
Project
• LibGDX
project
contains
other
projects
• Subprojects
for
each
target
– android/
– desktop/
– gwt/
– ios/
– core/
• One
Core
subproject
for
the
actual
logic
for
the
game,
target
projects
contains
only
launcher
classes
9. Compiling
• LibGDX
uses
Gradle
for
compiling
• Gradle
uses
domain-‐specific
language
(DSL)
to
define
targets
(android/ios...)
and
dependencies
• When
compiling,
gradle
reads
build.gradle
file
that
contains
DSL
that
describes
all
the
necessary
informaAon
how
to
compile
10. Workflow
• Create
libGDX
project
using
gdx-‐setup.jar
• Import
the
project
to
IntelliJ
IDEA
or
Eclipse
• Implement
your
code
in
the
core/
submodule
• Test
in
Android
Device
or
Desktop,
forget
the
emulator
11. Using
libGDX
in
commandline
• Running
– Desktop
• gradlew desktop:run
– Android
• gradlew android:installDebug android:run
• Packaging
– Desktop
• gradlew desktop:dist
– Android
(a^er
this,
you
must
sign
the
.apk)
• gradlew android:assembleRelease
13. App
Framework:
ApplicaCon
• ApplicaCon
–
main
entry
point
for
your
app
– h_p://libgdx.badlogicgames.com/nightlies/docs/api/com/
badlogic/gdx/ApplicaAon.html
• Equivalent
to
JFrame
(Swing)
or
Activity
(Android)
• Informs
your
game
about
events
such
as
window
resizing
• Developer
creates
a
class
that
implements
ApplicationListener,
methods
are
called
by
Application
– ApplicaAon
can
be
GwtApplication,
IOSApplication
…
14.
15.
16.
17. About
Starter
Classes
• For
each
plaVorm
(iOS,
Android,
Desktop
..)
a
starter
class
must
be
wri_en
• Starter
classes
are
plaTorm
dependent
• We
will
focus
on
– Desktop
(LWJGL)
– Android
18. LWJGL?
• Lightweight
Java
Game
Library
(LWJGL)
framework
for
creaAng
games
with
Java
• libGDX
is
built
on
top
of
LWJGL
• See
more:
– http://www.lwjgl.org/
19. Starter
Classes:
Desktop
// This is platform specific: Java SE
public class DesktopStarter {
public static void main(String[] argv) {
LwjglApplicationConfiguration config
= new LwjglApplicationConfiguration();
config.title = “…”;
config.width = 480;
config.heigth = 320;
new LwjglApplication(new MyGame(), config);
}
}
20. Starter
Classes:
Android
import android.os.Bundle;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
// This is platform specific: Android
// No main
public class AndroidLauncher extends AndroidApplication {
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
MyGame game = new MyGame();
initialize(game, config);
if(this.getApplicationListener() == game) {
this.log("test", "success");
}
}
}
28. Other
important
Modules
(Interfaces)
• ApplicaAon
– Informs
your
game
about
events
• Files
– Exposes
the
underlying
file
system
• Input
– Mouse,
keyboard,
touch,
accelerometer
• Net*
– Access
HTTP(S)
• Audio
– Enables
sound
• Graphics
– Exposes
OpenGL
ES
2.0
where
available
29. Accessing
Modules
• All
modules
(previous
slide)
can
be
accessed
via
staAc
fields
of
Gdx
–
class
– Global
public
variables
for
easy
access
• Example
– AudioDevice audioDevice =
Gdx.audio.newAudioDevice(44100, false);
30. Javadoc:
Gdx
Gdx.audio
(Interface)
is
a
reference
to
the
backend
implementaAon
that
has
been
instanAated
on
applicaAon
startup
by
the
ApplicaAon
instance.
32. Querying
• ApplicaAon
(Gdx.app)
interface
provides
various
methods
to
query
properAes
– if(Gdx.app.getType() == Android) { … }
33. Assets
• Drag
sounds,
images
to
android/assets
folder
– Desktop
app
has
a
link
to
that
folder
34. Asset
loading
public class MyGame implements ApplicationListener {
private Texture gorbaImage;
private Sound soundEffect;
private Music backgroundMusic;
@Override
public void create() {
// gorba.png uploaded to GPU and is ready to be used by OpenGL. Image format
// must be .jpg, .png, .bmp
gorbaImage = new Texture(Gdx.files.internal(”gorba.png"));
// Stored in RAM
soundEffect = Gdx.audio.newSound(Gdx.files.internal("beep.wav"));
// Streamed from wherever it’s stored
backgroundMusic = Gdx.audio.newMusic(Gdx.files.internal("ussranthem.mp3"));
// start the playback of the background music immediately
rainMusic.setLooping(true);
rainMusic.play();
public void dispose() {
// Good practice to dispose (clean) assets
gorbaImage.dispose();
soundEffect.dispose();
backgroundMusic.dispose();
}
36. Rendering:
Camera
• Camera
is
like
“virtual
window
into
our
world”
– What
part
of
the
“world”
is
visible?
• World
may
be
bigger
than
visible
area
• Camera
– OrthographicCamera
• When
the
human
eye
looks
at
a
scene,
objects
in
the
distance
appear
smaller
than
objects
close
by.
Orthographic
projecHon
ignores
this
effect
– PerspectiveCamera
• Closer
objects
appear
bigger
in
PerspecAveCamera
37. Using
Camera
public class SimpleGame extends ApplicationAdapter {
private OrthographicCamera camera;
@Override
public void create() {
// Our visible world is 800 x 480, it does
// not matter if these are pixels or meters or
// "units". Just make sure you have the right
// aspect ratio! Example, the desktop window may be
// 640 x 400 pixels but in our game we are using
// these units: 800 x 480...
// When the world width and heigth is set, we need to
// configure what part of the world the camera is filming
// By using false, we simple state that y-axis is pointing
// up and camera is centered to width / 2 and height / 2
camera = new OrthographicCamera(false, 800, 480);
38. Word
about
OpenGL
• OpenGL
(Open
Graphics
Library)
is
a
cross-‐language,
mulA-‐plaTorm
applicaAon
programming
interface
(API)
for
rendering
2D
and
3D
vector
graphics.
• The
API
is
typically
used
to
interact
with
a
graphics
processing
unit
(GPU),
to
achieve
hardware-‐
accelerated
rendering.
• Widely
used
in
CAD,
virtual
reality,
scienAfic
visualizaAon,
informaAon
visualizaAon,
flight
simulaAon,
and
video
games.
• libGDX
uses
OpenGL
ES
and
has
interface
also
for
direct
access
for
OpenGL
39. Texture
Mapping
• A
Texture
–
class
wraps
a
standard
OpenGL
ES
texture.
– A
texture
is
an
OpenGL
Object
that
contains
one
or
more
images
that
all
have
the
same
image
format.
• Image
loaded
into
the
GPU’s
memory
in
raw
format
• Texture
mapping
is
process
of
working
out
where
in
space
the
texture
will
be
applied
– “To
sAck
a
poster
on
a
wall,
one
needs
to
figure
out
where
on
the
wall
he
will
be
gluing
the
corners
of
the
paper”
– Space
ó
Wall
– Mesh
(Rectangle)
ó
Paper
– Image
on
paper
ó
Texture
40. SpriteBatch
• SpriteBatch
class
takes
care
of
texture
mapping
• Convenience
class
which
makes
drawing
onto
the
screen
easy
41. package fi.tamk.tiko.policequest;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class PoliceQuestGame extends ApplicationAdapter {
private SpriteBatch batch;
private Texture policeTexture;
private OrthographicCamera camera;
@Override
public void create () {
camera = new OrthographicCamera();
camera.setToOrtho(false, 1280, 720);
batch = new SpriteBatch();
policeTexture = new Texture("policeman-icon.png");
}
@Override
public void render () {
Gdx.gl.glClearColor(0.8f, 0.8f, 0.8f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(policeTexture, 0, 0);
batch.draw(policeTexture, policeTexture.getWidth(), 0);
batch.end();
}
}
42.
43. Clear
Screen
public void render() {
// Direct OpenGL call
// float red [0,1]
// green
// blue
// alpha
// https://www.opengl.org/sdk/docs/man/html/glClearColor.xhtml
Gdx.gl.glClearColor(0, 0, 0.2f, 1);
// Clear the screen with the color chosen
// http://www.opengl.org/sdk/docs/man/html/glClear.xhtml
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
// SpriteBatch is ready for commands
batch.begin();
....
// No commands anymore, proceed to process the batch of commands
// received
batch.end();
}
44. About
ResoluAon
• Game
can
be
cross-‐plaTorm,
what
is
the
resoluAon?
• We
have
two
resoluAons
– The
real
resoluHon
– The
world
resoluHon
• Mapping
must
be
done
between
these
two!
45. Real
resoluAon
0,0
World
resoluAon
0,720
Real
resoluAon
0,720
World
resoluAon
0,0
Window
resoluAon
1280
x
720
World
resoluAon
set
to
1280
x
720
Real
resoluAon
1280,0
World
resoluAon
1280,720
Real
resoluAon
1280,720
World
resoluAon
1280,0
46. Real
resoluAon
0,0
World
resoluAon
0,720
Real
resoluHon
0,144
World
resoluAon
0,0
Real
resoluHon
256,0
World
resoluAon
1280,720
Real
resoluHon
256,144
World
resoluAon
1280,0
47. Conversion
between
Real
and
World
-‐
ResoluAons
@Override
public void render() {
if(Gdx.input.isTouched()) {
int realX = Gdx.input.getX();
int realY = Gdx.input.getY();
// Encapsulated 3D Vector, only 2D is used
// Vectors can be used for represent a direction and position
// Bad practice to instantiate every render – call!
Vector3 touchPos = new Vector3(realX, realY, 0);
// Function to translate a point given in screen
// coordinates to world space.
camera.unproject(touchPos);
Gdx.app.log("MyGame", "real X = " + realX);
Gdx.app.log("MyGame", "real Y = " + realY);
Gdx.app.log("MyGame", "world X = " + touchPos.x);
Gdx.app.log("MyGame", "world Y = " + touchPos.y);
}
}
48. Gdx.input
• Genng
input
from
user
is
very
easy
• Touch
– Gdx.input.isTouched()
– Gdx.input.getX()
– Gdx.input.getY()
• Accelerometer
– Gdx.input.getAccelerometerX()
– Gdx.input.getAccelerometerY()
– Gdx.input.getAccelerometerZ()
49. Collision
• Simple
collision
detecAon
is
done
using
overlaps
method
of
Rectangle
• Remember
Texture
Mapping?
– Texture
(image)
– Mesh
(rectangle)
• Create
rectangle
for
each
texture!
– if(rect1.overlaps(rect2))
{
..
}
50. public class SimpleGame extends ApplicationAdapter {
private Texture gorbaImage;
private Rectangle gorbaRectangle;
private Texture phoneImage;
private Rectangle phoneRectangle;
@Override
public void create() {
gorbaImage = new Texture(Gdx.files.internal("littlegorba.png"));
phoneImage = new Texture(Gdx.files.internal("phone.png"));
// new Rectangle (x, y, width, height)
gorbaRectangle = new Rectangle(200, 200, gorbaImage.getWidth(), gorbaImage.getHeight());
phoneRectangle = new Rectangle(300, 300, gorbaImage.getWidth(), phoneImage.getHeight());
}
@Override
public void render() {
batch.begin();
batch.draw(gorbaImage, gorbaRectangle.x, gorbaRectangle.y);
batch.draw(phoneImage, phoneRectangle.x, phoneRectangle.x);
batch.end();
if(Gdx.input.isTouched()) {
int realX = Gdx.input.getX();
int realY = Gdx.input.getY();
Vector3 touchPos = new Vector3(realX, realY, 0);
camera.unproject(touchPos);
gorbaRectangle.x = touchPos.x;
gorbaRectangle.y = touchPos.y;
}
if(gorbaRectangle.overlaps(phoneRectangle)) {
Gdx.app.log("MyGame", "Crash!");
}
}
}
}
52. FPS?
• Frame
rate,
also
known
frames
per
second
(FPS),
rate
at
which
an
imaging
device
produces
unique
consecuAve
images
called
frames
• LibGDX
tries
to
call
the
render()
method
as
fast
as
possible
• When
it
reaches
60
fps,
it
stops,
no
need
to
update
any
faster
• You
can
query
the
FPS:
– Gdx.graphics.getFramesPerSecond()
53. Moving
Game
Objects
• Problem?
– if(le^
arrow
is
pressed)
{
x
=
x
+
speed
)
• If
this
is
called
60
Ames
per
second,
the
object
moves
fast
• If
this
is
called
10
Ames
per
second,
the
object
moves
slow!
• Now
your
game
is
implemented
so
that
the
game
speed
varies
in
different
mobile
devices!
54. Delta
Ame
• Delta
Ame
–
elapsed
Ame
since
the
last
update
in
millisecs
– If
fps
is
60,
delta
Ame
is
1
/
60
=>
0.016
– If
fps
is
30,
delta
Ame
is
1
/
30
=>
0.033
• To
get
the
delta
Ame
– Gdx.graphics.getDeltaTime()
• Now
use:
• if(le^
arrow
is
pressed)
{
x
=
x
+
speed
*
delta
)
56. Tips
• If
you
create
everything
in
one
class,
it's
going
to
be
crowded...
• You
could
create
class
for
each
game
object
• For
example
– AlienGameObject, BulletGameObject,
SpaceShipGameObject
57. GameObject
• Game
object
may
hold
– Texture texture;
– Rectangle rectangle;
– float speedX;
– float speedY;
• If
all
of
your
game
objects
hold
common
features,
you
could
use
inheritance
– class Spaceship extends GameObject
– class Alien extends GameObject
• In
fact
we
already
have
the
"GameObject"
in
LibGDX,
it's
called
Sprite