Beispiel #1
0
	void	as_mcloader::advance(float delta_time)
	{
		if (m_lm.size() == 0)
		{
			get_root()->remove_listener(this);
			return;
		}

		for (int i = 0; i < m_lm.size();)
		{
			 gameswf::array<as_value> event_args;		// for event handler args
			event_args.push_back(m_lm[i].m_ch);

			int nframe = m_lm[i].m_def->get_loading_frame();
			if (nframe > 0 && m_lm[i].m_ch == NULL)
			{
				if (m_lm[i].m_target != NULL)
				{
					m_lm[i].m_ch = m_lm[i].m_target->replace_me(m_lm[i].m_def.get_ptr());
				}
				m_listeners.notify(event_id(event_id::ONLOAD_INIT, &event_args));
			}

			int loaded = m_lm[i].m_def->get_loaded_bytes();
			int total = m_lm[i].m_def->get_file_bytes();

			if (loaded < total)
			{
				event_args.push_back(loaded);
				event_args.push_back(total);
				m_listeners.notify(event_id(event_id::ONLOAD_PROGRESS, &event_args));
			}
			else
			{
				event_args.push_back(loaded);
				event_args.push_back(total);
				m_listeners.notify(event_id(event_id::ONLOAD_PROGRESS, &event_args));
				m_listeners.notify(event_id(event_id::ONLOAD_COMPLETE, &event_args));

				m_lm.remove(i);
				continue;
			}

			i++;

		}
	}
Beispiel #2
0
/************************************************************************
*									*
*  The user uses the keyboard to execute (instead of the mouse).	*
*									*/
static void
file_enter_proc(Panel_item, Event * e)
{
    if (event_id(e) == ESC_CHAR){
	//file_complete_name();  // Disabled for now (CMP)
    }else{
	/* This is <CR> */
	file_execute_proc();
    }
}
/*
 * Event callback function for `em_tp'.
 */
Notify_value
comment_text_proc(Xv_window win, Event *event, Notify_arg arg, Notify_event_type type)
{
	eventman_em_bw_objects *ip = (eventman_em_bw_objects *) xv_get(xv_get(win, XV_OWNER), XV_KEY_DATA, INSTANCE);
	
	fprintf(stderr, "eventman: comment_text_proc: event %d\n", event_id(event));
	
	/* gxv_start_connections DO NOT EDIT THIS SECTION */

	/* gxv_end_connections */

	return notify_next_event_func(win, (Notify_event) event, arg, type);
}
Beispiel #4
0
/*
 * Event callback function for `ref_mark_color_msg'.
 */
void
ref_color_proc(Panel_item item, Event *event)
{
	page_pu_page_pu_objects *ip = (page_pu_page_pu_objects *) xv_get(item, XV_KEY_DATA, INSTANCE);
	
	fprintf(stderr, "cidd_gui: ref_color_proc: event %d\n", event_id(event));
	
	/* gxv_start_connections DO NOT EDIT THIS SECTION */

	/* gxv_end_connections */

	panel_default_handle_event(item, event);
}
Beispiel #5
0
	void	as_key::set_key_down(int code)
	{
		if (code < 0 || code >= key::KEYCOUNT) return;

		m_last_key_pressed = code;

		int	byte_index = code >> 3;
		int	bit_index = code - (byte_index << 3);
		int	mask = 1 << bit_index;

		assert(byte_index >= 0 && byte_index < int(sizeof(m_keymap)/sizeof(m_keymap[0])));
		m_keymap[byte_index] |= mask;
		m_listeners.notify(event_id(event_id::KEY_DOWN));
	}
Beispiel #6
0
/*----------------------------------------------------------------------
            Parameters:

           Description:
----------------------------------------------------------------------*/
static void
event_handler(Event *event, DIMAGE *dimage)
{
#if 0
  int    x, y ;
  float  scale, dx, dy ;

  x = event_x(event) ;
  y = event_y(event) ;

  scale = dimage->scale ;
  if (event_id(event) == MS_MIDDLE)
  {
    if (event_is_down(event))
    {
      if (processed)
      {
        dx = *HIPSFpix(offsetImage, x, y) ;
        dy = *HIPSFseq_pix(offsetImage, x, y, 1) ;
        XVprintf(xvf, 0, "offset at (%d, %d) = (%2.3f, %2.3f)", x, y, dx, dy) ;
      }
      else
        dx = dy = 0.0f ;

      showOffsetArea(x,y, dx, dy) ;
      switch (filter_type)
      {
      case FILTER_EXPONENTIAL:
        calculateExponentialKernel(gradImage, x, y, filter_size,
                                   filter_parm, kernelImage, dx, dy) ;
        break ;
      case FILTER_EXP_LAPLACIAN:
        calculateExponentialKernel(laplacianImage, x, y, filter_size,
                                   filter_parm, kernelImage, dx, dy) ;
        break ;
      case FILTER_EXP_SUM:
        tmpImage = HipsAdd(laplacianImage, gradImage, tmpImage) ;
        calculateExponentialKernel(tmpImage, x, y, filter_size,
                                   filter_parm, kernelImage, dx, dy) ;
        break ;
      default:
        return ;
      }

      XVshowImage(xvf, FILTER_IMAGE, kernelImage, 0) ;
      XVshowImageTitle(xvf, FILTER_IMAGE, "filter at (%d, %d)    ", x, y) ;
    }
  }
#endif
}
/*
 * Event callback function for `status_pu'.
 */
Notify_value
status_pu_status_pu_event_callback(Xv_window win, Event *event, Notify_arg arg, Notify_event_type type)
{
	status_pu_status_pu_objects *ip = (status_pu_status_pu_objects *) xv_get(win, XV_KEY_DATA, INSTANCE);
	
	fprintf(stderr, "cidd_gui: status_pu_status_pu_event_callback: event %d\n", event_id(event));
	
	/* gxv_start_connections DO NOT EDIT THIS SECTION */

	if (event_action(event) == WIN_RESIZE)
	{
		status_resize_proc(win, event, arg, type);
	}
	
	/* gxv_end_connections */

	return notify_next_event_func(win, (Notify_event) event, arg, type);
}
Beispiel #8
0
	void	root::notify_key_event(player* player, key::code k, bool down)
	{
		// multithread plugins can call gameswf core therefore we should 
		// use gameswf mutex to lock gameswf engine
		gameswf_engine_mutex().lock();

		// First notify global Key object
		// listeners that uses the last keypressed code
		player->notify_key_object(k, down);

		// Notify keypress listeners.
		if (down)
		{
			m_keypress_listener.notify(event_id(event_id::KEY_PRESS, (key::code) k));
		}

		// A bit of a hack huh
		if( k == key::SHIFT )
		{
			m_shift_key_state = down;
		}

		if (((key::code)k == key::TAB) && down)
		{
			bool killfocus = false;
			int	 tab = 0;
			int  lastvalid = -1;

			// lets see if focus is in the root
			int i = 0;
			for (i = 0; get_character(i) != NULL; ++i)
			{
				character* movie = get_character(i);
				assert(movie);

				if (movie->is(AS_EDIT_TEXT) == false)
				{
					continue;
				}

				if (movie->can_handle_mouse_event() == false)
				{
					continue;
				}

				if (movie == m_current_active_entity.get_ptr())
				{
					if (lastvalid != -1 && m_shift_key_state)
					{
						movie->on_event(event_id::KILLFOCUS);
						get_character(lastvalid)->on_event(event_id::SETFOCUS);
						break;
					}
					//we only want to kill focus if there is another event below this one
					tab = i;

					//now i need to find which event to set focus on
					killfocus = true;
					continue;
				}

				lastvalid = i;

				if (killfocus)
				{
					get_character(tab)->on_event(event_id::KILLFOCUS);
					movie->on_event(event_id::SETFOCUS);
					killfocus = false;
					break;
				}
			}

			if (get_character(i) == NULL)
			{
				for (int i = 0; get_character(i) != NULL; ++i)
				{
					if (stricmp(get_character(i)->type_of(), "movieclip") != 0)
					{
						continue;
					}

					change_focus_character(get_character(i), m_current_active_entity.get_ptr(), m_shift_key_state);
				}
			}
		}

		gameswf_engine_mutex().unlock();
	}
Beispiel #9
0
		virtual bool	on_event(const event_id& id)
		{
			// Keep this & parent alive during execution!
			const gc_ptr<character> this_ptr(this);
			const gc_ptr<character> parent(get_parent());

			// 'this or 'parent' object is died
			if (parent == NULL || m_def == NULL)
			{
				return false;
			}

			as_object::on_event(id);

			const gc_ptr<button_character_definition> def(m_def);

			bool called = false;
			if (id.m_id == event_id::KEY_PRESS)
			{
				static const event_id s_key[32] =
				{
					event_id(),
					event_id(event_id::KEY_PRESS, key::LEFT),
					event_id(event_id::KEY_PRESS, key::RIGHT),
					event_id(event_id::KEY_PRESS, key::HOME),
					event_id(event_id::KEY_PRESS, key::END),
					event_id(event_id::KEY_PRESS, key::INSERT),
					event_id(event_id::KEY_PRESS, key::DELETEKEY),
					event_id(),
					event_id(event_id::KEY_PRESS, key::BACKSPACE),	//8
					event_id(),
					event_id(),
					event_id(),
					event_id(),
					event_id(event_id::KEY_PRESS, key::ENTER),	//13
					event_id(event_id::KEY_PRESS, key::UP),
					event_id(event_id::KEY_PRESS, key::DOWN),
					event_id(event_id::KEY_PRESS, key::PGUP),
					event_id(event_id::KEY_PRESS, key::PGDN),
					event_id(event_id::KEY_PRESS, key::TAB),
					// 32-126 folows ASCII*/
				};

				// Execute appropriate actions

				// actions can delete THIS through execute_frame_tags()
				for (int i = 0; i < def->m_button_actions.size(); i++)
				{
					int keycode = (def->m_button_actions[i].m_conditions & 0xFE00) >> 9;
					event_id key_event = keycode < 32 ? s_key[keycode] : event_id(event_id::KEY_PRESS, (key::code) keycode);
					if (key_event == id)
					{
						parent->do_actions(def->m_button_actions[i].m_actions);
						called = true;
					}
				}
			}
			else
			{
				// Set our mouse state (so we know how to render).
				switch (id.m_id)