示例#1
0
  Console_State::Console_State()
    : m_virtual_screen(Point2f(0.0f, 0.0f), Point2f(float(get_Window().get_width() * 600.0f / get_Window().get_height()), 600.0f)),
    m_projector(m_virtual_screen),
    m_bg(Vertex2f_Color(Point2f(0.0f, 0.0f), get_Colors()["console_border"]),
         Vertex2f_Color(Point2f(0.0f, 54.0f + 7.0f * get_Fonts()["system_36_x600"].get_text_height()), get_Colors()["console_border"]),
         Vertex2f_Color(Point2f(m_virtual_screen.second.x, 54.0f + 7.0f * get_Fonts()["system_36_x600"].get_text_height()), get_Colors()["console_border"]),
         Vertex2f_Color(Point2f(m_virtual_screen.second.x, 0.0f), get_Colors()["console_border"])),
    m_log(Point2f(18.0f, 18.0f),
          Point2f(m_virtual_screen.second.x - 18.0f,
                  18.0f + 6.0f * get_Fonts()["system_36_x600"].get_text_height()),
          "system_36_x600",
          "",
          get_Colors()["console_foreground"],
          false),
    m_prompt(Point2f(18.0f, 36.0f + 6.0f * get_Fonts()["system_36_x600"].get_text_height()),
             Point2f(m_virtual_screen.second.x - 18.0f,
                     36.0f + 7.0f * get_Fonts()["system_36_x600"].get_text_height()),
             "system_36_x600",
             "",
             get_Colors()["console_foreground"],
             true),
    m_log_dirty(false),
    m_child(0)
  {
    m_functions["args"] = new Console_Function;

    m_log.give_BG_Renderer(new Widget_Renderer_Color(get_Colors()["console_background"]));
    m_prompt.give_BG_Renderer(new Widget_Renderer_Color(get_Colors()["console_background"]));
  }
int main(){
	    // Handle Ctrl-C quit
    signal(SIGINT, sig_handler);

    // Edison i2c bus is 6
    mraa::I2c *i2c = new mraa::I2c(6);
    assert(i2c != NULL);
    init_TCS34725(i2c);

    while (running){
    	get_Colors(i2c);
    }
}