Changeset 1660


Ignore:
Timestamp:
Jul 21, 2012, 12:22:10 AM (11 years ago)
Author:
sam
Message:

neercs: add a way to activate the old neercs code for testing purposes.

Location:
trunk/tools/neercs
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/neercs/neercs.cpp

    r1658 r1660  
    4040#include "video/render.h"
    4141
     42#define USE_OLD_NEERCS 0
     43
    4244extern "C"
    4345{
     
    5254{
    5355    Ticker::Ref(m_render);
     56
     57#if USE_OLD_NEERCS
     58    m_buf = NULL;
     59    m_screen_list = init_neercs(argc, argv);
     60    if (!m_screen_list)
     61        exit(-1);
     62    m_screen_list->last_key_time = get_us();
     63#endif
    5464}
    5565
    5666int Neercs::hex_color(float r, float g, float b)
    5767{
    58 return ((int)(r * 15.99f) << 8) | ((int)(g * 15.99f) << 4) | (int)(b * 15.99f);
     68    return ((int)(r * 15.99f) << 8) | ((int)(g * 15.99f) << 4) | (int)(b * 15.99f);
    5969}
    6070
     
    6272{
    6373    WorldEntity::TickGame(seconds);
     74
     75#if USE_OLD_NEERCS
     76    mainloop_tick(&m_buf, m_screen_list);
     77#endif
    6478
    6579    m_time += seconds;
     
    129143Neercs::~Neercs()
    130144{
     145#if USE_OLD_NEERCS
     146    free(m_buf);
     147    free_screen_list(m_screen_list);
     148#endif
     149
    131150    Ticker::Unref(m_render);
    132151}
  • trunk/tools/neercs/neercs.h

    r1642 r1660  
    1111
    1212#include "video/render.h"
     13
     14extern "C"
     15{
     16#include "old/neercs.h"
     17}
    1318
    1419class Neercs : public WorldEntity
     
    3136    Render *m_render;
    3237    float m_time;
     38
     39    /* Old neercs stuff */
     40    char *m_buf;
     41    struct screen_list *m_screen_list;
    3342};
    3443
  • trunk/tools/neercs/old/attach.c

    r1656 r1660  
    239239                    break;
    240240                case ECONNREFUSED:
    241                     fprintf(stderr, "%s is dead\n", sockets[i]);
     241                    fprintf(stderr, "%s is dead, removing\n", sockets[i]);
     242                    unlink(sockets[i]);
    242243                    break;
    243244                default:
  • trunk/tools/neercs/old/client.c

    r1656 r1660  
    160160 *  - wait for an input event with a 10ms timeout
    161161 */
    162 void mainloop(struct screen_list *screen_list)
    163 {
    164     char *buf = NULL;
    165     screen_list->last_key_time = get_us();
    166 
    167     while (mainloop_tick(&buf, screen_list))
    168         ;
    169 
    170     free(buf);
    171 }
    172 
    173162int mainloop_tick(char **pbuf, struct screen_list *screen_list)
    174163{
     
    190179                 NEERCS_RECV_BUFSIZE - 1)) > 0)
    191180    {
    192         *pbuf[n] = 0;
     181        (*pbuf)[n] = 0;
    193182        debug("Received from server: '%s' (%d bytes)", *pbuf, n);
    194183        if (!strncmp("DETACH", *pbuf, 6))
  • trunk/tools/neercs/old/main.c

    r1656 r1660  
    8282}
    8383
    84 #if 0
    85 int main(int argc, char **argv)
    86 {
    87     struct screen_list *screen_list = init_neercs(argc, argv);
    88     if (!screen_list)
    89         return -1;
    90 
    91     mainloop(screen_list);
    92 }
    93 #endif
    94 
    9584struct screen_list *init_neercs(int argc, char **argv)
    9685{
Note: See TracChangeset for help on using the changeset viewer.