mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-26 22:51:01 +00:00
some minor cleanup
This commit is contained in:
parent
dea5fa2a21
commit
02c92021ab
@ -79,7 +79,6 @@ void Console::ScrollUp(short n)
|
||||
cursorY--;
|
||||
std::copy(chars.begin() + cols, chars.end(), chars.begin());
|
||||
std::fill(chars.end() - cols, chars.end(), ' ');
|
||||
//Console::Draw();
|
||||
RgnHandle rgn = NewRgn();
|
||||
ScrollRect(&bounds, 0, -cellSizeY, rgn);
|
||||
DisposeRgn(rgn);
|
||||
@ -89,7 +88,6 @@ void Console::putch(char c)
|
||||
{
|
||||
PortSetter setport(consolePort);
|
||||
|
||||
//Debugger();
|
||||
switch(c)
|
||||
{
|
||||
case '\r':
|
||||
@ -131,23 +129,21 @@ std::string Console::ReadLine()
|
||||
c = '\n';
|
||||
|
||||
if(c == '\b')
|
||||
{
|
||||
if(buffer.size())
|
||||
{
|
||||
cursorX--;
|
||||
putch(' ');
|
||||
cursorX--;
|
||||
|
||||
buffer.substr(0,buffer.size()-1);
|
||||
buffer.resize(buffer.size()-1);
|
||||
}
|
||||
|
||||
continue;
|
||||
//c = 'X';
|
||||
}
|
||||
if(c == 127)
|
||||
{
|
||||
c = 'Y';
|
||||
}
|
||||
|
||||
putch(c);
|
||||
buffer += std::string(1,c);
|
||||
buffer.append(1,c);
|
||||
} while(c != '\n');
|
||||
return buffer;
|
||||
}
|
||||
|
37
App2/test.cc
37
App2/test.cc
@ -101,28 +101,9 @@ int main(int argc, char** argv)
|
||||
__write_hook = &consolewrite;
|
||||
__read_hook = &consoleread;
|
||||
|
||||
console.putch('x');
|
||||
console.putch('a');
|
||||
console.putch('b');
|
||||
console.putch('c');
|
||||
console.putch('a');
|
||||
console.putch('a');
|
||||
Console::currentInstance->putch('Y');
|
||||
printf("Hello...\n");
|
||||
console.putch('b');
|
||||
console.putch('\n');
|
||||
|
||||
std::cout << "Hello, world.\n";
|
||||
printf("Hello, world.\n");
|
||||
console.putch('a');
|
||||
Console::currentInstance->putch('Y');
|
||||
std::cout << "Hello, world, again.\n";
|
||||
|
||||
/*std::cout << "X\n";
|
||||
for(int i = 1; i <= 100; i++)
|
||||
std::cout << "Hello, world: " << i << std::endl;
|
||||
std::cout << std::flush;
|
||||
|
||||
std::cout << "Say something: " << std::flush;*/
|
||||
printf("Say something: ");
|
||||
fflush(stdout);
|
||||
printf("You said: %s\n", console.ReadLine().c_str());
|
||||
@ -136,15 +117,18 @@ int main(int argc, char** argv)
|
||||
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
//std::cout << "Exception speed test: " << std::flush;
|
||||
printf("Exception speed test: "); fflush(stdout);
|
||||
int n = i == 0 ? 1 : 100;
|
||||
printf("Exception speed test (%3d iterations): ", n); fflush(stdout);
|
||||
long start = TickCount();
|
||||
for(int j = 0; j < n; j++)
|
||||
{
|
||||
try { foobar(); } catch(...) {}
|
||||
long end = TickCount();
|
||||
//std::cout << (end-start)*1000 / 60.0 << " ms\n";
|
||||
printf("%g\n",(end-start)*1000 / 60.0);
|
||||
}
|
||||
//std::cout << "Click mouse 10 times...\n";
|
||||
long end = TickCount();
|
||||
|
||||
printf("%g ms per throw/catch\n",(end-start)*1000 / 60.0 / n);
|
||||
}
|
||||
|
||||
const int n = 3;
|
||||
printf("Click mouse %d times...\n", n);
|
||||
for(int i = 0; i < n; i++)
|
||||
@ -153,7 +137,6 @@ int main(int argc, char** argv)
|
||||
;
|
||||
while(Button())
|
||||
;
|
||||
//std::cout << "Click #" << i + 1 << std::endl;
|
||||
printf("Click #%d\n", i+1);
|
||||
}
|
||||
FlushEvents(everyEvent, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user