Basic Input and Output CSE 120 Winter 2019

Slides:



Advertisements
Similar presentations
Working with Intrinsic Controls and ActiveX Controls
Advertisements

Programming in Processing Taught by Ms. Madsen Assistants: Ms. Fischer and Ms. Yen Winsor School, 2/13/08.
Processing Lecture. 1 What is processing?
Variables and Operators
© Calvin College, Being abstract is something profoundly different from being vague... The purpose of abstraction is not to be vague, but to create.
 Variables  What are they?  Declaring and initializing variables  Common uses for variables  Variables you get “for free” in Processing ▪ Aka: Built-in.
Data: Programming Design and Modularization IS 101Y/CMSC 101 Computational Thinking and Design Thursday, September 26, 2013 Marie desJardins University.
Processing Processing is a simple programming environment that was created to make it easier to develop visually oriented applications with an emphasis.
Lecture 3 IAT 800. Sept 15, Fall 2006IAT 8002 Suggestions on learning to program  Spend a lot of time fiddling around with code –Programming is something.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Continuous February 16, Test Review What expression represents the zip car eligibility rules of at least 18 years old and no incidents?
Keyboard and Events. What about the keyboard? Keyboard inputs can be used in many ways---not just for text The boolean variable keyPressed is true if.
Review of ArT3 Programming Course David Meredith Aalborg University
CIS 3.5 Lecture 2.2 More programming with "Processing"
Variables Art &Technology, 3rd Semester Aalborg University Programming David Meredith
CSC 1010 Programming for All Lecture 7 Input, Output & Graphics.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 More details and explanation …
Test 2 Review. General Info. All tests are comprehensive. You are still responsible for the material covered prior to the first exam. You will be tested.
G RAPHICS & I NTERACTIVE P ROGRAMMING Lecture 2 More Programming with Processing.
Data: Programming Design and Modularization IS 101Y/CMSC 101 Computational Thinking and Design Thursday, September 25, 2014 Carolyn Seaman Susan Martin.
What is Computing? What can be Programmed? Creative Computing Processing Downloading Processing Dropbox Primitive Shapes – point – line – triangle – quad.
Review Random numbers mouseX, mouseY setup() & draw() frameRate(), loop(), noLoop() Mouse and Keyboard interaction Arcs, curves, bézier curves, custom.
Variables. Something to mention… void setup(){ size(200, 200); background(255); smooth(); } void draw() { stroke(0); strokeWeight(abs(mouseX-pmouseX));
Introduction to Processing David Meredith Aalborg University Art &Technology, 3rd Semester Programming.
Nested Loops & Arrays CSE 120 Spring 2017
Week 2 - Wednesday CS 121.
Development Environment
CUS POWERPOINT PRESENTATION
Topics Designing a Program Input, Processing, and Output
Basic Input and Output CSE 120 Spring 2017
p5.js mouse, keyboard and if’s
Processing Introduction CSE 120 Spring 2017
Memory, Data, & Addressing II CSE 351 Autumn 2017
Computing Fundamentals
Developing an App CSE 120 Spring 2017
Functions in Processing CSE 120 Spring 2017
Lesson Two: Everything You Need to Know
Introduction to Events
Puzzle App II CSE 120 Winter 2018
Basic Input and Output CSE 120 Winter 2018
Variables & Datatypes CSE 120 Winter 2018
Processing and Drawing CSE 120 Winter 2018
Expressions & Control Flow CSE 120 Winter 2018
Variables & Datatypes CSE 120 Spring 2017
Mouse Inputs in Processing
Today in CS161 Week #5 **weekly visit D2L** Practicing…
Strings, Puzzle App I CSE 120 Winter 2018
Computation as an Expressive Medium
Benchmark Series Microsoft Word 2016 Level 2
Nested Loops, Arrays CSE 120 Winter 2018
More programming with "Processing"
Learning the Basics of ArcMap 3.3 Updated 4/27/2010
Announcements How’s it going? My internet/power supply?
Topics Graphical User Interfaces Using the tkinter Module
IAT 265 Lecture 2: Java Loops, Arrays Processing setup, draw, mouse Shapes Transformations, Push/Pop.
Functions in Processing CSE 120 Winter 2019
Variables & Datatypes CSE 120 Winter 2019
Topics Designing a Program Input, Processing, and Output
Arrays CSE 120 Winter 2019 Instructor: Teaching Assistants:
Today in CS161 Week #5 **go to Blackboard ** Practicing…
Topics Designing a Program Input, Processing, and Output
Processing and Drawing CSE 120 Winter 2019
LCC 6310 Computation as an Expressive Medium
Loops & Nested Loops CSE 120 Winter 2019
Buttons & Boards CSE 120 Winter 2019
Variables and Operators
Chapter 1 Introducing Small Basic
EECE.2160 ECE Application Programming
Preview of 3-D Graphics Glenn G. Chappell
Expressions & Conditionals CSE 120 Winter 2019
Presentation transcript:

Basic Input and Output CSE 120 Winter 2019 Instructor: Teaching Assistants: Justin Hsia Ann Shan, Eunia Lee, Pei Lee Yap, Sam Wolfson, Travis McGaha Facebook to integrate WhatsApp, Instagram and Messenger “Until now, WhatsApp, Instagram and Messenger have been run as separate and competing products. Integrating the messaging parts might simplify Facebook's work. It wouldn't need to develop competing versions of new features, such as Stories, which all three apps have added with inconsistent results. “Cross-platform messaging may also lead the way for businesses on one platform to message potential customers on another. And it might make it easier for Facebook to share data across the three platforms, to help its targeted advertising efforts.” https://www.bbc.com/news/technology-47001460

Administrivia Assignments: “Big Idea” this week: Digital Distribution Reading Check 4 due tomorrow @ 3:30 pm (1/31) Jumping Monster due Friday (2/1) “Big Idea” this week: Digital Distribution Upcoming: Creativity Project, Midterm (2/11)

Jumping Monster Using expressions and conditionals in conjunction with variables and user input (today) to control what is drawn as well as motion:

Lecture Outline Other Useful Processing Tools User Input and Output Mouse (input) Keyboard (input) Text (output)

Transparency/Opacity You can add a 4th argument to a color! This also applies to the fill() and stroke() functions This argument also takes an integer between 0–255 0 is fully transparent (invisible) 255 is fully opaque (the default)

Custom Shapes Define vertices between beginShape() and endShape() If planning to reuse, best to create in a separate function

Functions Practice: Diamond (x,y) h w Fill in the code to produce: _____ diamond( ______________________________ ) { beginShape(); vertex( ______, ______ ); endShape(); } void draw() { }

Lecture Outline Other Useful Processing Tricks User Input and Output * Mouse Keyboard Text * We will look at a subset of the available Processing commands. For a full list, see the Processing Reference.

Reminder: System Variables Special variables that hold values related to the state of the program, often related to user input You don’t need to declare these variables These variables will update automatically as the program runs Colored pink/magenta-ish in the Processing environment We’ve used some of these already: width, height, frameCount We’ll see a lot more today

The Mouse System variables: Built-in functions: mouseX – x-coordinate of mouse in current frame mouseY – y-coordinate of mouse in current frame pmouseX – x-coordinate of mouse in previous frame pmouseY – y-coordinate of mouse in previous frame mousePressed – is a button currently being pressed? Built-in functions: mousePressed() – called very time a button is pressed mouseReleased() – called every time a button is released

Example: Drawing Dots

Example: Path Drawing We just wrote a dot-drawing program We can additionally use pmouseX and pmouseY to create a path-drawing program

Hovering Over a Rectangle (x,y) h w if(mouseX >= x) if(mouseX <= x + w)

Hovering Over a Rectangle (x,y) h w if(mouseY >= y) if(mouseY <= y + h)

Hovering Over a Rectangle (x,y) h w if( (mouseX >= x) && (mouseX <= x + w) && (mouseY >= y) && (mouseY <= y + h) )

Hovering Over a Rectangle

The Keyboard System variables: Built-in functions: New datatype: char key – stores the ASCII value of the last key press keyCode – stores codes for non-ASCII keys (e.g. UP, LEFT) keyPressed – is any key currently being pressed? Built-in functions: keyPressed() – called every time a key is pressed New datatype: char Stores a single character (really just a number) Should be surrounded by single quotes e.g. char letter = 'a';

Example: What does this code do?

Example: Keyboard Dots

Example: Moving a Rectangle Note: non-character keys, such as the arrow keys (UP, DOWN, LEFT, RIGHT) are coded keys

Example: Moving a Rectangle

Text Output println(yourText); text(yourText, x, y); Prints yourText to the console, which is the black area below your Processing code Useful for debugging text(yourText, x, y); Prints yourText on the drawing canvas, starting with the bottom-left corner at coordinate (x,y) Change the size of your text using textSize(size); yourText should be between double quotes We will talk more about the datatype String later

Example: Displaying Typed Keys

Looking Forward Next week is the Creativity Assignment In pairs, you will be asked to brainstorm TWO Processing projects of your choice You will implement and submit ONE of your two projects The point is to use the tools available to you to make something fun and creative! Planning document due Tuesday (2/5) Actual programs due next Friday (2/8) Portfolio Update 1 is due Wednesday (2/6) Taijitu, Logo Design, Lego Family, Animal Functions Ask your TAs for assistance if you encounter problems!