static void
test_pipeline (CoglPipeline *pipeline,
               int x_offset,
               int y_offset,
               const uint8_t expected_colors[9])
{
  float x1 = x_offset;
  float y1 = y_offset;
  float x2 = x1 + DRAW_SIZE;
  float y2 = y1 + DRAW_SIZE;
  int y, x;

  cogl_framebuffer_draw_textured_rectangle (test_fb,
                                            pipeline,
                                            x1, y1,
                                            x2, y2,
                                            -0.5f, /* s1 */
                                            -0.5f, /* t1 */
                                            1.5f, /* s2 */
                                            1.5f /* t2 */);

  check_colors (x_offset, y_offset, expected_colors);

  /* Also try drawing each quadrant of the rectangle with a small
   * rectangle */

  for (y = -1; y < 3; y++)
    for (x = -1; x < 3; x++)
      {
        x1 = x_offset + (x + 1) * DRAW_SIZE / 4 + DRAW_SIZE;
        y1 = y_offset + (y + 1) * DRAW_SIZE / 4;
        x2 = x1 + DRAW_SIZE / 4;
        y2 = y1 + DRAW_SIZE / 4;

        cogl_framebuffer_draw_textured_rectangle (test_fb,
                                                  pipeline,
                                                  x1, y1,
                                                  x2, y2,
                                                  x / 2.0f, /* s1 */
                                                  y / 2.0f, /* t1 */
                                                  (x + 1) / 2.0f, /* s2 */
                                                  (y + 1) / 2.0f /* t2 */);
      }

  check_colors (x_offset + DRAW_SIZE, y_offset, expected_colors);
}
Beispiel #2
0
// coloring constraints for the whole tree
static bool tree_is_well_colored(rba_buffer_t *b) {
  uint32_t x;

  x = b->root;
  if (is_red(b, x)) {
    printf("bad coloring: the root %"PRIu32" is read\n", x);
    fflush(stdout);
    return false;
  }

  return check_colors(b, x);
}
Beispiel #3
0
// check color constraints for the subtree rooted at x
static bool check_colors(rba_buffer_t *b, uint32_t x) {
  bool good;
  uint32_t i, j;

  if (x == 0) {
    good = is_black(b, x);
    if (!good) {
      printf("error: null node is not black\n");
      fflush(stdout);
    }
    return good;
  }

  i = b->child[x][0];
  j = b->child[x][1];
  if (is_red(b, x) && (is_red(b, i) || is_red(b, j))) {
    printf("bad coloring at red node %"PRIu32": its two children should be black\n", x);
    fflush(stdout);

    return false;
  }

  return check_colors(b, i) && check_colors(b, j);
}
Beispiel #4
0
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR, int nCmdShow)
{
	MSG msg;
	WNDCLASS wndclass,wndclass2;
	short seed;

	if (!hPrevInstance) {
		wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW;
		wndclass.lpfnWndProc = WndProc;
		wndclass.cbClsExtra = 0;
		wndclass.cbWndExtra = 0;
		wndclass.hInstance = hInstance;
		wndclass.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10));
		wndclass.hCursor = NULL;
		wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
		wndclass.lpszMenuName = MAKEINTRESOURCE(1);
		wndclass.lpszClassName = szAppName;

		RegisterClass(&wndclass);

		wndclass2.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW;
		wndclass2.lpfnWndProc = WndProc;
		wndclass2.cbClsExtra = 0;
		wndclass2.cbWndExtra = 0;
		wndclass2.hInstance = hInstance;
		wndclass2.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10));
		wndclass2.hCursor = NULL;
		wndclass2.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
		wndclass2.lpszMenuName = NULL;
		wndclass2.lpszClassName = szWinName;

		RegisterClass(&wndclass2);
		}

		mainPtr = CreateWindow (szAppName,
			"Classic Blades of Exile Character Editor",
			WS_OVERLAPPEDWINDOW,
			0,
			0,
			536,
			478,
			NULL,
			NULL,
			hInstance,
			NULL);

	if (!hPrevInstance) { // initialize
		Get_Path(file_path_name); //store the path to the executable
  		store_hInstance = hInstance;
		accel = LoadAccelerators(hInstance, MAKEINTRESOURCE(1));

        get_reg_data();

		load_cursors();
		seed = (short) GetCurrentTime();
		srand(seed);

		max_window(mainPtr);
		Set_up_win ();

		font = CreateFont(-9,0,0,0,0, 0,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		small_bold_font = CreateFont(12,0,0,0,700, 0,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		italic_font = CreateFont(12,0,0,0,0, 1,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		underline_font = CreateFont(12,0,0,0,0, 0,1,0, 0,0,
			0,0,0,"MS Sans Serif");
		bold_font = CreateFont(14,0,0,0,700, 0,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		tiny_font = font;
		load_sounds();

		ShowWindow(mainPtr,nCmdShow);

		init_main_buttons();

		file_initialize();
		check_colors();
		cursor_stay();
		update_item_menu(1);

		cd_init_dialogs();

		FCD(900,0);
		}

		event_handled = FALSE;
		while(GetMessage(&msg,NULL,0,0)) {
			if (event_handled == FALSE) {
				if (!TranslateAccelerator(mainPtr, accel, &msg)) {
					TranslateMessage(&msg);
					DispatchMessage(&msg);
					}
				}
			}
		return msg.wParam;
}
Beispiel #5
0
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR, int nCmdShow)
{

	MSG msg;
	WNDCLASS wndclass,wndclass2;
	short seed;

	if (!hPrevInstance) {
		wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW;
		wndclass.lpfnWndProc = WndProc;
		wndclass.cbClsExtra = 0;
		wndclass.cbWndExtra = 0;
		wndclass.hInstance = hInstance;
		wndclass.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10));
		wndclass.hCursor = NULL;
		wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
		wndclass.lpszMenuName = MAKEINTRESOURCE(1);
		wndclass.lpszClassName = szAppName;

		RegisterClass(&wndclass);

		wndclass2.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW;
		wndclass2.lpfnWndProc = WndProc;
		wndclass2.cbClsExtra = 0;
		wndclass2.cbWndExtra = 0;
		wndclass2.hInstance = hInstance;
		wndclass2.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(10));
		wndclass2.hCursor = NULL;
		wndclass2.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
		wndclass2.lpszMenuName = NULL;
		wndclass2.lpszClassName = szWinName;

		RegisterClass(&wndclass2);
		}

		mainPtr = CreateWindow (szAppName,
			"Classic Blades of Exile Scenario Editor",
			WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
			0,
			0,
			536,
			478,
			NULL,
			NULL,
			hInstance,
			NULL);


	if (!hPrevInstance) { // initialize
		//center_window(mainPtr);
 		Get_Path(file_path_name);
		store_hInstance = hInstance;
		accel = LoadAccelerators(hInstance, MAKEINTRESOURCE(1));
		loadSettingsFromFile();

		seed = (short) GetCurrentTime();
		srand(seed);

		data_store = new piles_of_stuff_dumping_type;

		max_window(mainPtr);
		GetWindowRect(mainPtr,&windRect);
		SetTimer(mainPtr,1,20,NULL);

		ShowWindow(mainPtr,nCmdShow);
		Set_up_win ();
		init_lb();
		init_rb();
		init_town(1);
		init_out();

		init_scenario();

		font = CreateFont(12,0,0,0,0, 0,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		small_bold_font = CreateFont(12,0,0,0,700, 0,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		italic_font = CreateFont(12,0,0,0,0, 1,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		underline_font = CreateFont(12,0,0,0,0, 0,1,0, 0,0,
			0,0,0,"MS Sans Serif");
		bold_font = CreateFont(14,0,0,0,700, 0,0,0, 0,0,
			0,0,0,"MS Sans Serif");
		tiny_font = font;
		load_sounds();

		right_sbar_rect.top = RIGHT_AREA_UL_Y;
		right_sbar_rect.left = RIGHT_AREA_UL_X + RIGHT_AREA_WIDTH - 16 ;
		right_sbar_rect.bottom = RIGHT_AREA_UL_Y + RIGHT_AREA_HEIGHT;
		right_sbar_rect.right = RIGHT_AREA_UL_X + RIGHT_AREA_WIDTH ;
		right_sbar = CreateWindow("scrollbar",NULL,
			WS_CHILD | WS_TABSTOP | SBS_VERT, right_sbar_rect.left + ulx,right_sbar_rect.top + uly,
			right_sbar_rect.right - right_sbar_rect.left,
			right_sbar_rect.bottom - right_sbar_rect.top,
			mainPtr,(HMENU) 1,store_hInstance,NULL);

		init_screen_locs();
		set_up_start_screen();

		file_initialize();
		check_colors();
		cursor_stay();
		update_item_menu();
		shut_down_menus(0);

		cd_init_dialogs();

 		}

		event_handled = FALSE;
		while(GetMessage(&msg,NULL,0,0)) {
			if (event_handled == FALSE) {
				if (!TranslateAccelerator(mainPtr, accel, &msg)) {
					TranslateMessage(&msg);
					DispatchMessage(&msg);
					}
				}
			}

		delete data_store;
		saveSettingsToFile();

		return msg.wParam;
}
Beispiel #6
0
int main() {
  check_modifiers();
  check_fonts();
  check_colors();
}