Files
degvi/Window.c
2013-01-31 07:30:12 +09:00

48 lines
755 B
C

#include "init.h"
#include <stdlib.h>
#include <stdio.h>
#include "Window.h"
Window Window_create(Terminal terminal, int x, int y, int width, int height)
{
Window this;
this = malloc(sizeof(struct Window_struct));
if (this == NULL) {
fprintf(stderr, "malloc failed\n");
exit(EXIT_FAILURE);
}
this->terminal = terminal;
this->x = x;
this->y = y;
this->width = width;
this->height = height;
return this;
}
void Window_destroy(Window this)
{
if (this == NULL) {
return;
}
free(this);
}
int Window_width(Window this)
{
return this->width;
}
int Window_height(Window this)
{
return this->height;
}
void Window_setCursorPosition(Window this, int x, int y)
{
Terminal_setCursorPosition(this->terminal, this->x + x, this->y + y);
}