Simple_window

Simple_window - // handle all events (as per default), but...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
2 #include "GUI.h" // for Simple_window only (doesn't really belong in Window.h) / using namespace Graph_lib; u // Simple_window is basic scaffolding for ultra-simple interaction with graphics // it provides one window with one "next" button for ultra-simple animation / string name; s struct Simple_window : Window { : Window(xy,w,h,title), button_pushed(false), next_button(Point(280,325), 150, 75, " CONTINUE ", cb_next), player_name(Point(280,275),150,30,"Name:") { attach(next_button); attach(player_name);} { void wait_for_button() // modified event loop
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // handle all events (as per default), but quit when button_pushed becomes true // this allows graphics without control inversion { while (!button_pushed) Fl::wait(); button_pushed = false; Fl::redraw(); } Button next_button; In_box player_name; private: bool button_pushed; b static void cb_next(Address, Address addr) // callback for next_button // { reference_to<Simple_window>(addr).next(); } { static_cast<Simple_window*>(addr)->next(); } void next() { button_pushed = true; name = player_name.get_string();} // void next() { button_pushed = true; } v };...
View Full Document

This note was uploaded on 02/26/2011 for the course ECE 112 taught by Professor Doraty during the Spring '11 term at Texas A&M.

Ask a homework question - tutors are online