71 int &x,
int &y,
int h)
73 int xLeft = textObj->
mX;
74 int xRight = xLeft + textObj->
mWidth - 1;
77 std::memset(&occupied, 0,
sizeof(occupied));
78 int wantedTop = (TEST - h) / 2;
79 int occupiedTop = y - wantedTop;
85 text->mX + text->mWidth > xLeft)
87 int from = text->mY - occupiedTop;
88 int to = from + text->mHeight - 1;
89 if (to < 0 || from >= TEST)
95 for (
int i = from; i <= to; ++i)
100 for (
int i = wantedTop; i < wantedTop + h; ++i)
102 ok = ok && !occupied[i];
111 for (
int seek = wantedTop + h - 2; seek >= 0; --seek)
128 for (
int seek = wantedTop + 1; seek < TEST; ++seek)
138 downSlot = seek - h + 1;
143 if (upSlot == -1 && downSlot == -1)
149 y += downSlot - wantedTop;
154 y -= wantedTop - upSlot;
157 if (wantedTop - upSlot > downSlot - wantedTop)
159 y += downSlot - wantedTop;
163 y -= wantedTop - upSlot;
void moveText(Text *text, int x, int y)
Move the text around the screen.
void place(const Text *textObj, const Text *omit, int &x, int &y, int h)
Position the text so as to avoid conflict.
void draw(gcn::Graphics *graphics, int xOff, int yOff)
Draw the text.
void removeText(const Text *text)
Remove the text from the manager.
std::list< Text * > mTextList
int mX
Actual x-value of left of text written.
int mY
Actual y-value of top of text written.
TextManager * textManager