X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/4bc08995411e21f3564f09e136809be68ddf96a8..1b2f75903244b6c03e1f123533d4385c0c271c78:/main/enigma.cpp diff --git a/main/enigma.cpp b/main/enigma.cpp index 60bea8f5..3a728b8d 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -1,3 +1,8 @@ +#undef WITH_SDL +#ifdef WITH_SDL +#error +#define SDLDC +#endif #include #include #include @@ -9,6 +14,10 @@ #include #include +#ifdef WITH_SDL +#error +#include +#endif #include #include @@ -25,6 +34,10 @@ #include +#include + +#include + #ifdef OBJECT_DEBUG int object_total_remaining; @@ -71,74 +84,47 @@ PSignal1 &keyPressedSignal() void keyEvent(const eRCKey &key) { - if (!key.flags) - keyPressed(key.code); + ePtr ptr; + eActionMap::getInstance(ptr); + ptr->keyPressed(0, key.code, key.flags); +// if (!key.flags) +// keyPressed(key.code); } /************************************************/ +#include +#include +#include #include #include -#include -#include -#include -#include -#include +#include +#include class eMain: public eApplication, public Object { eInit init; - ePtr m_scan; - ePtr m_mgr; - ePtr m_channel; ePtr m_dvbdb; + ePtr m_locale_time_handler; + ePtr m_scan; + ePtr m_epgcache; - void scanEvent(int evt) - { - eDebug("scan event %d!", evt); - if (evt == eDVBScan::evtFinish) - { - m_scan->insertInto(m_dvbdb); - quit(0); - } - } - ePtr m_scan_event_connection; public: eMain() { init.setRunlevel(eAutoInitNumbers::main); -#if 0 + /* TODO: put into init */ m_dvbdb = new eDVBDB(); m_mgr = new eDVBResourceManager(); - - eDVBFrontendParametersSatellite fesat; + m_locale_time_handler = new eDVBLocalTimeHandler(); + m_epgcache = new eEPGCache(); + m_mgr->setChannelList(m_dvbdb); - fesat.frequency = 11817000; // 12070000; - fesat.symbol_rate = 27500000; - fesat.polarisation = eDVBFrontendParametersSatellite::Polarisation::Vertical; - fesat.fec = eDVBFrontendParametersSatellite::FEC::f3_4; - fesat.inversion = eDVBFrontendParametersSatellite::Inversion::Off; - fesat.orbital_position = 192; - - eDVBFrontendParameters *fe = new eDVBFrontendParameters(); - - fe->setDVBS(fesat); - - if (m_mgr->allocateRawChannel(m_channel)) - eDebug("shit it failed!"); +// m_scan = new eComponentScan(); +// m_scan->start(); - eDebug("starting scan..."); - - std::list > list; - - list.push_back(fe); - - m_scan = new eDVBScan(m_channel); - m_scan->start(list); - m_scan->connectEvent(slot(*this, &eMain::scanEvent), m_scan_event_connection); -#endif } ~eMain() @@ -161,34 +147,32 @@ int main(int argc, char **argv) eMain main; #if 1 +#ifdef SDLDC + ePtr my_dc; + gSDLDC::getInstance(my_dc); +#else ePtr my_dc; gFBDC::getInstance(my_dc); +#endif - gPainter p(my_dc); - - gRGB pal[256]; - pal[0] = 0; - pal[1] = 0xff00ff; - pal[2] = 0xffFFff; - pal[3] = 0x00ff00; - - for (int a=0; a<0x10; ++a) - pal[a | 0x10] = 0x111111 * a; - for (int a=0; a<0x10; ++a) - pal[a | 0x20] = (0x111100 * a) | 0xFF; - for (int a=0; a<0x10; ++a) - pal[a | 0x30] = (0x110011 * a) | 0xFF00; - for (int a=0; a<0x10; ++a) - pal[a | 0x40] = (0x001111 * a) | 0xFF0000; - p.setPalette(pal, 0, 256); - - fontRenderClass::getInstance()->AddFont("/dbox2/cdkroot/share/fonts/arial.ttf", "Arial", 100); + fontRenderClass::getInstance()->AddFont(FONTDIR "/arial.ttf", "Arial", 100); eWidgetDesktop dsk(eSize(720, 576)); wdsk = &dsk; - dsk.setBackgroundColor(gColor(0)); + + dsk.setDC(my_dc); + + ePtr m_pm; + loadPNG(m_pm, "data/pal.png"); + if (!m_pm) + { + eFatal("hi ghost, please copy pal.png into your ./data, thanks!"); + } else + dsk.setPalette(*m_pm); + + dsk.setBackgroundColor(gRGB(0,0,0,0xFF)); #endif /* redrawing is done in an idle-timer, so we have to set the context */ @@ -197,6 +181,7 @@ int main(int argc, char **argv) eRCInput::getInstance()->keyEvent.connect(slot(keyEvent)); printf("executing main\n"); + python.execute("mytest", "__main__"); // eApp->exec(); @@ -213,3 +198,8 @@ void runMainloop() { eApp->exec(); } + +void quitMainloop() +{ + eApp->quit(0); +}