com.artemis.BaseSystem Java Examples

The following examples show how to use com.artemis.BaseSystem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProfilerManager.java    From riiablo with Apache License 2.0 5 votes vote down vote up
public SystemProfiler getFor(BaseSystem system) {
  final SystemProfiler[] profilers = this.profilers.items;
  for (int i = 0, s = this.profilers.size; i < s; i++) {
    SystemProfiler profiler = profilers[i];
    if (profiler.system == system) {
      return profiler;
    }
  }
  return null;
}
 
Example #2
Source File: SystemProfiler.java    From riiablo with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(BaseSystem baseSystem, World world) {
  system = baseSystem;
  gpu = ClassUtils.hasAnnotation(baseSystem.getClass(), GpuSystem.class);
  if (name == null) {
    name = toString();
  }
  if (color == null) {
    calculateColor(toString().hashCode(), color = new Color());
  }
}
 
Example #3
Source File: ProfilerInvocationStrategy.java    From riiablo with Apache License 2.0 5 votes vote down vote up
private void processProfileSystems(Bag<BaseSystem> systems) {
  final Object[] systemsData = systems.getData();
  for (int i = 0, s = systems.size(); s > i; i++) {
    if (disabled.get(i))
      continue;

    updateEntityStates();
    processProfileSystem(profilers[i], (BaseSystem) systemsData[i]);
  }

  updateEntityStates();
}
 
Example #4
Source File: ProfilerInvocationStrategy.java    From riiablo with Apache License 2.0 5 votes vote down vote up
private void createSystemProfilers() {
  final ImmutableBag<BaseSystem> systems = world.getSystems();
  profilers = new SystemProfiler[systems.size()];
  for (int i = 0; i < systems.size(); i++) {
    profilers[i] = createSystemProfiler(systems.get(i));
  }
}
 
Example #5
Source File: ProfilerInvocationStrategy.java    From riiablo with Apache License 2.0 5 votes vote down vote up
private SystemProfiler createSystemProfiler(BaseSystem system) {
  SystemProfiler old = profilerManager.getFor(system);
  if (old == null) {
    old = profilerManager.createFor(system, world);
  }
  return old;
}
 
Example #6
Source File: ProfilerManager.java    From riiablo with Apache License 2.0 4 votes vote down vote up
public SystemProfiler createFor(BaseSystem system, World world) {
  return add(new SystemProfiler(system, world));
}
 
Example #7
Source File: ProfilerInvocationStrategy.java    From riiablo with Apache License 2.0 4 votes vote down vote up
private void processProfileSystem(SystemProfiler profiler, BaseSystem system) {
  if (profiler != null) profiler.start();
  system.process();
  if (profiler != null) profiler.stop();
}
 
Example #8
Source File: SystemProfiler.java    From riiablo with Apache License 2.0 2 votes vote down vote up
/**
 * Create profiler with default name and initialize it
 *
 * @param system to profiler
 * @param world  to init with
 */
SystemProfiler(BaseSystem system, World world) {
  this(null, system, world);
}
 
Example #9
Source File: SystemProfiler.java    From riiablo with Apache License 2.0 2 votes vote down vote up
/**
 * Create profiler with specified name and initialize it
 *
 * @param name   of the profiler
 * @param system to profiler
 * @param world  to init with
 */
SystemProfiler(String name, BaseSystem system, World world) {
  this.name = name;
  initialize(system, world);
}