Пример #1
0
int main() {

  test_colors();
  test_dynamic_array();
  test_vectors();
  test_physics();

  int pixels[] = {0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff,
		  0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff,
		  0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff,
		  0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff,
		  0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff,
		  0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff};
  
  color pixels2[10000];
  for (int i = 0; i < 10000; i++) pixels2[i] = 0xE650E1FF;

  int window_width = 800;
  int window_height = 600;
  
  init_graphics();

  renderer_handle rend = create_window(window_width, window_height, "TEST", 0);
  texture_handle tex = load_texture_data(rend, pixels, 6, 6);
  texture_handle tex2 = load_texture_data(rend, pixels2, 100, 100);
  set_clear_color(rend, get_color(0,0,0,0xFF));

  while (SDL_GetTicks() < 10000) {
    clear(rend);
    double theta = (double) SDL_GetTicks() / 300;
    double r = 200 * cos(3*theta/5);

    int x1 = r*cos(theta) - 3 + window_width/2;
    int y1 = r*sin(theta) - 3 + window_height/2;
    int x2 = r*cos(theta + 2*PI/3) - 3 + window_width/2;
    int y2 = r*sin(theta + 2*PI/3) - 3 + window_height/2;
    int x3 = r*cos(theta - 2*PI/3) - 3 + window_width/2;
    int y3 = r*sin(theta - 2*PI/3) - 3 + window_height/2;

    double scale = .75 - .25 * cos(6*theta/5);
    int s = 100 * scale;

    draw(rend, tex2, (window_width - s) / 2, (window_height - s) / 2, -theta, s/2, s/2, 0, 0, scale);
    draw(rend, tex, x1, y1, 0, 0, 0, 0, 0, 1);
    draw(rend, tex, x2, y2, 0, 0, 0, 0, 0, 1);
    draw(rend, tex, x3, y3, 0, 0, 0, 0, 0, 1);
    show(rend);
    SDL_Delay(16);
  }

  destroy_window(rend);
  cleanup();
  
  return 0;
}
Пример #2
0
int main(int argc, char **argv) {
	printf("Starting mpass...\n");

//	test_queue_seq();
//	test_queue_busy_wait();
//	test_queue_pthread_wait();

    test_dynamic_array();

//for the first process do not send an arg and for the second do
    test_shm(argc);
	
	printf("Ending mpass...\n");
	return 0;
}