This document contains code for a portfolio website application. It initializes several classes, including BackgroundImage, Menu, Biography and Works. It adds the background image and menu to the display list. Event listeners are added to buttons in the menu to handle rollover and click interactions. When clicked, the buttons will likely swap content for the different sections like bio and works.
This document contains code for an Android application that uses OpenCV for face and eye detection from camera frames. It detects faces, eyes within each face, and tracks the location of the eyes across frames to determine what grid location the user is focusing on (left, right, center). Based on detected eye gaze, it modifies the UI by shifting images left/right in horizontal scroll views or changing the text focus.
iOS. EventKit Framework. Work with calendars and remindersVoityuk Alexander
The document discusses the Event Kit framework for interacting with the Calendar and Reminders apps in iOS. It provides code examples for requesting access to calendars, fetching calendar and event data using predicates, creating, modifying and deleting events and reminders. It also covers observing external changes to the calendar database and using interfaces like EKEventViewController for displaying event data.
The document describes refactoring a Twitter client app to follow the MVVM design pattern. Originally, the view controller handled fetching and displaying tweets directly. It was refactored to use a presenter class that fetches tweets and notifies the view controller when finished via a protocol. This decouples the data handling from the view controller and makes the code more testable.
A Series of Fortunate Events - Symfony Camp Sweden 2014Matthias Noback
The document discusses events and event-driven architecture in software. It begins by explaining what events are and how they can be modeled in code. It then describes how to refactor imperative code to extract events using an example of adding comments to blog posts. This improves the design by removing dependencies and applying patterns like observer and mediator. Finally, it discusses best practices like using explicit events/handlers, single responsibility, and inversion of control.
The document contains code snippets and text related to Yahoo Query Language (YQL), including examples of using YQL to retrieve data from APIs and services like Flickr, weather, maps and more. It demonstrates how to structure YQL queries to search for images, get weather forecasts for locations, and retrieve geolocation data to plot markers on a map. The document also discusses using YQL with JavaScript and developing applications using YQL programmatically.
This document contains code for an Android application that uses OpenCV for face and eye detection from camera frames. It detects faces, eyes within each face, and tracks the location of the eyes across frames to determine what grid location the user is focusing on (left, right, center). Based on detected eye gaze, it modifies the UI by shifting images left/right in horizontal scroll views or changing the text focus.
iOS. EventKit Framework. Work with calendars and remindersVoityuk Alexander
The document discusses the Event Kit framework for interacting with the Calendar and Reminders apps in iOS. It provides code examples for requesting access to calendars, fetching calendar and event data using predicates, creating, modifying and deleting events and reminders. It also covers observing external changes to the calendar database and using interfaces like EKEventViewController for displaying event data.
The document describes refactoring a Twitter client app to follow the MVVM design pattern. Originally, the view controller handled fetching and displaying tweets directly. It was refactored to use a presenter class that fetches tweets and notifies the view controller when finished via a protocol. This decouples the data handling from the view controller and makes the code more testable.
A Series of Fortunate Events - Symfony Camp Sweden 2014Matthias Noback
The document discusses events and event-driven architecture in software. It begins by explaining what events are and how they can be modeled in code. It then describes how to refactor imperative code to extract events using an example of adding comments to blog posts. This improves the design by removing dependencies and applying patterns like observer and mediator. Finally, it discusses best practices like using explicit events/handlers, single responsibility, and inversion of control.
The document contains code snippets and text related to Yahoo Query Language (YQL), including examples of using YQL to retrieve data from APIs and services like Flickr, weather, maps and more. It demonstrates how to structure YQL queries to search for images, get weather forecasts for locations, and retrieve geolocation data to plot markers on a map. The document also discusses using YQL with JavaScript and developing applications using YQL programmatically.
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, ClimacellDroidConTLV
StatefulLiveData is a new library that improves upon LiveData by adding state information. It allows observing data that indicates the loading state, success state with the data, or error state with the error. This provides more context than vanilla LiveData. Developers can observe just the success state to get the data, or observe other states individually to trigger the appropriate UI like loading indicators or error messages. This helps solve common patterns with asynchronous data in Android apps.
The document discusses automated testing of Android applications using Espresso. It covers why automated testing is important, where to use Espresso vs other frameworks like Robolectric depending on the app layer being tested, basic Espresso testing code examples, and 5 tips for writing effective Espresso tests including using page objects, minimizing dependencies, making instances configurable, wrapping Espresso APIs, and avoiding sleeps for asynchronous waits.
Is your web app drowning in a sea of JavaScript? Has your client-side codebase grown from "a snippet here and there" to "more JavaScript than HTML"? Do you find yourself writing one-off snippets instead of generalized components? You're not the only one. Learn about a handful of strategies you can use to keep your JavaScript codebase lean, modular, and flexible. We'll cover all the major pain points — MVC, templates, persisting state, namespacing, graceful error handling, client/server communication, and separation of concerns. And we'll cover how to do all this incrementally so that you don't have to redo everything from scratch.
The document defines a Timeline struct that conforms to a DataType protocol. The Timeline struct stores an array of Tweet objects and provides methods to insert, delete, and retrieve Tweets from the array. The DataType protocol defines requirements for a type that manages an array of items including methods to insert, delete, and access items.
This document provides a quick introduction to Android development. It discusses Android Studio as the primary IDE for Android development and its features. It also covers templates, running apps, building UIs with code and XML, using resources and the R class, basic event handling, Logcat for viewing logs, and best practices for logging.
Peter-Paul Koch gave a presentation on JavaScript events, focusing on key events like keydown, keypress, and keyup. He discussed how event delegation can be used to handle events on descendant elements. The presentation concluded with a discussion on events on mobile phones, noting that click events should generally be used and mouse events avoided, and that orientationchange and resize events are important for responsive design.
Cycle.js is a reactive JavaScript framework that uses RxJS streams to manage data flow in applications. It follows a unidirectional data flow model where drivers like DOMDriver handle interactions that produce events, which update models that then produce views. The document demonstrates how Cycle.js can be used to build a simple toggle component and compose it into a larger application to manage multiple toggled states through streams.
The document describes a TimelineTableViewController class that is responsible for displaying a timeline. It initializes a TimelinePresenter when loaded, which handles fetching the timeline data and notifying the view controller. The presenter calls a TimelineUseCase to retrieve the timeline and then uses the view controller as an output to update the UI, such as showing/hiding empty and ad views depending on the timeline contents.
The document describes code for displaying player stats from a pubg tracking service. It includes a StatsPresenter class that fetches stats from a data store based on a player's nickname. The presenter updates the stats on a StatsViewController by calling methods to reload the table view and display the player's profile.
The Ring programming language version 1.9 book - Part 14 of 210Mahmoud Samir Fayed
This document describes an example Ring program that uses the RingFreeGLUT extension to render a 3D snowman scene. It loads the freeglut and OpenGL libraries, defines variables for the camera position and rotation, and functions for drawing the snowman, text, and scene. It sets up callbacks for rendering, window resizing, and user input handling. Popup menus are created for changing rendering options. The main function initializes GLUT and sets the callbacks to start the rendering loop.
A Series of Fortunate Events - Drupalcon Europe, Amsterdam 2014Matthias Noback
Events are the new hooks. But what is an event really? How can you best describe an event in your code? What types of events are there, and how do you decide whether or not to implement something as an event?
In this talk we take a look at how events are essential to processing a Request and producing a Response. We take a look at the Symfony EventDispatcher and related classes that you need when you want to hook into this process. When you know all about the event system and how you can implement your own events, we discuss some situations which may or may not be good use cases for events. You will learn to decide if using events is the right solution for your problem.
Awesome State Management for React and Other Virtual-Dom LibrariesFITC
Presented at FITC's Web Unleashed 2017 conference
More info at www.fitc.ca/webu
Fred Daoud
Modernizing Medicine
Overview
Do you use React or any other virtual-DOM-based library that you love, but wonder about how to structure and manage application state? Perhaps you’ve looked at Redux, but got bogged down in boilerplate and action constants. Then you wondered about asynchronous actions. Does the list of libraries and dependencies that you need to solve common problems just keep piling up? Wasn’t React supposed to be a simple view library?
Let’s talk about other ways to manage the data flow of your web applications. We want a single state object, one-directional data flow, reactive views as plain functions, decoupled and reusable components, routing, time-traveling, …all without any fuss. We’ll assemble this in a way that lets you keep using your favourite libraries (React, Preact, Inferno, Snabbdom, Mithril, etc.), and write your code with regular JavaScript functions, giving you state management with the freedom to structure your application as best suits your requirements.
Objective
Show developers great ways to manage the state of applications using React or any virtual-DOM library.
Target Audience
Front-end JavaScript developers
Assumed Audience Knowledge
JavaScript and basic React or other virtual dom library.
Five Things Audience Members Will Learn
Managing application state with a single model and unidirectional flow
Creating decoupled, reusable components (with plain objects and functions!)
Assembling and composing with simple functional programming techniques
Routing made simple, using the library of your choice
Time-travelling and other cool development tools
The Ring programming language version 1.8 book - Part 12 of 202Mahmoud Samir Fayed
This document provides an example of using the RingFreeGLUT extension in Ring to interface with the FreeGLUT library. It includes code to:
1. Initialize FreeGLUT and create an OpenGL window.
2. Define callbacks for rendering, window resizing, and keyboard/mouse input.
3. Render a 3D scene with 9 snowmen using OpenGL, including drawing spheres, cones, text with bitmap fonts, and handling camera movement.
4. Create popup menus for options like polygon rendering mode, font selection, and object colors.
So in summary, it shows how to set up a basic 3D application with RingFreeGLUT to display a winter scene with snowmen
The document discusses delegates, events, and lambda expressions in C# for implementing callback methods. It provides examples of using delegates to define callback method signatures, attaching methods to events using delegates, and using lambda expressions as an anonymous way to work with delegates. Key examples include registering and unregistering callback methods for a teacher class using delegates and events, and showing how lambda expressions can simplify this.
This document contains code for a C# class called "test" that defines properties and validation attributes for a web form model. It includes properties for email, name, date, and other fields, along with attributes for validation rules like required, data type, length, and regular expressions. It also contains JavaScript code to add client-side validation logic and datepicker functionality to the form fields.
The document summarizes a library of UI components called Prototype UI that provides reusable JavaScript components like windows, carousels, and menus. It is created by a team including Samuel Lebeau, Juriy Zaytsev, and Sébastien Gruhier. The components are highly customizable, skinnable, and have a coherent API. Examples are provided showing how to create windows that can be dragged and minimized to desktop icons using only a few lines of code. Future plans include adding more tests, documentation, demos, and new components like dialog boxes and portals.
The document provides an overview of the topics that will be covered in Class 15 on iOS app software design, including touch, gestures, accelerometer, gyroscope, and camera. Touch topics include touch coordinates, calculating movement direction for swiping. Gesture topics include tap, pan, swipe, pinch, rotation, and long press. Accelerometer and gyroscope examples detect device shaking and orientation. The camera example captures and saves images. Event handling and the four touch methods - touchesBegan, touchesMoved, touchesEnded, touchesCancelled - are also discussed.
This document discusses how DOM events work under the hood in browsers. It explains that events follow a capture and bubble phase model, where event handlers on parent elements are executed first during capture, then event handlers on the target element, then handlers on parent elements again during bubbling. It provides code for a custom event system that simulates this behavior, handling setting up the event, calculating the parent path, and executing handlers for each phase and the default action. It also covers topics like event data, stopping propagation, and gotchas with cross-browser event handling.
Android Sliding Menu dengan Navigation DrawerAgus Haryanto
The document discusses how to create an Android project using a navigation drawer to display a class schedule. It provides step-by-step instructions to set up the navigation drawer menu, fragments to display the schedule for each day, and classes to store and display the schedule data. Key aspects covered include creating layouts for the drawer menu, fragments and schedule items, adding sample schedule data, and using fragments and bundles to display the appropriate schedule based on the selected drawer menu item.
Leaving Flatland: getting started with WebGLgerbille
WebGL is a JavaScript API for rendering interactive 3D graphics within any compatible web browser without the use of plug-ins. It can be used for data visualization, creative coding, 3D modeling, games, and more. WebGL works by using JavaScript to interface with the GPU through WebGL APIs to run GLSL shaders that render 3D scenes. To get started, one needs to choose a WebGL library like Three.js, add a <canvas> element, and get the WebGL context. Sample code is provided to render a 3D model by loading geometry, adding lights and materials, and animating the scene render.
CQRS and Event Sourcing in a Symfony applicationSamuel ROZE
The document discusses using CQRS and event sourcing in a Symfony application. It covers building the domain model to use events, storing events in a repository, using a message bus for commands and events, and creating projections from events for querying. Event handlers can trigger new commands, and projections rebuild data from events for fast reads. The approach allows an application to handle commands asynchronously through decoupled services while maintaining an immutable record of events for audit purposes.
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, ClimacellDroidConTLV
StatefulLiveData is a new library that improves upon LiveData by adding state information. It allows observing data that indicates the loading state, success state with the data, or error state with the error. This provides more context than vanilla LiveData. Developers can observe just the success state to get the data, or observe other states individually to trigger the appropriate UI like loading indicators or error messages. This helps solve common patterns with asynchronous data in Android apps.
The document discusses automated testing of Android applications using Espresso. It covers why automated testing is important, where to use Espresso vs other frameworks like Robolectric depending on the app layer being tested, basic Espresso testing code examples, and 5 tips for writing effective Espresso tests including using page objects, minimizing dependencies, making instances configurable, wrapping Espresso APIs, and avoiding sleeps for asynchronous waits.
Is your web app drowning in a sea of JavaScript? Has your client-side codebase grown from "a snippet here and there" to "more JavaScript than HTML"? Do you find yourself writing one-off snippets instead of generalized components? You're not the only one. Learn about a handful of strategies you can use to keep your JavaScript codebase lean, modular, and flexible. We'll cover all the major pain points — MVC, templates, persisting state, namespacing, graceful error handling, client/server communication, and separation of concerns. And we'll cover how to do all this incrementally so that you don't have to redo everything from scratch.
The document defines a Timeline struct that conforms to a DataType protocol. The Timeline struct stores an array of Tweet objects and provides methods to insert, delete, and retrieve Tweets from the array. The DataType protocol defines requirements for a type that manages an array of items including methods to insert, delete, and access items.
This document provides a quick introduction to Android development. It discusses Android Studio as the primary IDE for Android development and its features. It also covers templates, running apps, building UIs with code and XML, using resources and the R class, basic event handling, Logcat for viewing logs, and best practices for logging.
Peter-Paul Koch gave a presentation on JavaScript events, focusing on key events like keydown, keypress, and keyup. He discussed how event delegation can be used to handle events on descendant elements. The presentation concluded with a discussion on events on mobile phones, noting that click events should generally be used and mouse events avoided, and that orientationchange and resize events are important for responsive design.
Cycle.js is a reactive JavaScript framework that uses RxJS streams to manage data flow in applications. It follows a unidirectional data flow model where drivers like DOMDriver handle interactions that produce events, which update models that then produce views. The document demonstrates how Cycle.js can be used to build a simple toggle component and compose it into a larger application to manage multiple toggled states through streams.
The document describes a TimelineTableViewController class that is responsible for displaying a timeline. It initializes a TimelinePresenter when loaded, which handles fetching the timeline data and notifying the view controller. The presenter calls a TimelineUseCase to retrieve the timeline and then uses the view controller as an output to update the UI, such as showing/hiding empty and ad views depending on the timeline contents.
The document describes code for displaying player stats from a pubg tracking service. It includes a StatsPresenter class that fetches stats from a data store based on a player's nickname. The presenter updates the stats on a StatsViewController by calling methods to reload the table view and display the player's profile.
The Ring programming language version 1.9 book - Part 14 of 210Mahmoud Samir Fayed
This document describes an example Ring program that uses the RingFreeGLUT extension to render a 3D snowman scene. It loads the freeglut and OpenGL libraries, defines variables for the camera position and rotation, and functions for drawing the snowman, text, and scene. It sets up callbacks for rendering, window resizing, and user input handling. Popup menus are created for changing rendering options. The main function initializes GLUT and sets the callbacks to start the rendering loop.
A Series of Fortunate Events - Drupalcon Europe, Amsterdam 2014Matthias Noback
Events are the new hooks. But what is an event really? How can you best describe an event in your code? What types of events are there, and how do you decide whether or not to implement something as an event?
In this talk we take a look at how events are essential to processing a Request and producing a Response. We take a look at the Symfony EventDispatcher and related classes that you need when you want to hook into this process. When you know all about the event system and how you can implement your own events, we discuss some situations which may or may not be good use cases for events. You will learn to decide if using events is the right solution for your problem.
Awesome State Management for React and Other Virtual-Dom LibrariesFITC
Presented at FITC's Web Unleashed 2017 conference
More info at www.fitc.ca/webu
Fred Daoud
Modernizing Medicine
Overview
Do you use React or any other virtual-DOM-based library that you love, but wonder about how to structure and manage application state? Perhaps you’ve looked at Redux, but got bogged down in boilerplate and action constants. Then you wondered about asynchronous actions. Does the list of libraries and dependencies that you need to solve common problems just keep piling up? Wasn’t React supposed to be a simple view library?
Let’s talk about other ways to manage the data flow of your web applications. We want a single state object, one-directional data flow, reactive views as plain functions, decoupled and reusable components, routing, time-traveling, …all without any fuss. We’ll assemble this in a way that lets you keep using your favourite libraries (React, Preact, Inferno, Snabbdom, Mithril, etc.), and write your code with regular JavaScript functions, giving you state management with the freedom to structure your application as best suits your requirements.
Objective
Show developers great ways to manage the state of applications using React or any virtual-DOM library.
Target Audience
Front-end JavaScript developers
Assumed Audience Knowledge
JavaScript and basic React or other virtual dom library.
Five Things Audience Members Will Learn
Managing application state with a single model and unidirectional flow
Creating decoupled, reusable components (with plain objects and functions!)
Assembling and composing with simple functional programming techniques
Routing made simple, using the library of your choice
Time-travelling and other cool development tools
The Ring programming language version 1.8 book - Part 12 of 202Mahmoud Samir Fayed
This document provides an example of using the RingFreeGLUT extension in Ring to interface with the FreeGLUT library. It includes code to:
1. Initialize FreeGLUT and create an OpenGL window.
2. Define callbacks for rendering, window resizing, and keyboard/mouse input.
3. Render a 3D scene with 9 snowmen using OpenGL, including drawing spheres, cones, text with bitmap fonts, and handling camera movement.
4. Create popup menus for options like polygon rendering mode, font selection, and object colors.
So in summary, it shows how to set up a basic 3D application with RingFreeGLUT to display a winter scene with snowmen
The document discusses delegates, events, and lambda expressions in C# for implementing callback methods. It provides examples of using delegates to define callback method signatures, attaching methods to events using delegates, and using lambda expressions as an anonymous way to work with delegates. Key examples include registering and unregistering callback methods for a teacher class using delegates and events, and showing how lambda expressions can simplify this.
This document contains code for a C# class called "test" that defines properties and validation attributes for a web form model. It includes properties for email, name, date, and other fields, along with attributes for validation rules like required, data type, length, and regular expressions. It also contains JavaScript code to add client-side validation logic and datepicker functionality to the form fields.
The document summarizes a library of UI components called Prototype UI that provides reusable JavaScript components like windows, carousels, and menus. It is created by a team including Samuel Lebeau, Juriy Zaytsev, and Sébastien Gruhier. The components are highly customizable, skinnable, and have a coherent API. Examples are provided showing how to create windows that can be dragged and minimized to desktop icons using only a few lines of code. Future plans include adding more tests, documentation, demos, and new components like dialog boxes and portals.
The document provides an overview of the topics that will be covered in Class 15 on iOS app software design, including touch, gestures, accelerometer, gyroscope, and camera. Touch topics include touch coordinates, calculating movement direction for swiping. Gesture topics include tap, pan, swipe, pinch, rotation, and long press. Accelerometer and gyroscope examples detect device shaking and orientation. The camera example captures and saves images. Event handling and the four touch methods - touchesBegan, touchesMoved, touchesEnded, touchesCancelled - are also discussed.
This document discusses how DOM events work under the hood in browsers. It explains that events follow a capture and bubble phase model, where event handlers on parent elements are executed first during capture, then event handlers on the target element, then handlers on parent elements again during bubbling. It provides code for a custom event system that simulates this behavior, handling setting up the event, calculating the parent path, and executing handlers for each phase and the default action. It also covers topics like event data, stopping propagation, and gotchas with cross-browser event handling.
Android Sliding Menu dengan Navigation DrawerAgus Haryanto
The document discusses how to create an Android project using a navigation drawer to display a class schedule. It provides step-by-step instructions to set up the navigation drawer menu, fragments to display the schedule for each day, and classes to store and display the schedule data. Key aspects covered include creating layouts for the drawer menu, fragments and schedule items, adding sample schedule data, and using fragments and bundles to display the appropriate schedule based on the selected drawer menu item.
Leaving Flatland: getting started with WebGLgerbille
WebGL is a JavaScript API for rendering interactive 3D graphics within any compatible web browser without the use of plug-ins. It can be used for data visualization, creative coding, 3D modeling, games, and more. WebGL works by using JavaScript to interface with the GPU through WebGL APIs to run GLSL shaders that render 3D scenes. To get started, one needs to choose a WebGL library like Three.js, add a <canvas> element, and get the WebGL context. Sample code is provided to render a 3D model by loading geometry, adding lights and materials, and animating the scene render.
CQRS and Event Sourcing in a Symfony applicationSamuel ROZE
The document discusses using CQRS and event sourcing in a Symfony application. It covers building the domain model to use events, storing events in a repository, using a message bus for commands and events, and creating projections from events for querying. Event handlers can trigger new commands, and projections rebuild data from events for fast reads. The approach allows an application to handle commands asynchronously through decoupled services while maintaining an immutable record of events for audit purposes.
The document discusses various AWT classes and components for creating graphical user interfaces in Java, including buttons, borders, card layouts, checkboxes, text fields, menus, and handling events from mouse clicks and key presses. Code examples are provided to demonstrate drawing shapes and graphics, as well as handling user input events.
Introduction to CQRS and Event SourcingSamuel ROZE
Event Sourcing is the idea that every state of your application can be represented by a sequence of events. Using these two principles as the heart of a system or an application is quite common but can be challenging if we don’t use the right tools or architecture.
Please help!!I wanted to know how to add a high score to this prog.pdfJUSTSTYLISH3B2MOHALI
Please help!!
I wanted to know how to add a high score to this program and wanted to add how many times
you press the spacebar
import javax.swing.*;
import java.awt.*;
/**
* Created by Thomas on 11/27/2016.
*/
public class Renderer extends JPanel{
//private static final long serialVersionUID = 1L;
protected void paintComponent(Graphics g) {
Main.main.repaint(g);
}
public static int clamp(int greenValue, int i, int j) {
// TODO Auto-generated method stub
return 0;
}
}
OTHER PART:
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.*;
/**
* Created by Thomas on 11/27/2016.
*/
public class Main implements ActionListener, KeyListener{
public static Main main;
public final int WIDTH = 1400;
public final int HEIGHT = 600;
public HUD Hud;
public Renderer renderer;
public Rectangle character;
public ArrayList cloud;
public Random rand;
public boolean start = false, gameover = false;
public int tick;
public Main() {
JFrame jFrame = new JFrame();
Timer timer = new Timer(20, this);
renderer = new Renderer();
rand = new Random();
jFrame.setTitle(\"Example\");
jFrame.add(renderer);
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.setSize(WIDTH, HEIGHT);
jFrame.addKeyListener(this);
jFrame.setVisible(true);
cloud = new ArrayList();
character = new Rectangle(200, 220, 20, 20);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
timer.start();
}
public void repaint(Graphics g) {
g.setColor(Color.black);
g.fillRect(0,0, WIDTH, HEIGHT);
g.setColor(Color.blue);
g.fillRect(0, HEIGHT - 100, WIDTH, 100);
g.setColor(Color.green);
g.fillRect(character.x, character.y, character.width, character.height);
if (character.y >= HEIGHT - 100 || character.y < 0) {
gameover = true;
}
for (Rectangle rect : cloud) {
g.setColor(Color.white);
g.fillRect(rect.x, rect.y, rect.width, rect.height);
}
g.setColor(Color.WHITE);
g.setFont(new Font(\"Times New Roman\", 1 ,100));
if (!start) {
g.drawString(\"Press to start!\", 450, HEIGHT / 2);
}
else if (gameover) {
g.drawString(\"Game Over!\", 450, HEIGHT / 2);
}
}
public void addCloud(boolean start) {
int width = 400;
int height = 200;
if (start) {
cloud.add(new Rectangle(WIDTH + width + cloud.size() * 300, rand.nextInt(HEIGHT-120),
80, 100));
}
else {
cloud.add(new Rectangle(cloud.get(cloud.size() - 1).x + 300, rand.nextInt(HEIGHT-120), 80,
100));
}
}
public void flap() {
if (gameover) {
character = new Rectangle(300, 400, 40, 40);
cloud.clear();
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
gameover = false;
}
if (!start) {
start = true;
}
else if (!gameover) {
character.y -= 70;
tick = 0;
}
}
@Override
public void actionPerformed(ActionEvent e) {
int speed = 15;
//System.out.println(\"Space.
I wanted to change the cloudsrectangles into an actuall image it do.pdffeelinggifts
I wanted to change the clouds/rectangles into an actuall image it doesnt matter the image.
import javax.swing.*;
import java.awt.*;
/**
* Created by Thomas on 11/27/2016.
*/
public class Renderer extends JPanel{
//private static final long serialVersionUID = 1L;
protected void paintComponent(Graphics g) {
Main.main.repaint(g);
}
public static int clamp(int greenValue, int i, int j) {
// TODO Auto-generated method stub
return 0;
}
}
OTHER PART:
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.*;
/**
* Created by Thomas on 11/27/2016.
*/
public class Main implements ActionListener, KeyListener{
public static Main main;
public final int WIDTH = 1400;
public final int HEIGHT = 600;
public HUD Hud;
public Renderer renderer;
public Rectangle character;
public ArrayList cloud;
public Random rand;
public boolean start = false, gameover = false;
public int tick;
public Main() {
JFrame jFrame = new JFrame();
Timer timer = new Timer(20, this);
renderer = new Renderer();
rand = new Random();
jFrame.setTitle(\"Example\");
jFrame.add(renderer);
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.setSize(WIDTH, HEIGHT);
jFrame.addKeyListener(this);
jFrame.setVisible(true);
cloud = new ArrayList();
character = new Rectangle(200, 220, 20, 20);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
timer.start();
}
public void repaint(Graphics g) {
g.setColor(Color.black);
g.fillRect(0,0, WIDTH, HEIGHT);
g.setColor(Color.blue);
g.fillRect(0, HEIGHT - 100, WIDTH, 100);
g.setColor(Color.green);
g.fillRect(character.x, character.y, character.width, character.height);
if (character.y >= HEIGHT - 100 || character.y < 0) {
gameover = true;
}
for (Rectangle rect : cloud) {
g.setColor(Color.white);
g.fillRect(rect.x, rect.y, rect.width, rect.height);
}
g.setColor(Color.WHITE);
g.setFont(new Font(\"Times New Roman\", 1 ,100));
if (!start) {
g.drawString(\"Press to start!\", 450, HEIGHT / 2);
}
else if (gameover) {
g.drawString(\"Game Over!\", 450, HEIGHT / 2);
}
}
public void addCloud(boolean start) {
int width = 400;
int height = 200;
if (start) {
cloud.add(new Rectangle(WIDTH + width + cloud.size() * 300, rand.nextInt(HEIGHT-120),
80, 100));
}
else {
cloud.add(new Rectangle(cloud.get(cloud.size() - 1).x + 300, rand.nextInt(HEIGHT-120), 80,
100));
}
}
public void flap() {
if (gameover) {
character = new Rectangle(300, 400, 40, 40);
cloud.clear();
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
addCloud(true);
gameover = false;
}
if (!start) {
start = true;
}
else if (!gameover) {
character.y -= 70;
tick = 0;
}
}
@Override
public void actionPerformed(ActionEvent e) {
int speed = 15;
//System.out.println(\"Space\");
if (start) {
for (int i = 0; i .
The document discusses several new APIs and features in Google Play Services 7.8 and Android M:
1. The Nearby Message API for publishing and subscribing to messages between nearby devices.
2. The Nearby Connections API for discovering, connecting to, and exchanging payloads with nearby devices via Bluetooth and WiFi.
3. Face detection and barcode scanning APIs for detecting faces and barcodes in images.
4. Changes to permissions, StrictMode, TextView, and ConnectivityManager.
5. Deprecated permissions and the new requestUsageTimeReport API.
6. App linking via applinks to associate web URLs and Android app activities.
This document discusses signals and events in ActionScript 3. It provides code samples for creating custom event classes that extend the Event class and using the signals library to dispatch events and add/remove event listeners. It also lists some references and resources for learning more about signals in AS3.
This document discusses signals and events in ActionScript 3. It provides code samples for creating custom event classes that extend the Event class and using the signals library to dispatch events and add/remove event listeners. It also lists some references and resources for working with signals in AS3.
This document contains code for a Flash/ActionScript class that draws multiple circles on the stage. It initializes the stage, then uses for loops to create many Sprite objects and draw circles within them at random screen positions and sizes. Some circles are drawn in different colors depending on their distance from the center of the stage.
1) The document discusses creating Java applets and using classes in an applet. It includes examples of creating classes to calculate compound interest, graph mathematical functions, and create a timer applet.
2) The examples create classes like Invest and Graph that perform calculations and drawing. They are used in applets that allow users to set inputs and see results updated.
3) The timer applet example uses the Timer class from Swing to repeatedly repaint random colored circles on a schedule.
REX about JavaFX8 used in SlideshowFX. This presentation covers concept from JavaFX as well as technologies like OSGi, Vert.x, LeapMotion, nashorn and friends in order to make them communicate inside one application developed in JavaFX.
This presentation was made at the FinistJUG, NantesJUG and NormandyJUG.
JavaScript APIs - The Web is the Platform - MDN Hack Day, Sao PauloRobert Nyman
The document provides an overview of various JavaScript APIs available for building web applications, including Browser ID for authentication, drag and drop, fullscreen mode, camera access, WebRTC, pointer lock, IndexedDB, battery status, and vibration. It also briefly mentions Boot to Gecko and the telephony and SMS APIs available in B2G.
The document discusses HTML5 and its new features such as video, canvas, geolocation, drag and drop, full screen, camera, battery status, vibration, and WebGL. It provides code examples for implementing these features and encourages trying new things with HTML5. The document is presented by Robert Nyman who works at Mozilla and advocates for open web standards and HTML5.
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, ChileRobert Nyman
This document summarizes several JavaScript APIs available in the browser, including APIs for fullscreen mode, cameras, WebRTC, pointer lock, IndexedDB, battery status, and vibration. It also discusses Boot to Gecko, telephony/SMS, and developer tools.
JavaScript APIs - The Web is the Platform - MozCamp, Buenos AiresRobert Nyman
This document provides summaries of various JavaScript APIs available in the browser, including APIs for fullscreen mode, cameras, WebRTC, pointer lock, IndexedDB, battery status, B2G/Gaia, telephony/SMS, vibration, and developer tools. It encourages trying new things with these Web APIs.
This document contains code for an Android application that uses OpenCV for face and eye detection. It detects faces and eyes in camera frames, tracks eye locations over time, and maps eye positions to grid locations. It also includes code to modify the UI, such as changing images and text, in response to eye tracking data and counts.
This is Java,I am currently stumped on how to add a scoreboard for.pdfanjandavid
This is Java,
I am currently stumped on how to add a scoreboard for my game that I am making. I have
inclued my code and classes so far. Any help with a working scoreboard would be greatly
apperiacted.
Game.java
import javax.swing.JFrame;
public class Game {
public static void main(String[] args)
{
// create the frame
JFrame myFrame = new JFrame(\"Platformer\");
// set up the close operation
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// create panel
Mainpanel myPanel = new Mainpanel();
// add panel
myFrame.getContentPane().add(myPanel);
// pack
myFrame.pack();
// set visibility to true
myFrame.setVisible(true);
}
}
Mainpanel.java
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.Random;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.Timer;
public class Mainpanel extends JPanel implements KeyListener, ActionListener{
private final int boardWidth =1000;
private final int boardHeight =1000;
int x = 0;
int y = 0;
int i= 0;
int goldCount=11;
int score = 0;
ImageIcon myIcon = new ImageIcon(\"./src/TreasureChest.png\");
Timer mainTimer;
player player1;
player player2;
static ArrayList treasure = new ArrayList();
Random rand = new Random();
public String ScoreCount = \"Score: \" + score;
public Mainpanel()
{
setPreferredSize(new Dimension(boardWidth,boardHeight));
addKeyListener(this);
setFocusable(true);
player1= new player (100,100);
player2= new player (200,200);
addKeyListener(new move(player1));
addKeyListener(new move(player2));
mainTimer = new Timer(10,this);
mainTimer.start();
startGame();
}
JLabel scoreLabel = new JLabel(\"Score: 0\");
public void paintComponent(Graphics page)
{
super.paintComponent(page);
Graphics2D g2d =(Graphics2D) page;
player1.draw(g2d);
player2.draw(g2d);
g2d.
g2d.setColor(new Color(128, 128, 128));
g2d.fillRect(0, 0, 50, 1000);
g2d.setColor(new Color(128, 128, 128));
g2d.fillRect(950, 0, 50, 1000);
g2d.setColor(new Color(128, 128, 128));
g2d.fillRect(50, 0, 900, 50);
g2d.setColor(new Color(128, 128, 128));;
g2d.fillRect(50, 950, 900, 50);
for (int i=0 ; i < treasure.size(); i++){
Gold tempGold = treasure.get(i);
tempGold.draw(g2d);
}
}
public void actionPerformed (ActionEvent arg0){
player1.update();
repaint();
}
@Override
public void keyPressed(KeyEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void keyReleased(KeyEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void keyTyped(KeyEvent arg0) {
// TODO Auto-generated method stub
}
public void addGold(Gold g){
treasure.add(g);
}
public static void removeGold (Gold g) {
treasure.remove(g);
}
public static ArrayList getGoldList() {
return treasure;
}
public void startGame() {
for (int i=0; i < goldCount; i++){
addGold(new Gold(rand.
JavaScript APIs - The Web is the Platform - MDN Hack Day, MontevideoRobert Nyman
The document discusses several JavaScript APIs available in the browser including fullscreen API, camera API, WebRTC, Pointer Lock API, IndexedDB, battery status API, Boot to Gecko, telephony and SMS APIs, vibration API, and developer tools. It provides code examples for how to use these APIs to enable fullscreen mode, access camera and files, capture video streams, track pointer movement, store data in IndexedDB, get battery status, make phone calls and send SMS, trigger vibration, and debug web applications.
Interactive Music II ProcessingとSuperColliderの連携 -2Atsushi Tadokoro
This document provides instructions and examples for connecting Processing and SuperCollider using the SuperCollider client for Processing. It begins with assignments for a final project using SuperCollider and/or Processing with SuperCollider to create musical expressions or expressions with sound and visuals. It then reviews how to define Synths in SuperCollider and play them from Processing using the client. Several examples are provided, including circles expanding in response to mouse clicks and playing tones, bouncing balls that play tones when hitting edges, growing rectangles with FM synthesis, and moving bars with sustained tones. The document concludes by suggesting directions for the final project assignments.