#include <iconv.h>
#include <unistd.h>
#include <pqxx/pqxx>
-#include <tinyptc.h>
+#include <SDL.h>
+
#include "flagtrigger.h"
#include "widestring.h"
#include "fetch_current_tournament.h"
#include "splitscreen.h"
#include "rotatescreen.h"
+SDL_Surface *screen = NULL;
+
Tournament active_tournament;
std::vector<SkeletonGroup> active_groups;
std::vector<GenericScreen *> screens;
if (mainscreen && mainscreen->check_invalidated()) {
mainscreen->draw(framebuf, SCREEN_WIDTH, SCREEN_HEIGHT);
- ptc_update(framebuf);
+ SDL_LockSurface(screen);
+ for (unsigned y = 0; y < SCREEN_HEIGHT; ++y) {
+ unsigned char *sptr = framebuf + y * SCREEN_WIDTH * 4;
+ unsigned char *dptr = (unsigned char *)screen->pixels + y * screen->pitch;
+ memcpy(dptr, sptr, SCREEN_WIDTH * 4);
+ }
+ SDL_UnlockSurface(screen);
+ SDL_Flip(screen);
conn.await_notification(0, 10000);
} else {
- ptc_update(framebuf);
+ SDL_Flip(screen);
conn.await_notification(0, 200000);
}
}
int main(int argc, char **argv)
{
- ptc_open("CCBS bigscreen", SCREEN_WIDTH, SCREEN_HEIGHT);
+ SDL_Init(SDL_INIT_VIDEO);
+#if USE_FULLSCREEN
+ screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32, SDL_DOUBLEBUF | SDL_FULLSCREEN);
+ SDL_ShowCursor(SDL_DISABLE);
+#else
+ screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32, SDL_DOUBLEBUF);
+#endif
+ if (screen == NULL) {
+ fprintf(stderr, "Video initialization failed: %s\n", SDL_GetError());
+ exit(1);
+ }
try {
init_freetype();
std::fprintf(stderr, "Exception: %s\n", e.what());
exit(1);
}
+
+ SDL_Quit();
return 0;
}