void InteractiveGrid::update() {

    if (NULL == tracker) {
      RX_ERROR("Tracker is invalid.");
      return;
    }
    if (NULL == on_activate) {
      RX_ERROR("No on_activate set so no use to execute the update function.");
      return;
    }

    uint64_t now = rx_hrtime();
    float iv_w = 1.0f / mos::config.webcam_width;
    float iv_h = 1.0f / mos::config.webcam_height;

    /* get the detected blobs. */
    for (size_t i = 0; i < tracker->blobs.blobs.size(); ++i) {

      Blob& blob = tracker->blobs.blobs[i];

#if 0
      if (false == blob.matched) {
        continue;
      }
      
      if (15 > blob.trail.size()) {
        continue;
      }
#endif
      
      /* convert the position of the blob to a cell index. */
      cv::Point& pt = blob.position;
      float px = float(pt.x) * iv_w;
      float py = float(pt.y) * iv_h;
      
      int col = px * fex::config.cols;
      int row = py * fex::config.rows;
      int dx = row * fex::config.cols + col;

      if (dx >= cells.size()) {
        RX_ERROR("Not supposed to happen, but the calculated index is bigger then the total number of cells, col: %d, row: %d, dx: %d", col, row, dx);
        continue;
      }

      InteractiveCell& cell = cells[dx];
      if (0 == cell.timeout || (0 != cell.timeout && now > cell.timeout)) {
        /* new cell, make active. */
        //RX_VERBOSE("Activated: %d x %d, timeout: %llu", col, row, cell.timeout);
        on_activate(col, row, user);
        cell.timeout = now + 1e9; /* this cell can be reused after X seconds (Xe9) */
      }
    }
  }
Beispiel #2
0
static void
on_open(GApplication *gapp, GFile **files, int n_files, char *hint)
{
	GError *error = NULL;

	if(n_files == 2) {
		char *graphics_file_path = g_file_get_path(files[1]);
		g_object_set(glk, "graphics-file", graphics_file_path, NULL);
		g_free(graphics_file_path);
	}
	if(n_files >= 1) {
		if( !chimara_if_run_game_file(CHIMARA_IF(glk), files[0], &error) ) {
			error_dialog(GTK_WINDOW(window), error, "Error starting Glk library: ");
			g_application_quit(gapp);
		}
	}
	on_activate(gapp);
}
Beispiel #3
0
LRESULT TopWindow::on_message(HWND _hWnd, UINT message,
			       WPARAM wParam, LPARAM lParam) {
  switch (message) {
  case WM_ACTIVATE:
#ifdef HAVE_ACTIVATE_INFO
    SHHandleWMActivate(_hWnd, wParam, lParam, &s_sai, FALSE);
#endif

    if (wParam == WA_INACTIVE ? on_deactivate() : on_activate())
      return true;
    break;

  case WM_SETTINGCHANGE:
#ifdef HAVE_ACTIVATE_INFO
    SHHandleWMSettingChange(_hWnd, wParam, lParam, &s_sai);
#endif
    break;
  };
  return ContainerWindow::on_message(_hWnd, message, wParam, lParam);
}
Beispiel #4
0
    void ModeBase::activate()
    {
        canvas()->clear_tool_info();
        is_active_ = true;

        std::uint32_t tool_flags = enabled_tools();

        auto conditional_enable = [=](EditorTool tool)
        {
            if ((tool_flags & tool) != 0) canvas()->tool_enabled(tool);
            else canvas()->tool_disabled(tool);
        };

        conditional_enable(EditorTool::Placement);
        conditional_enable(EditorTool::Movement);
        conditional_enable(EditorTool::Rotation);
        conditional_enable(EditorTool::TileSelection);
        conditional_enable(EditorTool::AreaSelection);
        conditional_enable(EditorTool::Resize);

        on_activate();
    }
Beispiel #5
0
static intptr_t CALLBACK
chatlist_proc(HWND window, uint32_t msg, uintptr_t w_param, intptr_t l_param)
{
	switch (msg) {

	case WM_CREATE:
		on_create(window);
		return 0;

	case WM_SIZE:
		on_size(window, LOWORD(l_param), HIWORD(l_param));
		return 0;

	case WM_NOTIFY: {
		NMHDR *note;

		note = (NMHDR *)l_param;

		if (note->idFrom != DLG_LIST)
			break;

		if (note->code == LVN_ITEMACTIVATE) {
			on_activate((NMITEMACTIVATE *)l_param);
			return 0;
		}
		if (note->code == NM_RCLICK) {
			on_right_click((NMITEMACTIVATE *)l_param);
			return 1;
		}
	}

	default:
		break;
	}

	return DefWindowProc(window, msg, w_param, l_param);
}
Beispiel #6
0
 void activate() { on_activate(); }
Beispiel #7
0
void CEnergyHolder::activate()
{
	if (!is_active()) on_activate();		
	m_active = true;
}	
void GotoReferenceDialog::on_activate_verse()
{
  on_activate();
}
Beispiel #9
0
void Gobby::TabLabel::on_folder_document_changed(SessionView* view)
{
	if(view == &m_view)
		on_activate();
}
Beispiel #10
0
void ScriptComponent::activate()
{
  processors().script.register_script(this);
  on_activate();
}