/* * Do a "special thing" to the current "term" * * This function must react to a large number of possible arguments, each * corresponding to a different "action request" by the "z-term.c" package, * or by the application itself. * * The "action type" is specified by the first argument, which must be a * constant of the form "TERM_XTRA_*" as given in "z-term.h", and the second * argument specifies the "information" for that argument, if any, and will * vary according to the first argument. * * In general, this function should return zero if the action is successfully * handled, and non-zero if the action is unknown or incorrectly handled. */ //used to return "errr" static int Term_xtra_xxx(TERM_XTRA n, int v) { Term_Data td = (Term_Data)(Term.instance.data); //TODO: Actual stuff /* Analyze */ switch (n) { case TERM_XTRA.EVENT: { /* * Process some pending events XXX XXX XXX * * Wait for at least one event if "v" is non-zero * otherwise, if no events are ready, return at once. * When "keypress" events are encountered, the "ascii" * value corresponding to the key should be sent to the * "Term_keypress()" function. Certain "bizarre" keys, * such as function keys or arrow keys, may send special * sequences of characters, such as control-underscore, * plus letters corresponding to modifier keys, plus an * underscore, plus carriage return, which can be used by * the main program for "macro" triggers. This action * should handle as many events as is efficiently possible * but is only required to handle a single event, and then * only if one is ready or "v" is true. * * This action is required. */ return(CheckEvents(v == 1)?1:0); } case TERM_XTRA.FLUSH: { /* * Flush all pending events XXX XXX XXX * * This action should handle all events waiting on the * queue, optionally discarding all "keypress" events, * since they will be discarded anyway in "z-term.c". * * This action is required, but may not be "essential". */ while (!CheckEvents(false)) { ; } return(0); } case TERM_XTRA.CLEAR: { /* * Clear the entire window XXX XXX XXX * * This action should clear the entire window, and redraw * any "borders" or other "graphic" aspects of the window. * * This action is required. */ return(term_xtra_clear(td)); //return (0); } case TERM_XTRA.SHAPE: { /* * Set the cursor visibility XXX XXX XXX * * This action should change the visibility of the cursor, * if possible, to the requested value (0=off, 1=on) * * This action is optional, but can improve both the * efficiency (and attractiveness) of the program. */ throw new NotImplementedException(); //return (0); } case TERM_XTRA.FROSH: { /* * Flush a row of output XXX XXX XXX * * This action should make sure that row "v" of the "output" * to the window will actually appear on the window. * * This action is optional, assuming that "Term_text_xxx()" * (and similar functions) draw directly to the screen, or * that the "TERM_XTRA_FRESH" entry below takes care of any * necessary flushing issues. */ throw new NotImplementedException(); //return (0); } case TERM_XTRA.FRESH: { /* * Flush output XXX XXX XXX * * This action should make sure that all "output" to the * window will actually appear on the window. * * This action is optional, assuming that "Term_text_xxx()" * (and similar functions) draw directly to the screen, or * that the "TERM_XTRA_FROSH" entry above takes care of any * necessary flushing issues. */ //TODO: Make sure this is correct //throw new NotImplementedException(); return(0); } case TERM_XTRA.NOISE: { /* * Make a noise XXX XXX XXX * * This action should produce a "beep" noise. * * This action is optional, but convenient. */ throw new NotImplementedException(); //return (0); } case TERM_XTRA.BORED: { /* * Handle random events when bored XXX XXX XXX * * This action is optional, and normally not important */ throw new NotImplementedException(); //return (0); } case TERM_XTRA.REACT: { /* * React to global changes XXX XXX XXX * * For example, this action can be used to react to * changes in the global "angband_color_table[MAX_COLORS][4]" array. * * This action is optional, but can be very useful for * handling "color changes" and the "arg_sound" and/or * "arg_graphics" options. */ return(0); } case TERM_XTRA.ALIVE: { /* * Change the "hard" level XXX XXX XXX * * This action is used if the program changes "aliveness" * by being either "suspended" (v=0) or "resumed" (v=1) * This action is optional, unless the computer uses the * same "physical screen" for multiple programs, in which * case this action should clean up to let other programs * use the screen, or resume from such a cleaned up state. * * This action is currently only used by "main-gcu.c", * on UNIX machines, to allow proper "suspending". */ throw new NotImplementedException(); //return (0); } case TERM_XTRA.LEVEL: { /* * Change the "soft" level XXX XXX XXX * * This action is used when the term window changes "activation" * either by becoming "inactive" (v=0) or "active" (v=1) * * This action can be used to do things like activate the proper * font / drawing mode for the newly active term window. This * action should NOT change which window has the "focus", which * window is "raised", or anything like that. * * This action is optional if all the other things which depend * on what term is active handle activation themself, or if only * one "term_data" structure is supported by this file. */ //throw new NotImplementedException(); return(0); } case TERM_XTRA.DELAY: { /* * Delay for some milliseconds XXX XXX XXX * * This action is useful for proper "timing" of certain * visual effects, such as breath attacks. * * This action is optional, but may be required by this file, * especially if special "macro sequences" must be supported. */ Thread.Sleep(v); return(0); } } /* Unknown or Unhandled action */ throw new NotImplementedException(); //return (1); }
/* * Do a "special thing" to the current "term" * * This function must react to a large number of possible arguments, each * corresponding to a different "action request" by the "z-term.c" package, * or by the application itself. * * The "action type" is specified by the first argument, which must be a * constant of the form "TERM_XTRA_*" as given in "z-term.h", and the second * argument specifies the "information" for that argument, if any, and will * vary according to the first argument. * * In general, this function should return zero if the action is successfully * handled, and non-zero if the action is unknown or incorrectly handled. */ //used to return "errr" static int Term_xtra_xxx(TERM_XTRA n, int v) { Term_Data td = (Term_Data)(Term.instance.data); //TODO: Actual stuff /* Analyze */ switch(n) { case TERM_XTRA.EVENT: { /* * Process some pending events XXX XXX XXX * * Wait for at least one event if "v" is non-zero * otherwise, if no events are ready, return at once. * When "keypress" events are encountered, the "ascii" * value corresponding to the key should be sent to the * "Term_keypress()" function. Certain "bizarre" keys, * such as function keys or arrow keys, may send special * sequences of characters, such as control-underscore, * plus letters corresponding to modifier keys, plus an * underscore, plus carriage return, which can be used by * the main program for "macro" triggers. This action * should handle as many events as is efficiently possible * but is only required to handle a single event, and then * only if one is ready or "v" is true. * * This action is required. */ return (CheckEvents(v==1)?1:0); } case TERM_XTRA.FLUSH: { /* * Flush all pending events XXX XXX XXX * * This action should handle all events waiting on the * queue, optionally discarding all "keypress" events, * since they will be discarded anyway in "z-term.c". * * This action is required, but may not be "essential". */ while(!CheckEvents(false)); return (0); } case TERM_XTRA.CLEAR: { /* * Clear the entire window XXX XXX XXX * * This action should clear the entire window, and redraw * any "borders" or other "graphic" aspects of the window. * * This action is required. */ return term_xtra_clear(td); //return (0); } case TERM_XTRA.SHAPE: { /* * Set the cursor visibility XXX XXX XXX * * This action should change the visibility of the cursor, * if possible, to the requested value (0=off, 1=on) * * This action is optional, but can improve both the * efficiency (and attractiveness) of the program. */ throw new NotImplementedException(); //return (0); } case TERM_XTRA.FROSH: { /* * Flush a row of output XXX XXX XXX * * This action should make sure that row "v" of the "output" * to the window will actually appear on the window. * * This action is optional, assuming that "Term_text_xxx()" * (and similar functions) draw directly to the screen, or * that the "TERM_XTRA_FRESH" entry below takes care of any * necessary flushing issues. */ throw new NotImplementedException(); //return (0); } case TERM_XTRA.FRESH: { /* * Flush output XXX XXX XXX * * This action should make sure that all "output" to the * window will actually appear on the window. * * This action is optional, assuming that "Term_text_xxx()" * (and similar functions) draw directly to the screen, or * that the "TERM_XTRA_FROSH" entry above takes care of any * necessary flushing issues. */ //TODO: Make sure this is correct //throw new NotImplementedException(); return (0); } case TERM_XTRA.NOISE: { /* * Make a noise XXX XXX XXX * * This action should produce a "beep" noise. * * This action is optional, but convenient. */ throw new NotImplementedException(); //return (0); } case TERM_XTRA.BORED: { /* * Handle random events when bored XXX XXX XXX * * This action is optional, and normally not important */ throw new NotImplementedException(); //return (0); } case TERM_XTRA.REACT: { /* * React to global changes XXX XXX XXX * * For example, this action can be used to react to * changes in the global "angband_color_table[MAX_COLORS][4]" array. * * This action is optional, but can be very useful for * handling "color changes" and the "arg_sound" and/or * "arg_graphics" options. */ return (0); } case TERM_XTRA.ALIVE: { /* * Change the "hard" level XXX XXX XXX * * This action is used if the program changes "aliveness" * by being either "suspended" (v=0) or "resumed" (v=1) * This action is optional, unless the computer uses the * same "physical screen" for multiple programs, in which * case this action should clean up to let other programs * use the screen, or resume from such a cleaned up state. * * This action is currently only used by "main-gcu.c", * on UNIX machines, to allow proper "suspending". */ throw new NotImplementedException(); //return (0); } case TERM_XTRA.LEVEL: { /* * Change the "soft" level XXX XXX XXX * * This action is used when the term window changes "activation" * either by becoming "inactive" (v=0) or "active" (v=1) * * This action can be used to do things like activate the proper * font / drawing mode for the newly active term window. This * action should NOT change which window has the "focus", which * window is "raised", or anything like that. * * This action is optional if all the other things which depend * on what term is active handle activation themself, or if only * one "term_data" structure is supported by this file. */ //throw new NotImplementedException(); return (0); } case TERM_XTRA.DELAY: { /* * Delay for some milliseconds XXX XXX XXX * * This action is useful for proper "timing" of certain * visual effects, such as breath attacks. * * This action is optional, but may be required by this file, * especially if special "macro sequences" must be supported. */ Thread.Sleep(v); return (0); } } /* Unknown or Unhandled action */ throw new NotImplementedException(); //return (1); }