void Program::print() { PrintPass pass; init_colours(); pass.run(this, true, false); }
int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); glutCreateWindow("feedback"); glutReshapeWindow(MAXSIZE, MAXSIZE); glutDisplayFunc(redraw); glutIdleFunc(redraw); glutMouseFunc(mouse); glutMotionFunc(motion); create_menus(); init_colours(100.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 1.0); glViewport(0, 0, MAXSIZE, MAXSIZE); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glutMainLoop(); return 0; /* ANSI C requires main to return int. */ }
void pre_init(void) { morecore_area = core_buf; morecore_size = SERVER_CORE_SIZE; serial_lock(); // Initialize the serial port set_dlab(0); // we always assume the dlab is 0 unless we explicitly change it disable_interrupt(); disable_fifo(); reset_lcr(); reset_mcr(); clear_iir(); set_baud_rate(BAUD_RATE); reset_state(); enable_fifo(); enable_interrupt(); clear_iir(); // all done init_colours(); /* query what getchar clients exist */ num_getchar_clients = getchar_num_badges(); getchar_clients = calloc(num_getchar_clients, sizeof(getchar_client_t)); for (int i = 0; i < num_getchar_clients; i++) { unsigned int badge = getchar_enumerate_badge(i); assert(badge <= num_getchar_clients); getchar_clients[badge].client_id = badge; getchar_clients[badge].buf = getchar_buf(badge); getchar_clients[badge].last_head = -1; } set_putchar(serial_putchar); serial_irq_reg_callback(serial_irq, 0); /* Start regular heartbeat of 500ms */ timeout_periodic(0, 500000000); serial_unlock(); }
void colour_menu(int i) { switch(i) { case 0: init_colours(500.0); randomcolours = 0; break; case 1: init_colours(100.0); randomcolours = 0; break; case 2: init_colours(10.0); randomcolours = 0; break; case 3: randomcolours = 1; break; } }
int uidisplay_init( int width, int height ) { int x, y, error; libspectrum_dword black; const char *machine_name; colour_format_t colour_format; #if !GTK_CHECK_VERSION( 3, 0, 0 ) g_signal_connect( G_OBJECT( gtkui_drawing_area ), "expose_event", G_CALLBACK( gtkdisplay_expose ), NULL ); colour_format = FORMAT_x8b8g8r8; #else g_signal_connect( G_OBJECT( gtkui_drawing_area ), "draw", G_CALLBACK( gtkdisplay_draw ), NULL ); colour_format = FORMAT_x8r8g8b8; #endif /* #if !GTK_CHECK_VERSION( 3, 0, 0 ) */ g_signal_connect( G_OBJECT( gtkui_drawing_area ), "configure_event", G_CALLBACK( drawing_area_resize_callback ), NULL ); error = init_colours( colour_format ); if( error ) return error; black = settings_current.bw_tv ? bw_colours[0] : gtkdisplay_colours[0]; for( y = 0; y < DISPLAY_SCREEN_HEIGHT + 4; y++ ) for( x = 0; x < DISPLAY_SCREEN_WIDTH + 3; x++ ) *(libspectrum_dword*)( rgb_image + y * rgb_pitch + 4 * x ) = black; image_width = width; image_height = height; image_scale = width / DISPLAY_ASPECT_WIDTH; register_scalers( 0 ); display_refresh_all(); if ( scaler_select_scaler( current_scaler ) ) scaler_select_scaler( SCALER_NORMAL ); gtkdisplay_load_gfx_mode(); machine_name = libspectrum_machine_name( machine_current->machine ); gtkstatusbar_update_machine( machine_name ); display_ui_initialised = 1; return 0; }
ui_t *create_ui() { ui_t *ui = malloc(sizeof(ui_t)); initscr(); init_colours(); noecho(); /* Get all the mouse events */ mousemask(ALL_MOUSE_EVENTS, NULL); mouseinterval(1); keypad(stdscr, TRUE); render_ui(ui); return ui; }
int wiidisplay_init(void) { int error; error = init_colours(); if( error ) return error; VIDEO_Init(); u32 videoMode = VIDEO_GetCurrentTvMode(); switch(videoMode) { case VI_NTSC: rmode = &TVNtsc480IntDf; break; case VI_PAL: rmode = &TVPal528IntDf; break; case VI_MPAL: rmode = &TVMpal480IntDf; break; default: rmode = &TVNtsc480IntDf; break; } xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); console_init(xfb, 20, 20, rmode->fbWidth, rmode->xfbHeight, rmode->fbWidth*VI_DISPLAY_PIX_SZ); VIDEO_Configure(rmode); VIDEO_SetNextFramebuffer(xfb); VIDEO_SetBlack(FALSE); VIDEO_Flush(); VIDEO_WaitVSync(); if(rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync(); return 0; }
int main(void) { int nthr = 4; //get_nprocs_conf(); int ndx; int delta = HEIGHT / nthr; int ofs = 0; struct mandelthr *args; pthread_t *thrtab = calloc(nthr, sizeof(pthread_t)); pthread_t **thrptrtab = calloc(nthr, sizeof(pthread_t *)); fprintf(stderr, "mandel launching %d threads\n", nthr); /* Make a window! */ init_x11(WIDTH); init_colours(); g_mandel.nthr = nthr; for (ndx = 0 ; ndx < nthr ; ndx++) { args = calloc(1, sizeof(struct mandelthr)); args->yofs = ofs; args->ylim = ofs + delta; pthread_create(&thrtab[ndx], NULL, mandel_start, args); ofs += delta; } for (ndx = 0 ; ndx < nthr ; ndx++) { pthread_join(thrtab[ndx], (void **)&thrptrtab[ndx]); } do { // pthread_yield(); // m_waitspin(); usleep(50000); pthread_yield(); } while (g_mandel.nthr); XPutImage(g_x11.dpy, g_x11.win, g_x11.gc, g_x11.bitmap, 0, 0, 0, 0, WIDTH, HEIGHT); XFlush(g_x11.dpy); // display_double(ASIZE, xmin, xmax, ymin, ymax); #ifdef WAIT_EXIT while(1) { XEvent event; KeySym key; char text[255]; XNextEvent(g_x11.dpy, &event); /* Just redraw everything on expose */ if ((event.type == Expose) && !event.xexpose.count) { XPutImage(g_x11.dpy, g_x11.win, g_x11.gc, g_x11.bitmap, 0, 0, 0, 0, WIDTH, HEIGHT); } /* Press 'q' to quit */ if ((event.type == KeyPress) && XLookupString(&event.xkey, text, 255, &key, 0) == 1) { if (text[0] == 'q') break; } /* Or simply close the window */ if ((event.type == ClientMessage) && ((Atom) event.xclient.data.l[0] == g_x11.wmdelmsg)) { break; } } #endif sleep(5); /* Done! */ exit_x11(); return 0; }
void PlanetWidget::initColours () { init_colours(*colours, planetHandler->planet()); set_colours(*colours, planetHandler->planet(), 0); }
int main(void) { int nthr = get_nprocs_conf(); int ndx; int delta = ASIZE / nthr; int ofs = 0; struct mandelthr *args; pthread_t *thrtab = calloc(nthr, sizeof(pthread_t)); pthread_t **thrptrtab = calloc(nthr, sizeof(pthread_t *)); /* Make a window! */ init_x11(ASIZE); init_colours(); g_nthr = nthr; for (ndx = 0 ; ndx < nthr ; ndx++) { args = calloc(1, sizeof(struct mandelthr)); args->yofs = ofs; args->ylim = ofs + delta; pthread_create(&thrtab[ndx], NULL, mandel_start, args); ofs += delta; } for (ndx = 0 ; ndx < nthr ; ndx++) { pthread_join(thrtab[ndx], (void **)&thrptrtab[ndx]); } do { pthread_yield(); } while (g_nthr); XPutImage(dpy, win, gc, bitmap, 0, 0, 0, 0, ASIZE, ASIZE); XFlush(dpy); // display_double(ASIZE, xmin, xmax, ymin, ymax); #ifdef WAIT_EXIT while(1) { XEvent event; KeySym key; char text[255]; XNextEvent(dpy, &event); /* Just redraw everything on expose */ if ((event.type == Expose) && !event.xexpose.count) { XPutImage(dpy, win, gc, bitmap, 0, 0, 0, 0, ASIZE, ASIZE); } /* Press 'q' to quit */ if ((event.type == KeyPress) && XLookupString(&event.xkey, text, 255, &key, 0) == 1) { if (text[0] == 'q') break; } /* Or simply close the window */ if ((event.type == ClientMessage) && ((Atom) event.xclient.data.l[0] == wmDeleteMessage)) { break; } } #endif /* Done! */ exit_x11(); return 0; }