QTfrontend/net/hwmap.cpp
branchflibqtfrontend
changeset 8097 59a8feebec2c
parent 8094 6c5b4e69f03d
child 8304 620560c89284
equal deleted inserted replaced
8094:6c5b4e69f03d 8097:59a8feebec2c
    85     return arguments;
    85     return arguments;
    86 }
    86 }
    87 
    87 
    88 void HWMap::onSuccess(void *context, const uint8_t *bitmap, int numHedgehogs)
    88 void HWMap::onSuccess(void *context, const uint8_t *bitmap, int numHedgehogs)
    89 {
    89 {
    90     qDebug("HWMap::onSuccess");
       
    91     HWMap * hwMap = (HWMap *)context;
    90     HWMap * hwMap = (HWMap *)context;
    92 
    91 
    93     QImage im(bitmap, MAPIMAGE_WIDTH, MAPIMAGE_HEIGHT, QImage::Format_Mono);
    92     QImage im(bitmap, MAPIMAGE_WIDTH, MAPIMAGE_HEIGHT, QImage::Format_Mono);
    94     im.setNumColors(2);
    93     im.setNumColors(2);
    95     emit hwMap->HHLimitReceived(numHedgehogs);
    94     emit hwMap->HHLimitReceived(numHedgehogs);
    98     hwMap->clientDisconnected();
    97     hwMap->clientDisconnected();
    99 }
    98 }
   100 
    99 
   101 void HWMap::onFailure(void *context, const char *errormessage)
   100 void HWMap::onFailure(void *context, const char *errormessage)
   102 {
   101 {
   103     qDebug("HWMap::onFailure");
       
   104     HWMap * hwMap = (HWMap *)context;
   102     HWMap * hwMap = (HWMap *)context;
   105 
   103 
   106     hwMap->clientDisconnected();
   104     hwMap->clientDisconnected();
   107 }
   105 }
   108 
   106 
   109 void HWMap::onEngineStart()
   107 void HWMap::onEngineStart()
   110 {
   108 {
   111     qDebug("HWMap::onEngineStart");
       
   112     m_conn = flib_mapconn_create(m_map);
   109     m_conn = flib_mapconn_create(m_map);
   113     flib_mapconn_onSuccess(m_conn, onSuccess, this);
   110     flib_mapconn_onSuccess(m_conn, onSuccess, this);
   114     flib_mapconn_onFailure(m_conn, onFailure, this);
   111     flib_mapconn_onFailure(m_conn, onFailure, this);
   115 
   112 
   116     new FrontLibPoller((void (*)(void *))flib_mapconn_tick, m_conn, this);
   113     new FrontLibPoller((void (*)(void *))flib_mapconn_tick, m_conn, this);