- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Keyboard and Events.ppt
Keyboard and Events Fall 2009 Simply displaying text // Step 1: Create the font using the Tool menu option // Step 2: Declare PFont variable PFont f; void setup() { size(200,200); // Step 3: Load Font f = loadFont( Albany-48.vlw ); } void draw() { background(255); textFont(f,16); // Step 4: Specify font to be used fill(0); // Step 5: Specify font color // Step 6: Display Text text ( Mmmmm ... Strings ... ,10,100); } What are Strings? String is a data type (like int or char) It stores collections of characters (i.e., chars) that are delineated by quotes. char letter =‘b’; String word = “this is more than one word”; Any character on the keyboard (including numbers) can be part of a String You try it! // Step 1: Create the font using the Tool menu option // Step 2: Declare PFont variable PFont f; void setup() { size(200,200); // Step 3: Load Font f = loadFont( “you fill this in ); } void draw() { background(255); textFont(f, you fill this in); // Step 4: Specify font fill(0); // Step 5: Specify font color // Step 6: Display Text String message = “you fill this in ; text (message,10,100); } What about the keyboard? Keyboard inputs can be used in many waysnot just for text The boolean variable keyPressed is true if a key is pressed and false if not. keyPressed is true as long as a key is held down Another example with keyPressed // Move a line while any key is pressed int x = 20; void setup() { size(100, 100); smooth(); strokeWeight(4); } void draw() { background(204); if (keyPressed == true) { // If the key is pressed x++; // add 1 to x } line(x, 20, x-60, 80); } You can also display text The key variable is of type char and stores the most recently pressed key But characters are really numbers Each character has a numerical value defined by the ASCII code Coded Keys Processing can also read the value from other keys such as the ar
您可能关注的文档
- how gentle is the rain that falls softly on the meadow b.ppt
- How To Tell The Time.ppt
- huge arm.ppt
- Human rights - health and reproduction in Europe.ppt
- Incident Reporting and Fraud (and FOIA).ppt
- IndividualCertification bodies.ppt
- Infusing South AsiaGovernance Challenges in South Asia.ppt
- International investments in agricultural production.ppt
- Internet Security and Identity Theft.ppt
- Intracellular Compartments and Protein Sorting.ppt
- knot intervals and T-splinesThomas W. Sederberg.ppt
- Korea's Makeover from Dull to Hip Changes the Face of Asia.ppt
- La historia del bioterrorismo.ppt
- Laboratory of Immunobiochemistry Site Visit.ppt
- LabVIEW功能教学Queue.ppt
- Language Archiving- Document Annotation and Corpus Lingu.ppt
- Largest country in South Asia.ppt
- LBNL Ergonomics Resources.ppt
- Learning Tasks.ppt
- Lec 4, Friday 17 Feb.ppt
最近下载
- 《阳光下的世界》小学五年级美术PPT课件.pptx VIP
- 《物业管理师》三级考试练习题及参考答案.docx
- 2025秋语文二年级上册部编版-第3单元-教案.docx VIP
- 2025年高考语文二轮复习(新高考通用)专题13主旨意蕴题(练习)(学生版+解析).docx VIP
- 见证取样送检及检验批划分计划.pdf VIP
- BZ-120Ⅲ高速理瓶机使用说明书.pdf
- 2013混凝土配合比材料成本测算表.doc VIP
- 300T汽车吊性能说明书-XCA300_1全地面起重机技术规格书+[主臂风电臂加超起].pdf VIP
- 部编版(人教版)九年级语文上册教材解析及教学建议.pptx VIP
- 《思政教材分析与教学设计》课程教学大纲.docx VIP
文档评论(0)