home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
scase.zip
/
SCASE.Z
/
STDIOCTR.CC
< prev
next >
Wrap
C/C++ Source or Header
|
1994-10-17
|
3KB
|
105 lines
/******************************************************************************
* ** Company Confidential **
* ** Copyright 1994, All rights Reserved **
* %Z%%M% version %I% date:%G%
******************************************************************************/
// -MQBeg- [Module_Includes] [stdioctr_cc] <0000001B.00000000> Retained!
#include "stdio.h"
#include "ttteng.h"
#include "tttdisp.h"
#include "tttcont.h"
#include "stdiodsp.h"
#include "stdioctr.h"
// -MQEnd- [Module_Includes] [stdioctr_cc] <0000001B.00000000>
// -MQBeg- [Module_Declarations_1] [stdioctr_cc] <0000001B.00000000> Retained!
void main()
{
TTT_Engine *Engine = new TTT_Engine;
TTT_Display *Display = new TTT_StdioDisplay(Engine);
TTT_Controller *Controller = new TTT_StdioController(Engine, Display);
Controller->Start();
delete Controller;
}
// -MQEnd- [Module_Declarations_1] [stdioctr_cc] <0000001B.00000000>
// -MQBeg- [Class_Body] [TTT_StdioController] <00000000.00000007>
/******************************************************************************
TTT_StdioController
******************************************************************************/
TTT_StdioController::TTT_StdioController(TTT_Engine *Engine, TTT_Display *Disp)
// -MQBeg- [Op_Init] [TTT_StdioController::TTT_StdioController] <0000002F.0000000F> Retained!
: TTT_Controller(Engine, Disp)
// -MQEnd- [Op_Init] [TTT_StdioController::TTT_StdioController] <0000002F.0000000F>
{
// -MQBeg- [Op_Body] [TTT_StdioController::TTT_StdioController] <0000002F.0000000F> Retained!
// -MQEnd- [Op_Body] [TTT_StdioController::TTT_StdioController] <0000002F.0000000F>
}
void
TTT_StdioController::Start()
{
// -MQBeg- [Op_Body] [TTT_StdioController::Start] <0000002F.00000010> Retained!
TTT_Controller::Start();
int Cell = 0;
while(1)
{
TTT_Controller::TTT_EVENT Event = GetUserEvent(Cell);
HandleEvent(Event, Cell);
if (Event == QUIT) break;
}
// -MQEnd- [Op_Body] [TTT_StdioController::Start] <0000002F.00000010>
}
TTT_Controller::TTT_EVENT
TTT_StdioController::GetUserEvent(int& Cell)
{
// -MQBeg- [Op_Body] [TTT_StdioController::GetUserEvent] <0000002F.00000011> Retained!
char inbuf[256];
TTT_Controller::TTT_EVENT Event = NULL_EVENT;
while ( Event == NULL_EVENT )
{
printf("\n 0 | 1 | 2\n ---+---+---\n 3 | 4 | 5\n ---+---+---\n 6 | 7 | 8\n");
printf("<R>eset <Q>uit\n\n");
printf("Enter Choice:\n");
gets(inbuf);
switch(inbuf[0])
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
Cell = inbuf[0] - '0';
Event = MOVE;
break;
case 'r':
case 'R':
Event = RESET;
break;
case 'q':
case 'Q':
Event = QUIT;
break;
}
}
return Event;
// -MQEnd- [Op_Body] [TTT_StdioController::GetUserEvent] <0000002F.00000011>
}
// -MQEnd- [Class_Body] [TTT_StdioController] <00000000.00000007>
// -MQBeg- [Module_Declarations_2] [stdioctr_cc] <0000001B.00000000> Retained!
// -MQEnd- [Module_Declarations_2] [stdioctr_cc] <0000001B.00000000>