#include <stdlib.h>
#include "screen.cpp"
#include "keyboard.cpp"
#include "mouse.cpp"
int main(void)
{
Screen *layar = new Screen();
Keyboard *tombol = new Keyboard(layar);
Mouse *tikus = new Mouse();
UCHAR str[5];
USHORT x, y;
layar->setMode(0x03); layar->setCursorPos(4, 14);
tombol->hideCursor();
if (tikus->getState() == MOUSE_NOT_READY)
{
layar->writeString("Mouse tidak siap! Tekan ENTER ...");
tombol->getString(str, 0);
}
tikus->showMouse();
layar->writeString("Klik A, B atau C");
layar->setCursorPos(5, 14);
layar->writeString("[A] Huruf A");
layar->setCursorPos(6, 14);
layar->writeString("[B] Huruf B");
layar->setCursorPos(7, 14);
layar->writeString("[C] Selesasi");
while (TRUE)
{
layar->setCursorPos(9, 14);
if (tikus->getClickMode() == MOUSE_LEFT_CLICK)
{
x = tikus->getX() / 8; /* Periksa posisi horizontal */
y = tikus->getY() / 8; /* Periksa posisi vertikal */
if ((x == 15) && (y == 5))
layar->writeString("Anda memilih A!");
if ((x == 15) && (y == 6))
layar->writeString("Anda memilih B!");
if ((x == 15) && (y == 7)) break;
}
}
delete layar; delete tombol; delete tikus;
return EXIT_SUCCESS;
}
Gambarnya Sebagai Berikut :
#include "screen.cpp"
#include "keyboard.cpp"
#include "mouse.cpp"
int main(void)
{
Screen *layar = new Screen();
Keyboard *tombol = new Keyboard(layar);
Mouse *tikus = new Mouse();
UCHAR str[5];
USHORT x, y;
layar->setMode(0x03); layar->setCursorPos(4, 14);
tombol->hideCursor();
if (tikus->getState() == MOUSE_NOT_READY)
{
layar->writeString("Mouse tidak siap! Tekan ENTER ...");
tombol->getString(str, 0);
}
tikus->showMouse();
layar->writeString("Klik A, B atau C");
layar->setCursorPos(5, 14);
layar->writeString("[A] Huruf A");
layar->setCursorPos(6, 14);
layar->writeString("[B] Huruf B");
layar->setCursorPos(7, 14);
layar->writeString("[C] Selesasi");
while (TRUE)
{
layar->setCursorPos(9, 14);
if (tikus->getClickMode() == MOUSE_LEFT_CLICK)
{
x = tikus->getX() / 8; /* Periksa posisi horizontal */
y = tikus->getY() / 8; /* Periksa posisi vertikal */
if ((x == 15) && (y == 5))
layar->writeString("Anda memilih A!");
if ((x == 15) && (y == 6))
layar->writeString("Anda memilih B!");
if ((x == 15) && (y == 7)) break;
}
}
delete layar; delete tombol; delete tikus;
return EXIT_SUCCESS;
}
Gambarnya Sebagai Berikut :