The document discusses LibGDX's support for internationalization and scene 2D.
It describes how to create property files for different languages to support internationalization in LibGDX games. It then provides an overview of Scene2D, describing it as an optional higher-level framework for creating 2D games and UIs using stages, actors, and events. It includes code examples of creating a stage and adding an actor, as well as handling input events with actors.
A split screen-viable UI event system - Unite Copenhagen 2019Unity Technologies
Learn about the implementation of a 2-player split-screen user interface (UI) in Battle Planet Judgement Day. In Unity, the Event System allows only one element to be currently selected, which can be a problem when designing split screen UI. In this session, you'll discover how this issue was addressed in Battle Planet Judgement Day, the ups and downs of the implementation, insights on pitfalls to avoid and best practices learned during the time of development. We hope this will help you learn how to implement your own solution.
Speaker: Kevin Hagen - Threaks
Session available here: https://youtu.be/aR5UXatawmE
Take a dive deep into the new prefab features with developers Steen Lund. What's the inside versus outside of a prefab? How does it relate to Prefab mode, overrides, unpacking, and prefab variants? How has the new prefab back-end changed? This session will give you a better understanding of the Prefab system, the pros and cons of various implementation decisions, and some Aha moments working with Prefab nesting.
Cross-scene references: A shock to the system - Unite Copenhagen 2019Unity Technologies
Discover the GUID Based reference workflow, with a focus on Multi-Scene workflows, save game, and how these all came together in System Shock 3. You'll learn about the reason for wanting a stable instance Id, why Unity doesn't have one out of the box, what this implementation does, and how you can use it in your own projects. System Shock 3 is a great example of this tool's power, but demonstrates how it can be tricky too.
Speaker:
William Armstrong - Unity
A split screen-viable UI event system - Unite Copenhagen 2019Unity Technologies
Learn about the implementation of a 2-player split-screen user interface (UI) in Battle Planet Judgement Day. In Unity, the Event System allows only one element to be currently selected, which can be a problem when designing split screen UI. In this session, you'll discover how this issue was addressed in Battle Planet Judgement Day, the ups and downs of the implementation, insights on pitfalls to avoid and best practices learned during the time of development. We hope this will help you learn how to implement your own solution.
Speaker: Kevin Hagen - Threaks
Session available here: https://youtu.be/aR5UXatawmE
Take a dive deep into the new prefab features with developers Steen Lund. What's the inside versus outside of a prefab? How does it relate to Prefab mode, overrides, unpacking, and prefab variants? How has the new prefab back-end changed? This session will give you a better understanding of the Prefab system, the pros and cons of various implementation decisions, and some Aha moments working with Prefab nesting.
Cross-scene references: A shock to the system - Unite Copenhagen 2019Unity Technologies
Discover the GUID Based reference workflow, with a focus on Multi-Scene workflows, save game, and how these all came together in System Shock 3. You'll learn about the reason for wanting a stable instance Id, why Unity doesn't have one out of the box, what this implementation does, and how you can use it in your own projects. System Shock 3 is a great example of this tool's power, but demonstrates how it can be tricky too.
Speaker:
William Armstrong - Unity
Building a turn-based game prototype using ECS - Unite Copenhagen 2019Unity Technologies
Get a high-level overview of the Entity Component System (ECS) and turn-based game loops, and see a proof of concept built using ECS. These slides will cover some of the pitfalls and also show concepts of ECS in a slightly exotic context.
Speaker:
Florian Uhde - Three Eyed Games
Watch the session on YouTube: https://youtu.be/mL4qrt-15TE
At Unite Copenhagen, this talk detailed the process of converting GameObjects to Entities and how this can be extended and customized.
Speakers:
Simon Mogensen – Unity
Fabrice Léte – Unity Technologies
Watch the session on YouTube: https://youtu.be/TdlhTrq1oYk
Unity asset workflows for Film and Animation pipelines - Unite Copenhagen 2019Unity Technologies
The use of Unity in film and animation pipelines is still a growing area, and the best way to get started isn't often clear to new users. We'll cover the necessary methods and steps for getting data from external content sources into and out of Unity, with a focus on industry standard technologies and applications, such as Universal Scene Description (USD) and Alembic.
Speaker:
Chris Redmann - Unity
Watch the session on YouTube: https://youtu.be/BtKMvecBIbc
Custom SRP and graphics workflows - Unite Copenhagen 2019Unity Technologies
Battle Planet - Judgement Day is a unique game in the sense that it's played entirely on a single sphere (the planet). Levels are fully procedural and fully destructible. This structure created a few big challenges in terms of rendering, which were solved by writing a custom Scriptable Render Pipeline for the game. This session provides an overview of the game's rendering features and how they were implemented using SRP. It includes a few examples of how performance issues influenced the design of the pipeline as well as a discussion about shader programming and design patterns.
Speaker:
Henning Steinbock - Threaks
Session available here: https://youtu.be/91zUwJwkXNQ
We Love Performance! How Tic Toc Games Uses ECS in Mobile Puzzle GamesUnity Technologies
Tic Toc Games recently implemented Unity's Entity Component System (ECS) in their mobile puzzle engine, which brought both great performance improvements and faster iteration time. This intermediate-level session will explain why ECS is able to process data much faster, how they increased iteration speed using ECS, and their experience learning and working with Unity's ECS package.
Garth Smith - Tic Toc Games
Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, and 2D video frame buffer - a core component of the PDK.
Over the past couple of years the SDL Perl bindings have gone through a complete rewrite, making them modular, stable, faster, multiplatform, 1:1 compatible with libsdl and fixing several memory leaks while at it.
The community is more alive than ever and now the SDL Perl project is ready to move the Perl motto into gamedev:
"Simple games, easy. Complex games, possible."
In this talk I'll discuss some of the sugar layers being developed on top of SDL Perl, including game loops, widgets, physics engines and full-fledged frameworks for easy game development.
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
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.
Programming with Segue
Dynamic design through coding
Views and its Co-ordinates
Core animations
Picture pickers
Sound manager
Address book picker
- Hussain KMR Behestee
Software developers need more space to think, scribble, and hold their thoughts about programming tasks. Code Pad is a multi-touch tablet that allows developers interact with several programming elements in support of tasks such as refactoring or keeping reminders.
Building a turn-based game prototype using ECS - Unite Copenhagen 2019Unity Technologies
Get a high-level overview of the Entity Component System (ECS) and turn-based game loops, and see a proof of concept built using ECS. These slides will cover some of the pitfalls and also show concepts of ECS in a slightly exotic context.
Speaker:
Florian Uhde - Three Eyed Games
Watch the session on YouTube: https://youtu.be/mL4qrt-15TE
At Unite Copenhagen, this talk detailed the process of converting GameObjects to Entities and how this can be extended and customized.
Speakers:
Simon Mogensen – Unity
Fabrice Léte – Unity Technologies
Watch the session on YouTube: https://youtu.be/TdlhTrq1oYk
Unity asset workflows for Film and Animation pipelines - Unite Copenhagen 2019Unity Technologies
The use of Unity in film and animation pipelines is still a growing area, and the best way to get started isn't often clear to new users. We'll cover the necessary methods and steps for getting data from external content sources into and out of Unity, with a focus on industry standard technologies and applications, such as Universal Scene Description (USD) and Alembic.
Speaker:
Chris Redmann - Unity
Watch the session on YouTube: https://youtu.be/BtKMvecBIbc
Custom SRP and graphics workflows - Unite Copenhagen 2019Unity Technologies
Battle Planet - Judgement Day is a unique game in the sense that it's played entirely on a single sphere (the planet). Levels are fully procedural and fully destructible. This structure created a few big challenges in terms of rendering, which were solved by writing a custom Scriptable Render Pipeline for the game. This session provides an overview of the game's rendering features and how they were implemented using SRP. It includes a few examples of how performance issues influenced the design of the pipeline as well as a discussion about shader programming and design patterns.
Speaker:
Henning Steinbock - Threaks
Session available here: https://youtu.be/91zUwJwkXNQ
We Love Performance! How Tic Toc Games Uses ECS in Mobile Puzzle GamesUnity Technologies
Tic Toc Games recently implemented Unity's Entity Component System (ECS) in their mobile puzzle engine, which brought both great performance improvements and faster iteration time. This intermediate-level session will explain why ECS is able to process data much faster, how they increased iteration speed using ECS, and their experience learning and working with Unity's ECS package.
Garth Smith - Tic Toc Games
Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, and 2D video frame buffer - a core component of the PDK.
Over the past couple of years the SDL Perl bindings have gone through a complete rewrite, making them modular, stable, faster, multiplatform, 1:1 compatible with libsdl and fixing several memory leaks while at it.
The community is more alive than ever and now the SDL Perl project is ready to move the Perl motto into gamedev:
"Simple games, easy. Complex games, possible."
In this talk I'll discuss some of the sugar layers being developed on top of SDL Perl, including game loops, widgets, physics engines and full-fledged frameworks for easy game development.
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
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.
Programming with Segue
Dynamic design through coding
Views and its Co-ordinates
Core animations
Picture pickers
Sound manager
Address book picker
- Hussain KMR Behestee
Software developers need more space to think, scribble, and hold their thoughts about programming tasks. Code Pad is a multi-touch tablet that allows developers interact with several programming elements in support of tasks such as refactoring or keeping reminders.
Second chapter of the lecture Unreal Engine Basics taught at SAE Institute Hamburg.
- Getting familiar with the Unreal Level Editor
- Learning how to bind and handle player keyboard and mouse input
- Understanding character movement properties and functions
Come learn how Microsoft Silverlight was used to create Tunnel Trouble, an online game built using Silverlight 2. This session covers concepts of using Silverlight technologies and tools to build game boards, animations, collision logic, game loop logic, integrating media into game play as well as integrating with web services and being more efficient with managed code.
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/1Ihu917.
Jafar Husain shows the Reactive Extensions (Rx) library which allows to treat events as collections, how Netflix uses Rx on the client and the server, allowing to build end-to-end reactive systems. Filmed at qconsf.com.
Jafar Husain developed software for companies like GE, Microsoft, and Netflix. He specializes in building web servers and clients using functional reactive programming, and was the first user of the Reactive Extensions Framework. He's also responsible for "Falkor", a RESTful data access framework that powers most Netflix clients.
Video and related blog posts at fsharpforfunandprofit.com/ettt
Follow along as I ridiculously over-engineer a simple game to demonstrate how functional programming can be used to create a real-world "enterprise-ready" application.
Topics covered include: encoding business rules into types, data hiding with parametric polymorphism, using functions for capability-based security, exposing a REST API with HATEAOS, the functional approach to logging, actors, scalability and more.
We focus the programming of an artificial intelligence (AI) player for a communication game called “Are You a Werewolf?” (AIWolf). We present the Werewolf game as a standard game problem in the AI field, and it is similar to game problems such as Chess, Shogi, Go, and Poker. Compared to the previous game-related challenges, the communication or communicative intelligence skills that are commonly used in board games and card games have not been examined. When people play board games and card games, they converse with other players, and some games are advanced through conversation as so-called communication games. Few studies in the literature have analyzed artificial intelligence in relation to such communication games. “Are You a Werewolf?” is one of these communication games.
This game is a communication game that requires several AI technologies such as multi-agent coordination, intentional reading, and understanding of the theory of mind. Analyzing and solving the Werewolf game as a standard problem will provide useful results for our research field and its applications. Similar to the RoboCup project, the goal of this project is to determine new themes while creating a communicative AI player that can play the Werewolf game with humans. As an initial step, we designed a platform to develop a game-playing AI for a competition.
public void turnRight(double degrees) {rotationInDegrees + - = deg.pdfisenbergwarne4100
public void turnRight(double degrees) {
rotationInDegrees + - = degrees;
}
public void turnLeft(double degrees) {
rotationInDegrees - = degrees;
}
Actor
public class Actor {
private EZImage pikachu; // Member variable to store bug picture
private int x, y, startx, starty; // Member variables to store x, y, startx, starty
private int destx, desty; // Member variables to store destination values
private long starttime; // Member variable to store the start time
private long duration; // Member variable to store the duration
private boolean interpolation; // Member variable that is set to true if it is in the
interpolation state
// ********* SCALE
private float currentScale = 1;
private float destScale = 1;
private float startScale = 1;
private boolean interpolationScale;
// Constructor for RCBug takes 3 parameters
public Actor(String filename,int posx, int posy){
// Set the current position of the bug
x=posx;y=posy;
// Create the image of the bug
pikachu = EZ.addImage(filename, posx, posy);
// Move it to the starting position. This is actually redundant.
pikachu.translateTo(x,y);;
// Set interpolation mode to false initially
interpolation = false;
interpolationScale = false;
}
// Set the destination by giving it 3 variables
// Dur means duration and is measured in seconds
//public void setDestination(int posx, int posy, long dur){
public void moveto(int posx, int posy, long dur){
// Set destination position and duration
// Convert seconds to miliseconds
destx = posx; desty = posy; duration = dur*1000;
// Get the startting time (i.e. time according to your computer)
starttime = System.currentTimeMillis();
// Set the starting position of your bug
startx=x; starty=y;
// Set interolation mode to true
interpolation = true;
interpolationScale = false;
}
// ********* SCALE
public void setScale(float s, float dur){
destScale = s;
starttime = System.currentTimeMillis();
startScale = currentScale;
interpolationScale = true;
}
// If you?re in interpolation state then return true, else false.
public boolean moving() {
return interpolation;
}
// ********* SCALE
public boolean scaling() {
return interpolationScale;
}
// This moves the bug based on the current time and elapsed time according to the interpolation
equation
public void go(){
// If interpolation mode is true then do interpolation
if (interpolation == true) {
//linear interpolation
// Normalize the time (i.e. make it a number from 0 to 1)
float normTime = (float) (System.currentTimeMillis() - starttime)/ (float) duration;
// Calculate the interpolated position of the bug
x = (int) (startx + ((float) (destx - startx) * normTime));
y = (int) (starty + ((float) (desty - starty) * normTime));
// If the difference between current time and start time has exceeded the duration
// then the animation/interpolation is over.
if ((System.currentTimeMillis() - starttime) >= duration) {
// Set interpolation to false
interpolation = false;
// Move the bug all the way to the destination
x = destx; y = desty;
}
//.
Versão com GIFs:
https://docs.google.com/presentation/d/17M-jHlkAP5KPfQ4_Alck_wIsN2gK3dZNGfJR9Bi1L50/present
Códigos para instalação das dependências:
https://github.com/fdaciuk/talks/tree/master/2015/wordcamp-sao-paulo
Taipei.py 2018 - Control device via ioctl from Python Hua Chu
Show how to do hardware control via ioctl from Python feat. magnetic tape drive. Three kinds of ways, including cpython extenstion, ctypes and fcntl are presented.
The Challenge of Bringing FEZ to PlayStation PlatformsMiguel Angel Horna
This presentation explores the process of bringing FEZ to the Sony PlayStation platforms. Beginning with the conversion from the existing C# codebase to C++ native code, the talk will then cover memory management without a garbage collector, tuned optimization techniques for each platform, and will finish with special features added to PlayStation builds
Василий Ременюк «Курс молодого подрывника» e-Legion
В своем докладе, на примере фреймвормка для нагрузочного тестирования многопользовательской онлайн-игры, Василий рассказал, как, следуя 4-ем простым советам, создать эффективную, асинхронную систему, используя модель актеров и Akka 2.0, уложиться в отведенные сроки, и, при этом, регулярно спать по-ночам больше 4 часов.
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...Sencha
At Ubisoft Technology Group, we've created a platform for video game production to share game assets, in-game footage, and animations across the entire company. Ease of search and good UX were incredibly important for an audience of artists and creative types. This is where the Web and a powerful JavaScript framework came in; we chose Ext JS for its robustness and scalability. In this session, we'll showcase two different applications and dive into the technical aspects of designing the UI for a faceted search based on Elasticsearch.
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.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
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/
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
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.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
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.
6. In
Java
Locale locale = new Locale("fi");
I18NBundle myBundle =
I18NBundle.createBundle(Gdx.files.internal("MyBundle"), locale);
String title = myBundle.get("title");
String score = myBundle.get("score", 50);
7. Notes
• If
you
don't
specify
locale,
default
locale
is
used
• Charset
is
UTF-‐8
(without
BOM)
• See:
– hVps://github.com/libgdx/libgdx/wiki/
Interna1onaliza1on-‐and-‐Localiza1on
9. Scene2D?
• It’s
op1onal,
you
don’t
need
it.
But
you
may
want
to
use
it.
• May
be
useful
for
"board
games"
• Higher
level
framework
for
crea>ng
games
• Provides
UI
Toolkit
also:
Scene2d.ui
• Tutorial
– https://github.com/libgdx/libgdx/wiki/Scene2d
10. Concepts
• Stage
– “Screens”,
“Stages”,
“Levels”
– Camera
watching
the
stage
– Contains
group
of
actors
• Actors
– “Sprites”
11. Roughly
the
Idea
in
Code
Stage gameStage = new Stage();
// PlayerActor extends Actor { .. }
PlayerActor player = new PlayerActor();
// Let's add the actor to the stage
gameStage.addActor(player);
12. Possibili1es
• Event
system
for
actors;
when
actor
is
touched,
dragged
..
– Hit
detec>on;
dragging
/
touching
within
the
bounds
of
actor
• Ac>on
system:
rotate,
move,
scale
actors
in
parallel
– Also
rota1on
and
scaling
of
group
of
actors
13. Stage
• Stage
implements
InputProcessor,
so
it
can
directly
input
events
from
keyboard
and
touch
• Add
to
your
Applica1onAdapter
– Gdx.input.setInputProcessor(myStage);
• Stage
distributes
input
to
actors
• Use
setViewport
to
set
the
camera
– myStage.setViewPort(...);
• Stage
has
act
method,
by
calling
this,
every
act
method
of
every
actor
is
called
14. Actors
• Actor
has
an
posi1on,
rect
size,
scale,
rota1on…
• Posi1on
is
the
leb
corner
of
the
actor
• Posi1on
is
rela1ve
to
the
actor’s
parent
• Actor
may
have
ac>ons
– Change
the
presenta>on
of
the
actor
(move,
resize)
• Actor
can
react
to
events
15. public class StageGame extends ApplicationAdapter {
// Stage contains hierarcy of actors
private Stage stage;
// We will have player actor in the stage
private BlueBirdActor playerActor;
@Override
public void create () {
// Creating the stage
stage = new Stage();
// Creating the actors
playerActor = new BlueBirdActor();
// add actors to stage
stage.addActor(playerActor);
}
@Override
public void render () {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
// Call act on every actor
stage.act(Gdx.graphics.getDeltaTime());
// Call draw on every actor
stage.draw();
}
}
16. public class BlueBirdActor extends Actor {
private Texture texture;
public BlueBirdActor() {
texture = new Texture(Gdx.files.internal("blue-bird-icon.png"));
}
@Override
public void draw(Batch batch, float alpha) {
batch.draw(texture, getX(), getY());
}
@Override
public void act(float delta) {
super.act(delta);
}
}
17. Event
System
• Stage
will
be
responsible
for
gedng
user
input
– Gdx.input.setInputProcessor(stage);
• Stage
will
fire
events
to
actors
• Actor
may
receive
events
if
it
has
a
listener
– actor.addListener(new InputListener()
{ … } );
• Actor
must
specify
bounds
in
order
to
receive
input
events
within
those
bounds!
• To
handle
key
input,
actor
has
to
have
keyboard
focus
18. public class StageGame extends ApplicationAdapter {
// Stage contains hierarcy of actors
private Stage stage;
// We will have player actor in the stage
private BlueBirdActor playerActor;
@Override
public void create () {
// Creating the stage
stage = new Stage();
// Sets the InputProcessor that will receive all touch and key input events.
// It will be called before the ApplicationListener.render() method each frame.
//
// Stage handles the calling the inputlisteners for each actor.
Gdx.input.setInputProcessor(stage);
// Creating the actors
playerActor = new BlueBirdActor();
// add actors to stage
stage.addActor(playerActor);
stage.setKeyboardFocus(playerActor);
}
@Override
public void render () {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
// Call act on every actor
stage.act(Gdx.graphics.getDeltaTime());
// Call draw on every actor
stage.draw();
}
}
19. public class BlueBirdActor extends Actor {
private boolean up, down, left, right
public BlueBirdActor() {
addListener(new PlayerListener());
}
@Override
public void act(float delta) {
if(up) {
setY(getY() + speed * delta);
}
}
// InputListener implements EventListener, just override the methods you need
// Also ActorGestureListener available: fling, pan, zoom, pinch..
class PlayerListener extends InputListener {
@Override
public boolean keyDown(InputEvent event, int keycode) {
if(keycode == Input.Keys.UP) {
up = true;
}
return true;
}
@Override
public boolean keyUp(InputEvent event, int keycode) {
if(keycode == Input.Keys.UP) {
up = false;
}
return true;
}
}
}
20. Ac1ons
• Each
actor
has
a
list
of
ac1ons
• Updated
on
every
frame
(act-‐method)
• Many
ac1ons
available
– MoveToAction
– RotateToAction
– ScaleToAction
• Example
– MoveToAction action = new MoveToAction();
– action.setPosition(300f, 700f);
– action.setDuration(2f);
– actor.addAction(action);
21. Grouping
Ac1ons
in
Sequence
SequenceAction sequenceAction = new SequenceAction();
MoveToAction moveAction = new MoveToAction();
RotateToAction rotateAction = new RotateToAction();
ScaleToAction scaleAction = new ScaleToAction();
moveAction.setPosition(200f, 400f);
moveAction.setDuration(1f);
rotateAction.setRotation(rotate);
rotateAction.setDuration(1f);
scaleAction.setScale(0.5f);
scaleAction.setDuration(1f);
sequenceAction.addAction(moveAction);
sequenceAction.addAction(rotateAction);
sequenceAction.addAction(scaleAction);
actor.addAction(sequenceAction);
22. Grouping
Ac1ons
in
Parallel
ParallelAction parallel = new ParallelAction ();
MoveToAction moveAction = new MoveToAction();
RotateToAction rotateAction = new RotateToAction();
ScaleToAction scaleAction = new ScaleToAction();
moveAction.setPosition(200f, 400f);
moveAction.setDuration(1f);
rotateAction.setRotation(rotate);
rotateAction.setDuration(1f);
scaleAction.setScale(0.5f);
scaleAction.setDuration(1f);
parallel.addAction(moveAction);
parallel.addAction(rotateAction);
parallel.addAction(scaleAction);
actor.addAction(parallel);
23. Ac1ons
Complete?
SequenceAction sequenceAction = new SequenceAction();
ParallelAction parallelAction = new ParallelAction();
MoveToAction moveAction = new MoveToAction();
RotateToAction rotateAction = new RotateToAction();
RunnableAction runnableAction = new RunnableAction();
moveAction.setPosition(200f, 400f);
moveAction.setDuration(1f);
moveAction.setInterpolation(Interpolation.bounceOut);
rotateAction.setRotation(rotate);
rotateAction.setDuration(1f);
runnableAction.setRunnable(new Runnable() {
public void run() {
System.out.println("done!");
}
});
parallelAction.addAction(rotateAction);
parallelAction.addAction(moveAction);
sequenceAction.addAction(parallelAction);
sequenceAction.addAction(runnableAction);
24. Enable
rotate
and
scale
in
drawing
@Override
public void draw(Batch batch, float alpha){
batch.draw(texture,
this.getX(), this.getY(),
this.getOriginX(),
this.getOriginY(),
this.getWidth(),
this.getHeight(),
this.getScaleX(),
this.getScaleY(),
this.getRotation(),0,0,
texture.getWidth(), texture.getHeight(), false, false);
}
25. Grouping
Group group = new Group();
group.addActor(playerActor);
group.addActor(monsterActor);
group.addAction( ... );
stage.addActor(group);
27. Scene2D.UI
• Tutorial
– hVps://github.com/libgdx/libgdx/wiki/Scene2d.ui
• To
quickly
get
started,
add
following
to
your
project
– uiskin.png,
uiskin.atlas,
uiskin.json,
default.fnt
– hVps://github.com/libgdx/libgdx/tree/master/
tests/gdx-‐tests-‐android/assets/data
• Tutorial
and
examples
– hVps://github.com/libgdx/libgdx/wiki/Scene2d.ui
28. TextBuVon
example
Skin skin = new Skin( Gdx.files.internal("uiskin.json") );
final TextButton button = new TextButton("Hello", skin);
button.setWidth(200f);
button.setHeight(20f);
button.setPosition(Gdx.graphics.getWidth() /2 - 100f, Gdx.graphics.getHeight()/2
- 10f);
startStage.addActor(button);
Gdx.input.setInputProcessor(startStage);
button.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y){
whichScreen = !whichScreen;
Gdx.input.setInputProcessor(gameStage);
}
});