TRINITY CSCI 1320 - Lecture Notes (13 pages)

Previewing pages 1, 2, 3, 4 of 13 page document View the full content.
View Full Document

Lecture Notes



Previewing pages 1, 2, 3, 4 of actual document.

View the full content.
View Full Document
View Full Document

Lecture Notes

53 views


Pages:
13
School:
Trinity University
Course:
Csci 1320 - Principles of Computer Science I
Principles of Computer Science I Documents

Unformatted text preview:

Fun Day 11 21 2007 1 Opening Discussion Let s look at solutions to the interclass problem Vote was 7 for ASCII 10 for X11 Do you have any questions about the assignment 2 Full Terminal Control The ncurses library provides you with functions that allow you to write any ASCII character that you want to any point on the screen This can allow you to do ASCII animations It also includes functions for doing non blocking input and input of non character keys Normal scanf and getchar functions only read from a terminal once enter has been pressed Note that this isn t portable code It won t work on a Windows box unless perhaps you have something like Cygwin 3 Setup In order to set up a window so that you can use curses function with it you need to initialize it You do this with the WINDOW initscr function Let s look at the man page for this function The WINDOW that is returned needs to be remembered because it has to be passed to most of the functions that will draw out characters for us 4 Drawing Functions There are number of different functions that can output to the screen I m not going to type them all up here but I ll give a little list We can look at a web page for a more complete list mvaddch win y x ch mvwaddstr win y x str mvwaddchstr win y x chstr After calling one of these call refresh win to see the change You can use the See Also section of the man pages to find more related functions 5 Input Functions There are a number of functions for getting input in curses The simplest is wgetch win Unless you set other options this will work just like getchar blocking the program and printing to screen The following lines will allow non blocking nonprinted input that doesn t print keypad win 1 wtimeout win 0 necho 6 X Windows and X11 Linux and Unix boxes use a windowing system called X windows This is a very general graphical system that allows a lot of flexibility One of the most significant features of X windows is the ability to display windows remotely Cygwin can give



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?