summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README6
-rw-r--r--bitmap.c99
-rw-r--r--bitmap.h12
-rw-r--r--deck.c9
-rw-r--r--game.c19
-rw-r--r--game.h11
6 files changed, 13 insertions, 143 deletions
diff --git a/README b/README
index 8093da5..9428557 100644
--- a/README
+++ b/README
@@ -9,6 +9,12 @@ Latest version available at: http://toms-cafe.de/vdr/spider
See the file COPYING for license information.
+Requirements:
+-------------
+
+- VDR >= 1.3.47
+
+
Description:
------------
diff --git a/bitmap.c b/bitmap.c
index ecb5846..425c6ae 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: bitmap.c 2 2005-05-14 22:25:56Z tom $
+ * $Id: bitmap.c 22 2006-04-24 23:26:30Z tom $
*/
#include "bitmap.h"
@@ -12,13 +12,6 @@
#include <vdr/osd.h>
#include <ctype.h>
-// Compatibility to older vdr versions
-#if VDRVERSNUM < 10307
- #define tColor eDvbColor
- #define DrawRectangle Fill
- #define DrawPixel SetPixel
-#endif
-
/** --- class Bitmap ------------------------------------------------------- **/
@@ -62,31 +55,6 @@ void Bitmap::text(const char* text, bool centered)
{
DrawRectangle(0, 0, Width() - 1, Height() - 1, clrWhite);
frame(0, 0, Width() - 1, Height() - 1, clrRed);
-
-#if VDRVERSNUM < 10307
- SetFont(fontOsd);
- int lineCount;
- char* wrapper = textWrapper(text, &lineCount);
- int y = max((Height() - lineCount * cOsd::LineHeight()) / 2, 0);
- char* line = wrapper;
- while (*line)
- {
- char* newline = strchr(line, '\n');
- if (newline)
- *newline = 0;
- int x = 0;
- if (centered)
- x = max((Width() - Width(line)) / 2, 0);
- Text(x, y, line, clrBlack, clrWhite);
- if (newline)
- *newline = '\n';
- if (!newline)
- break;
- line = newline + 1;
- y += cOsd::LineHeight();
- }
- free(wrapper);
-#else
const cFont* font = cFont::GetFont(fontOsd);
cTextWrapper wrapper(text, font, Width());
int y = max((Height() - wrapper.Lines() * font->Height()) / 2, 0);
@@ -97,7 +65,6 @@ void Bitmap::text(const char* text, bool centered)
x = max((Width() - font->Width(wrapper.GetLine(l))) / 2, 0);
DrawText(x, y, wrapper.GetLine(l), clrBlack, clrWhite, font);
}
-#endif
}
/** Draw a frame into the bitmap */
@@ -173,11 +140,7 @@ bool Bitmap::loadXpm(const char* FileName, tColor NoneColor)
ptr += 2;
if (*ptr == '#') {
int col = strtoul(++ptr, NULL, 16);
-#if VDRVERSNUM < 10307
- pal[temp] = 0xff000000 | ((col & 0xff) << 16) | (col & 0xff00) | ((col & 0xff0000) >> 16);
-#else
pal[temp] = 0xff000000 | col;
-#endif
}
else {
pal[temp] = NoneColor;
@@ -211,63 +174,3 @@ bool Bitmap::loadXpm(const char* FileName, tColor NoneColor)
}
return bRet;
}
-
-#if VDRVERSNUM < 10307
-/** Wrap the text to fit into the bitmap - taken from font.c in VDR 1.3.7 */
-char *Bitmap::textWrapper(const char *Text, int *p_lines)
-{
- char *text = strdup(Text);
- int lines = 1;
-
- char *Blank = NULL;
- char *Delim = NULL;
- int w = 0;
-
- stripspace(text); // strips trailing newlines
-
- for (char *p = text; *p; ) {
- if (*p == '\n') {
- lines++;
- w = 0;
- Blank = Delim = NULL;
- p++;
- continue;
- }
- else if (isspace(*p))
- Blank = p;
- int cw = Width(*p);
- if (w + cw > Width()) {
- if (Blank) {
- *Blank = '\n';
- p = Blank;
- continue;
- }
- else {
- // Here's the ugly part, where we don't have any whitespace to
- // punch in a newline, so we need to make room for it:
- if (Delim)
- p = Delim + 1; // let's fall back to the most recent delimiter
- char *s = MALLOC(char, strlen(text) + 2); // The additional '\n' plus the terminating '\0'
- int l = p - text;
- strncpy(s, text, l);
- s[l] = '\n';
- strcpy(s + l + 1, p);
- free(text);
- text = s;
- p = text + l;
- continue;
- }
- }
- else
- w += cw;
- if (strchr("-.,:;!?_", *p)) {
- Delim = p;
- Blank = NULL;
- }
- p++;
- }
- if (p_lines != NULL)
- *p_lines = lines;
- return text;
-}
-#endif
diff --git a/bitmap.h b/bitmap.h
index fd98732..387baaa 100644
--- a/bitmap.h
+++ b/bitmap.h
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: bitmap.h 5 2005-05-15 18:40:40Z tom $
+ * $Id: bitmap.h 22 2006-04-24 23:26:30Z tom $
*/
#ifndef VDR_SPIDER_BITMAP_H
@@ -14,11 +14,6 @@
#include <vdr/osdbase.h>
#include <vdr/osd.h>
-// Compatibility to older vdr versions
-#if VDRVERSNUM < 10307
- #define tColor eDvbColor
-#endif
-
/** --- class Bitmap ------------------------------------------------------- **/
@@ -47,11 +42,6 @@ public:
/** Load a bitmap from an xpm file - taken from ElchiAIO4d patch */
bool loadXpm(const char* FileName, tColor NoneColor = clrTransparent);
-
-#if VDRVERSNUM < 10307
- /** Wrap the text to fit into the bitmap - taken from font.c in VDR 1.3.7 */
- char *textWrapper(const char *Text, int *p_lines);
-#endif
};
#endif // VDR_SPIDER_BITMAP_H
diff --git a/deck.c b/deck.c
index 5945211..c4b2d92 100644
--- a/deck.c
+++ b/deck.c
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: deck.c 2 2005-05-14 22:25:56Z tom $
+ * $Id: deck.c 22 2006-04-24 23:26:30Z tom $
*/
#include "deck.h"
@@ -15,12 +15,7 @@
/** Random number 0 .. max-1 */
unsigned int rand(unsigned int max)
{
- static unsigned int seed =
-#if VDRVERSNUM >= 10318
- cTimeMs::Now();
-#else
- time_ms();
-#endif
+ static unsigned int seed = cTimeMs::Now();
return (unsigned int)((double)max * rand_r(&seed) / (RAND_MAX + 1.0));
}
diff --git a/game.c b/game.c
index c23ef70..3e59ea5 100644
--- a/game.c
+++ b/game.c
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: game.c 7 2005-05-16 14:11:51Z tom $
+ * $Id: game.c 22 2006-04-24 23:26:30Z tom $
*/
#include "game.h"
@@ -17,23 +17,6 @@
#include <vdr/osdbase.h>
#include <vdr/osd.h>
-// Compatibility to older vdr versions
-#if VDRVERSNUM < 10307
- #define tColor eDvbColor
- #define DrawRectangle Fill
- #define DrawBitmap SetBitmap
- #define cOsdProvider cOsd
- #define NewOsd OpenRaw
- struct tArea { int x1, y1, x2, y2, bpp; };
- #define SetAreas(a,n) Create(a->x1, a->y1,\
- a->x2 - a->x1 + 1, a->y2 - a->y1 + 1,\
- a->bpp, true)
- #define clrGray50 clrBackground
- #define Color GetColor
- #define savePalette(bitmap) savePalette(2)
- #define SetPalette(palette, area) Width('X')
-#endif
-
// Defintions for bitmaps
const int cursorWidth = 16;
diff --git a/game.h b/game.h
index 86f516a..3099478 100644
--- a/game.h
+++ b/game.h
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: game.h 5 2005-05-15 18:40:40Z tom $
+ * $Id: game.h 22 2006-04-24 23:26:30Z tom $
*/
#ifndef VDR_SPIDER_GAME_H
@@ -19,13 +19,6 @@ class Bitmap;
#include <vdr/osdbase.h>
#include <vdr/osd.h>
-// Compatibility to older vdr versions
-#if VDRVERSNUM < 10307
- #define cOsd_ cOsdBase
-#else
- #define cOsd_ cOsd
-#endif
-
/** --- class SpiderGame --------------------------------------------------- **/
@@ -37,7 +30,7 @@ private:
int width, height;
int xPos, yPos;
int xDist, yDist;
- cOsd_* osd;
+ cOsd* osd;
Bitmap* info;
const char* infoText;
Deck* deck;