Beruflich Dokumente
Kultur Dokumente
cpp_______________________________
# include "Igel.h"
# include <iostream>
using namespace std;
int x = 500;
int y = 400;
if (!strcmp(text, "Ellipse"))
{
e.r.lo.x = xo;
e.r.lo.y = yo;
e.r.ru.x = xu;
e.r.ru.y = yu;
e.strich = strich;
drawEllipse(e);
}
else if (!strcmp(text, "Linie"))
{
lin.anfang.x = xu;
lin.anfang.y = yu;
lin.ende.x = xo;
lin.ende.y = yo;
lin.strich = strich;
drawLinie(lin);
}
if (feof(pf)) break;
}
}
void IgelMain()
{
int anzahl, min, max;
int i;
zeichen();
}*/
int pFeld[3][3] = { 0 };
void IgelMain()
{
show_console();
//int pFeld[3][3] = { 0 };
for (int i = 0; i < 3; i++)
for (int k = 0; k < 3; k++)
printf("%d", pFeld[k][i]);
hide_console();
zeichneFeld();
ausfhrung();
void ausfhrung()
{
boolean player = 1;
int evt;
for (; ;)
{
int mx, my, u;
//update
//klickphase
evt = mouse_event(&u, &mx, &my, 1);
if (evt = WM_LBUTTONDOWN)
{
//Feld oben links
if (mx > 100 && mx < 300 && my > 100 && my < 300)
{
if (pFeld[0][0] == 0 && player == 1) // Player 1 O
{
ellipse(120, 120, 280, 280, 1, RGB(0, 0, 0), RGB(255,
255, 255));
pFeld[0][0] = 1;
}
if (pFeld[0][0] == 0 && player == 2) //Player 2 X
{
int x = 120, y = 120;
zeichnex(x, y);
pFeld[0][0] = 2;
}
//show_console();
}
}
void zeichneFeld()
{
int x = 100;
int y = 100;
moveto(x, y);
//Aussenrahmen
lineto(x + 600, y, 1, (0, 0, 0));
lineto(x + 600, y + 600, 1, (0, 0, 0));
lineto(x, y + 600, 1, (0, 0, 0));
lineto(x, y, 1, (0, 0, 0));
//Innenlinien senkrecht
//Innenlinien waagerecht
moveto(x, y + 200);
lineto(x + 600, y + 200, 1, (0, 0, 0));
moveto(x, y + 400);
lineto(x + 600, y + 400, 1, (0, 0, 0));
}
}
HEADER.h ______________________________________________________________________________
# ifndef IGEL_H
# define IGEL_H
# include <stdio.h>
# include <windows.h>
# include <conio.h>
struct punkt
{
int x;
int y;
};
struct rect
{
struct punkt lo;
struct punkt ru;
};
;
struct ellipse
{
int strich;
struct rect r;
char text[30];
};
struct linie
{
punkt anfang;
punkt ende;
int strich;
};
extern void ellipse(int lox, int loy, int rux, int ruy, int strich, COLORREF frame, COLORREF fill);
extern void eframe(int lox, int loy, int rux, int ruy, int strich, COLORREF frame);
extern void fill(int x, int y, COLORREF fill, COLORREF border);
extern void lineto(int x, int y, int strich, COLORREF c);
extern void moveto(int x, int y);
extern void setpixel(int x, int y, COLORREF c);
extern COLORREF getpixel(int x, int y);
extern void rectangle(int lox, int loy, int rux, int ruy, int strich, COLORREF frame, COLORREF
fill);
extern void rframe(int lox, int loy, int rux, int ruy, int strich, COLORREF c);
extern void text(int x, int y, int siz, COLORREF bkc, COLORREF txc, int mode, char *fmt, ...);
extern void textbox(int lox, int loy, int rux, int ruy, int strich, COLORREF frame, COLORREF fill,
int siz, COLORREF txc, char *fmt, ...);
extern int load_bitmap(char *bmpfile);
extern int mouse_event(int *flags, int *x, int *y, int wait);
extern int select(int anzahl, ...);
# endif