Announcements How’s it going? My internet/power supply?

Slides:



Advertisements
Similar presentations
Fundamentals of Computer and programming in C Programming Languages, Programs and Programming Rohit Khokher.
Advertisements

Game with US Beginner Tutorial. Welcome!! Who I am What is Processing? Basic Coding Input Methods Images Classes Arrays.
C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
The Web Warrior Guide to Web Design Technologies
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Changing Control.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
PROCESSING Animation. Objectives Be able to create Processing animations Be able to create interactive Processing programs.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
Review Blocks of code {.. A bunch of ‘statements’; } Structured programming Learning Processing: Slides by Don Smith 1.
Locally Edited Animations We will need 3 files to help get us started at
1 k Jarek Rossignac,  2008 Processing  Install Processing  Learn how to edit, run, save, export, post programs  Understand.
Bug Session Four. Session description Objectives Session activities summary Resources Prior knowledge of sequencing instructions using Bug Bug website.
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.
Processing Lecture.2 Mouse and Keyboard
Working with the VB IDE. Running a Program u Clicking the”start” tool begins the program u The “break” tool pauses a program in mid-execution u The “end”
Structure of a C program Preprocessor directive (header file) Program statement } Preprocessor directive Global variable declaration Comments Local variable.
Applications Development
CIS 3.5 Lecture 2.2 More programming with "Processing"
VARIABLES Programmes work by manipulating data placed in memory. The data can be numbers, text, objects, pointers to other memory areas, and more besides.
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.
Variables and Functions ROBOTC Software © 2012 Project Lead The Way, Inc.Principles of Engineering.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
Computer Science I Programming in Java (programming using Processing IN Java, using IntelliJ IDE) Classwork/Homework: copy your Processing projects over.
Computer Science I Recap: variables & functions. Images. Pseudo-random processing.
E-1 University of Washington Computer Programming I Lecture 5: Input and Output (I/O) © 2000 UW CSE.
G RAPHICS & I NTERACTIVE P ROGRAMMING Lecture 2 More Programming with Processing.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Functional Abstraction Reduces Complexity.
Computer Science I Go over midterm. Reprise on curves. Table examples. The map function. Testing Strings. Fonts. Classwork/Homework: Complete midterm project.
Chapter 4 Strings and Screen I/O. Objectives Define strings and literals. Explain classes and objects. Use the string class to store strings. Perform.
2.02F Adding and Animating Text in Computer Animations
var variableName:datatype;
Fundamentals of Python: First Programs
Basic Input and Output CSE 120 Spring 2017
FOP: User Input & Strings
Introduction to the C Language
Chapter 2 Elementary Programming
University of Washington Computer Programming I
Variables, Expressions, and IO
1st Grade Test Review Tech Test Q & A Spring 2011.
Review As binary, what is /20/2018
Announcement Tomorrow’s office hr: CANCELLED! Show work!!
Constant Variable Expression
Basic Input and Output CSE 120 Winter 2018
Variables and Arithmetic Operations
To do … Web Exercise: Quiz-3, HW#2 Score: update
Introduction to the C Language
WEB PROGRAMMING JavaScript.
Chapter 3 Classes and Objects
Mouse Inputs in Processing
Announcements Mid-Term Exam!! Quiz 5 Again + Quiz 6 Exercise 5
Light Bot Solutions: an analysis
Light Bot Solutions: an analysis
More programming with "Processing"
Announcement Function ppt: download again
Testing and Repetition
Announcements: Reading materials are posted on Discussion Board.
ICT Gaming Lesson 3.
Basic Input and Output CSE 120 Winter 2019
Variables, Assignments Testing + Iteration
User Input Keyboard input.
Announcements How to save your work? Quiz solution 5/5/2019
Buttons & Boards CSE 120 Winter 2019
Announcements: Questions: Names on the board? Why?
Basic Processing … Drawing pictures … It’s not art, it’s fun
Announcements Survey feedback: summary Quiz: HW 7:
Today: to list: Syllabus change: Grade on-line
Announcements Jack group member by Thursday!! Quiz-8? HW10
Presentation transcript:

Announcements How’s it going? My internet/power supply? We lost internet last night at 12AM!? Email questions: Jack and I!! Global vs Local variables Do I need a global-X to declare a local X? What are those “{}”? For loop? If statements? Why did my code work? 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

The Mouse, Keys & Text Getting Information In and Out Kelvin Sung University of Washington, Bothell (* Use/Modification with permission based on Larry Snyder’s CSE120 ) © Lawrence Snyder 2004

Plan for Today An important part of computing is the input to the program and the output it produces We consider three types of I/O Mouse Input Key Input Image Output Text Output 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

The Story of a Mouse So that it is all out there, here’s the situation on the mouse (you’ve seen most of this): mouseX and mouseY give the coordinates of the mouse on the canvas … recall: rect(mouseX, mouseY, 20, 20); void mousePressed ( ) { dir = 0 – dir; } There’s also mouseReleased that “fires” when the mouse is released after being pressed 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

What would you see? Just Do It 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Stop Animation Action We can control “looping” with the mouse 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

What would you see? Control “looping” with the mouse … Looping off Turn looping on Turn looping off 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

What would you see? Pressing a key is like pressing mouse button … Just Do It 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Keyboard Keys … Similar to Mouse Pressing a key is like pressing mouse button … Result of typing g y m m y g 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Datatype Information The key keyword has the value of the key just pressed; it has the datatype of a character, that is, char Notice that characters are enclosed in single quotes: 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

So, What Does This Code Do? Just Do It 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Summary on Input Variables: Functions: mouseX, mouseY, key Functions: mousePressed, mouseReleased, keyPressed Is there a keyRelease? (TRY IT?) What is the datatype of each variable? What does the definition of the function look like? 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

What would you see? Just Do It 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Image format jpg vs. png!! “Transparency”?  1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Soccer Example … Erase the “ghosting” effect? Center the mouse position? Make the soccer ball travel by itself? Why all these questions? 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Writing Out Text Processing is great for graphics and images, but it is a little more cumbersome for text Follow these steps: 1) Go to tools and locate the font you want 2) Load font into the data directory of your program … this happens automatically when you load 3) In the code, load the font into the computation (get name and size perfect); specify its use 4) Use text( ) to print text; color using fill( ) 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Find Fave Font “Create Font …” is under Tools 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Pick Font, Size Try to pick common fonts Click to load font into the data directory 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Pick Font, Size Try to pick common fonts Click to load font into the data directory 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Declare Font Var, Load, Select Need to declare font name(s) 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Declare Font Var, Load, Select Need to declare font name(s) Need to load named font 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Declare Font Var, Load, Select Need to declare font name(s) Need to load named font Need to select named font as “in use” 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Declare Font Var, Load, Select Need to declare font name(s) Need to load named font Need to select named font as “in use” Then, fill( ) and write text( … ); Just Do It 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Declare Font Var, Load, Select Need to declare font name(s) Need to load named font Need to select named font as “in use” Then, fill( ) and write text( … ); 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Switching Fonts … Just Do It 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Echoing Text A String is a datatype of a letter sequence. The sequence must be surrounded by (double) quotes. “” is the empty String. 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Echoing Text A String is a datatype of a letter sequence. The sequence must be surrounded by (double) quotes. “” is the empty String. A character can be added to a String (it’s called concatenation) using a + sign. 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Echoing Text A String is a datatype of a letter sequence. The sequence must be surrounded by (double) quotes. “” is the empty String. Use the String like any quoted letter sequence. A character can be added to a String (it’s called concatenation) using a + sign. 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Echoing Text A String is a datatype of a letter sequence. The sequence must be surrounded by (double) quotes. “” is the empty String. Type A B C A character can be added to a String (it’s called concatenation) using a + sign. 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Echoing Text A String is a datatype of a letter sequence. The sequence must be surrounded by (double) quotes. “” is the empty String. Just Do It Type A B C A character can be added to a String (it’s called concatenation) using a + sign. 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)

Creativity Assignments … 1/12/2019 Kelvin Sung (Use/Modify with permission from © 2010-2012 Larry Snyder, CSE)