//{{{ void options_menu(void) { int choice; int old_value, new_value; int change_made = 0; setTabStops(options_menu_tabs); UI_Menu_Set_Persist(1); while(1) { #ifdef OPTIONS_SUBMENUS choice = UI_Menu_Pick(options_rect, count_options()+OPTIONS_SUBMENUS, &cb_options_menu); if(choice>=0 && choice<OPTIONS_SUBMENUS) { pick_submenu(choice); change_made = 1; continue; } else { choice -= OPTIONS_SUBMENUS; } #else choice = UI_Menu_Pick(options_rect, count_options(), &cb_options_menu); #endif if(choice<0) break; old_value = get_option(options[choice].key); new_value = (old_value+1) % count_choices(options[choice].choices); set_option(options[choice].key, new_value); change_made = 1; #ifdef IS_CALCULATOR if(options[choice].key == OPTION_GRAYSCALE) { if(get_option(OPTION_GRAYSCALE) == OPTION_GRAY_ON) GrayOnThrow(); else GrayOff(); if(w->level) // Only if game is started full_redraw(); } #endif #ifdef PALMOS if(options[choice].key == OPTION_INVERSE) init_colors(); #endif #ifdef REALCOMPUTER if(options[choice].key == OPTION_COLOR) init_colors(); #endif } UI_Menu_Set_Persist(0); if(change_made) save_options(); }
int graphics_init (void) { int i,j; #ifdef DEBUG_GFX dbg("Function: graphics_init"); #endif current_width = PREFS_GFX_WIDTH; current_height = PREFS_GFX_HEIGHT; graphics_subinit (); if (!init_colors ()) return 0; buttonstate[0] = buttonstate[1] = buttonstate[2] = 0; for (i = 0; i < 256; i++) uae4all_keystate[i] = 0; #ifdef DEBUG_FRAMERATE uae4all_update_time(); #endif return 1; }
static int screen_init(lua_State *L) { Screen *screen; int w, h, bpp; screen = check_screen(L, 1); if (SDL_Init(SDL_INIT_VIDEO) < 0) { fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); /* TODO: Don't die, just return error */ exit(1); } lua_getfield(L, 2, "y"); h = lua_tointeger(L, -1); lua_getfield(L, 2, "x"); w = lua_tointeger(L, -1); bpp = lua_tointeger(L, 3); screen->screen = SDL_SetVideoMode( w, h, bpp, SDL_RESIZABLE); SDL_WM_SetCaption("Marauder_rl", NULL); if (!screen) { fprintf(stderr, "SDL_SetVideoMode() error: %s\n", SDL_GetError()); exit(1); } IMG_Init(IMG_INIT_PNG); init_colors(screen); init_characters(screen); screen->font = build_font(loadimg("img/font_8x12.png"), 8, 12); return 0; }
void ncurses_init() /* {{{ */ { /* initialize ncurses */ int ret; /* register signals */ signal(SIGINT, ncurses_end); signal(SIGKILL, ncurses_end); signal(SIGSEGV, ncurses_end); /* initialize screen */ tnc_fprintf(stdout, LOG_DEBUG, "starting ncurses..."); if ((stdscr = initscr()) == NULL ) { fprintf(stderr, "Error initialising ncurses.\n"); exit(EXIT_FAILURE); } /* start colors */ ret = init_colors(); if (ret) { fprintf(stderr, "Error initializing colors.\n"); tnc_fprintf(logfp, LOG_ERROR, "error initializing colors (%d)", ret); } } /* }}} */
ENTRYPOINT void init_bubble3d(ModeInfo * mi) { Display *display = MI_DISPLAY(mi); Window window = MI_WINDOW(mi); int screen = MI_SCREEN(mi); struct context *c; if (contexts == 0) { contexts = (struct context *) calloc(sizeof (struct context), MI_NUM_SCREENS(mi)); if (contexts == 0) return; } c = &contexts[screen]; c->glx_context = init_GL(mi); init_colors(mi); if (c->glx_context != 0) { init(c); reshape_bubble3d(mi, MI_WIDTH(mi), MI_HEIGHT(mi)); do_display(c); glFinish(); glXSwapBuffers(display, window); } else MI_CLEARWINDOW(mi); }
CXmlPropertyList::CXmlPropertyList( CXmlPropertyEditor *e ) : PropertyList( e ), editor( e ) { init_colors(); whatsThis = new PropertyWhatsThis( this ); showSorted = FALSE; header()->setMovingEnabled( FALSE ); header()->setStretchEnabled( TRUE ); setResizePolicy( QScrollView::Manual ); viewport()->setAcceptDrops( false ); viewport()->installEventFilter( this ); addColumn( tr( "Property" ) ); addColumn( tr( "Value" ) ); connect( header(), SIGNAL( sizeChange( int, int, int ) ), this, SLOT( updateEditorSize() ) ); connect( header(), SIGNAL( sectionClicked( int ) ), this, SLOT( toggleSort() ) ); connect( this, SIGNAL( pressed( QListViewItem *, const QPoint &, int ) ), this, SLOT( itemPressed( QListViewItem *, const QPoint &, int ) ) ); connect( this, SIGNAL( doubleClicked( QListViewItem * ) ), this, SLOT( toggleOpen( QListViewItem * ) ) ); disconnect( header(), SIGNAL( sectionClicked( int ) ), this, SLOT( changeSortColumn( int ) ) ); setSorting( -1 ); setHScrollBarMode( AlwaysOff ); setVScrollBarMode( AlwaysOn ); setColumnWidthMode( 1, Manual ); mousePressed = FALSE; pressItem = 0; theLastEvent = MouseEvent; header()->installEventFilter( this ); }
static void *exec(void *arg) { ws_state_list *p = (ws_state_list *) arg; EventRecord event; create_window(p); init_norm_xform(); init_colors(); create_patterns(); p->run = 1; while (p->run) { pthread_mutex_lock(&p->mutex); while (EventAvail(everyEvent, &event)) { GetNextEvent(everyEvent, &event); if (event.what == kHighLevelEvent) AEProcessAppleEvent(&event); } pthread_mutex_unlock(&p->mutex); usleep(10000); } DisposeWindow(p->win); pthread_exit(0); return 0; }
int main(void) { int i; struct color colors[COLOR_COUNT]; clock_setup(); gpio_setup(); reset_colors(colors, COLOR_COUNT); init_colors(colors, COLOR_COUNT); while (1) { gpio_toggle(GPIOC, GPIO12); /* LED on/off */ send_colors(colors, COLOR_COUNT); step_colors(colors, COLOR_COUNT); for (i = 0; i < 1000000; i++) /* Wait a bit. */ __asm__("nop"); } return 0; }
static GIFmetafile *init_meta(mf_cgmo *cgmo, int sx, int sy) { GIFmetafile *newmeta = (GIFmetafile *)umalloc(sizeof(GIFmetafile)); assert(newmeta); newmeta->image = gdImageCreate(sx, sy); newmeta->sx = sx; newmeta->sy = sy; newmeta->colors = (GIFcolor *)umalloc(sizeof(GIFcolor) * cgmo->ws->wscolour); newmeta->lineIndex = 1; newmeta->lineWidth = 1; newmeta->fillIndex = 1; newmeta->styleIndex = 1; newmeta->fillStyleIndex = 1; newmeta->style = 0; newmeta->resize = 1; /* OK to resize */ newmeta->ws = cgmo->ws; init_colors(newmeta, cgmo->ws->wscolour); /* Allocate colors -- background white, foreground black */ allocate_color(newmeta, 0, 1, 1, 1); allocate_color(newmeta, 1, 0, 0, 0); return newmeta; }
bool QuartzWindow::open( uint32 /* WindowClass */ wc, int* /* WindowAttributes */ attrs, int left, int top, int right, int bottom, const char* title, const char* font_name, int font_size ) { HIRect bounds = (HIRect) CGRectMake(left, top, right, bottom); OSStatus err = HIWindowCreate(wc, attrs, NULL, kHICoordSpace72DPIGlobal, &bounds, &_quartz_win); if (err != noErr) return false; SetWRefCon(my_window(), (int32)this); CFStringRef cftitle = CFStringCreateWithCString(NULL, title, kCFStringEncodingMacRoman); SetWindowTitleWithCFString(my_window(), cftitle); CFRelease(cftitle); WindowSet::add_window(my_window()); _is_open = true; init_colors(); init_events(); return true; }
Mesh::Mesh( int res, int depth_width, int depth_height, int tex_width, int tex_height ) { this->res = res; this->depth_width = depth_width; width = (float)depth_width / res; height = (float)depth_height / res; mesh_len = width * height; ibo_len = mesh_len * 6; init_ibo(); init_texcoords(tex_width,tex_height); init_colors(); init_pts(); vbo.setVertexData( &(pts3d)[0].x, 3, mesh_len, /*GL_STATIC_DRAW*/ GL_DYNAMIC_DRAW, sizeof(ofVec3f) ); //vbo.setNormalData( normals0x(), mesh_len, GL_DYNAMIC_DRAW, sizeof_normals() ); vbo.setIndexData( ibo, ibo_len, GL_STATIC_DRAW ); vbo.setColorData( colors, mesh_len, GL_STATIC_DRAW ); vbo.setTexCoordData( texcoords, mesh_len, GL_STATIC_DRAW ); }
static void generate_spheremonics (ModeInfo *mi) { spheremonics_configuration *cc = &ccs[MI_SCREEN(mi)]; int wire = MI_IS_WIREFRAME(mi); tweak_parameters (mi); if (!cc->done_once || (0 == (random() % 20))) { init_colors (mi); cc->done_once = True; } { glNewList(cc->dlist, GL_COMPILE); cc->polys1 = unit_spheremonics (mi, cc->resolution, wire,cc->m,cc->colors); glEndList(); glNewList(cc->dlist2, GL_COMPILE); glPushMatrix(); glScalef (1.05, 1.05, 1.05); cc->polys2 = unit_spheremonics (mi, cc->resolution, 2, cc->m, cc->colors); glPopMatrix(); glEndList(); } }
void MP_Open (Scene& scene, const char* name, int x, int y, int width, int height, int& success) { // maximal pixel coordinate of screen device scene.xmax = Mp.theDisplayWidth; scene.ymax = Mp.theDisplayHeight; // set scene's notion about size and aspect ratio scene.SetCanvas(MpRectangle<int>(0,0,width,height),Mp.theXYRatio); // set keyboard and locator flag (must be available for a X-terminal) scene.haslocator = scene.keyboard = true; // set colordisplay flag scene.colordisp = Mp.useColors; scene.truecolor = Mp.useTrueColors; static int ini = 0; if (ini++ == 0) { // initialize the grayscale fillpattern init_fillpattern(scene.mpwindow->Win()); // initialize the colormap only once init_colors(); } // always successful success = true; }
static void draw_model(struct jsp *model) { SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); SDL_RenderClear(renderer); /* draw coordinate system */ SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); SDL_RenderDrawLine(renderer, MARGIN, MARGIN, MARGIN, HEIGHT - MARGIN); SDL_RenderDrawLine(renderer, MARGIN, HEIGHT - MARGIN, WIDTH - MARGIN, HEIGHT - MARGIN); struct time_assignment *schedule = generate_schedule(model); init_colors(model->n_jobs); unsigned job_height = ((HEIGHT - 2 * MARGIN) + 10) / (model->n_machines) - 10; aforeach(i, schedule) { if (schedule[i].end > max_width) { max_width = schedule[i].end; } } float relative_width = ((WIDTH - 2 * MARGIN) * 1.0f) / max_width; aforeach(i, schedule) { SDL_Rect r = {schedule[i].start * relative_width + MARGIN + 1, schedule[i].machine * (job_height + 10) + MARGIN, (schedule[i].end - schedule[i].start) * relative_width, job_height}; set_color(schedule[i].job); SDL_RenderFillRect(renderer, &r); SDL_SetRenderDrawColor(renderer, 127, 127, 127, 255); SDL_RenderDrawRect(renderer, &r); }
void init_curses (void) { int i; initscr(); #ifdef HAVE_ESCDELAY /* * If ncurses exports the ESCDELAY variable, it should be set to * a low value, or you'll experience a delay in processing escape * sequences that are recognized by mc (e.g. Esc-Esc). On the other * hand, making ESCDELAY too small can result in some sequences * (e.g. cursor arrows) being reported as separate keys under heavy * processor load, and this can be a problem if mc hasn't learned * them in the "Learn Keys" dialog. The value is in milliseconds. */ ESCDELAY = 200; #endif /* HAVE_ESCDELAY */ do_enter_ca_mode (); mc_raw_mode (); noecho (); keypad (stdscr, TRUE); nodelay (stdscr, FALSE); init_colors (); if (force_ugly_line_drawing) { for (i = 0; acs_approx[i].acscode != 0; i++) { acs_map[acs_approx[i].acscode] = acs_approx[i].character; } } }
Mesh::Mesh( int step, int depth_width, int depth_height, int tex_width, int tex_height ) { this->step = step; this->depth_width = depth_width; width = (float)depth_width / step; height = (float)depth_height / step; mesh_len = width * height; ibo_len = mesh_len * 4; init_ibo(); init_texcoords( tex_width, tex_height ); init_colors(); init_pts(); // init vbo vbo.setVertexData( pts0x(), 3, mesh_len, GL_DYNAMIC_DRAW, sizeof_pts() ); //vbo.setNormalData( normals0x(), mesh_len, GL_DYNAMIC_DRAW, sizeof_normals() ); vbo.setIndexData( ibo, ibo_len, GL_STATIC_DRAW ); vbo.setColorData( vbo_color, mesh_len, GL_STATIC_DRAW ); vbo.setTexCoordData( vbo_texcoords, mesh_len, GL_STATIC_DRAW ); }
void init_global_game_state() { PATH_INFO::init_base_path(""); PATH_INFO::init_user_dir("./"); PATH_INFO::set_standard_filenames(); get_options().init(); get_options().load(); init_colors(); g = new game; g->load_static_data(); g->load_core_data(); DynamicDataLoader::get_instance().finalize_loaded_data(); world_generator->set_active_world(NULL); world_generator->get_all_worlds(); WORLDPTR test_world = world_generator->make_new_world( false ); world_generator->set_active_world(test_world); g->u = player(); g->u.create(PLTYPE_NOW); g->m = map( static_cast<bool>( ACTIVE_WORLD_OPTIONS["ZLEVELS"] ) ); g->m.load( g->get_levx(), g->get_levy(), g->get_levz(), false ); }
int main(int argc, char *argv[]) { srand(time(NULL)); // ncurses stuff initscr(); // Initialize ncurses noecho(); // Don't echo keypresses cbreak(); // C-style breaks (e.g. ^C to SIGINT) keypad(stdscr, true); // Numpad is numbers init_colors(); // See color.cpp curs_set(0); // Invisible cursor rand(); // For some reason a call to rand() seems to be necessary to avoid // repetion. bool quit_game = false; game *g; do { g = new game(); while (!g->do_turn()); if (g->game_quit()) quit_game = true; delete g; } while (!quit_game); erase(); // Clear screen endwin(); // End ncurses system("clear"); // Tell the terminal to clear itself return 0; }
Workspace::Workspace( QWidget *parent, MainWindow *mw ) : QListView( parent, 0, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_Tool | WStyle_MinMax | WStyle_SysMenu ), mainWindow( mw ), project( 0 ), completionDirty( FALSE ) { init_colors(); setDefaultRenameAction( Accept ); blockNewForms = FALSE; bufferEdit = 0; header()->setStretchEnabled( TRUE ); header()->hide(); setSorting( 0 ); setResizePolicy( QScrollView::Manual ); #ifndef Q_WS_MAC QPalette p( palette() ); p.setColor( QColorGroup::Base, QColor( *backColor2 ) ); (void)*selectedBack; // hack setPalette( p ); #endif addColumn( tr( "Files" ) ); setAllColumnsShowFocus( TRUE ); connect( this, SIGNAL( mouseButtonClicked( int, QListViewItem *, const QPoint &, int ) ), this, SLOT( itemClicked( int, QListViewItem *, const QPoint& ) ) ), connect( this, SIGNAL( doubleClicked( QListViewItem * ) ), this, SLOT( itemDoubleClicked( QListViewItem * ) ) ), connect( this, SIGNAL( contextMenuRequested( QListViewItem *, const QPoint &, int ) ), this, SLOT( rmbClicked( QListViewItem *, const QPoint& ) ) ), setHScrollBarMode( AlwaysOff ); setVScrollBarMode( AlwaysOn ); viewport()->setAcceptDrops( TRUE ); setAcceptDrops( TRUE ); setColumnWidthMode( 1, Manual ); }
/** * Initializes the emulator primary surface. By default, attempts to create * a hardware based surface that is double buffered. To update the screen, you * must call screen_refresh. Returns TRUE if the screen was created. * * @returns TRUE if the screen was created, FALSE otherwise */ int screen_init(void) { int result = FALSE; TTF_Init(); message_font = TTF_OpenFont("VeraMono.ttf", 11); screen_width = SCREEN_WIDTH * scale_factor; screen_height = SCREEN_HEIGHT * scale_factor; screen = SDL_SetVideoMode(screen_width, screen_height, SCREEN_DEPTH, SDL_SWSURFACE); if (screen == NULL) { printf("Error: Unable to set video mode: %s\n", SDL_GetError()); } else { SDL_SetAlpha(screen, SDL_SRCALPHA, 255); SDL_WM_SetCaption("YAC8 Emulator", NULL); init_colors(screen); virtscreen = screen_create_surface(screen_width, screen_height, 255, -1); overlay = screen_create_surface(screen_width, screen_height, 200, COLOR_BLACK); result = TRUE; } return ((virtscreen != NULL) && (overlay != NULL) && result); }
int main() { srand(time(NULL)); window = initscr(); if (window == NULL) { fprintf(stderr, "error initialising curses.\n"); return 1; } start_color(); if (has_colors() && COLOR_PAIRS >= 13) { init_colors(); } curs_set(0); // hide the cursor noecho(); // do not show characters when they've been typed generate_map(); player = (Player) { .x_pos = 5, .y_pos = 5, .inventory = { (Item) { "", 0 } } }; loop('\0'); char key = '\0'; while (key != 27) { // 27 = escape key key = getch(); loop(key); } quit(window); }
HierarchyList::HierarchyList( QWidget *parent, FormWindow *fw, bool doConnects ) : QListView( parent ), formWindow( fw ) { init_colors(); setDefaultRenameAction( Accept ); header()->setMovingEnabled( false ); header()->setStretchEnabled( true ); normalMenu = 0; tabWidgetMenu = 0; addColumn( i18n("Name" ) ); addColumn( i18n("Class" ) ); QPalette p( palette() ); p.setColor( QColorGroup::Base, QColor( *backColor2 ) ); (void)*selectedBack; // hack setPalette( p ); disconnect( header(), SIGNAL( sectionClicked( int ) ), this, SLOT( changeSortColumn( int ) ) ); setSorting( -1 ); setHScrollBarMode( AlwaysOff ); setVScrollBarMode( AlwaysOn ); if ( doConnects ) { connect( this, SIGNAL( clicked( QListViewItem * ) ), this, SLOT( objectClicked( QListViewItem * ) ) ); connect( this, SIGNAL( returnPressed( QListViewItem * ) ), this, SLOT( objectClicked( QListViewItem * ) ) ); connect( this, SIGNAL( contextMenuRequested( QListViewItem *, const QPoint&, int ) ), this, SLOT( showRMBMenu( QListViewItem *, const QPoint & ) ) ); } deselect = true; setColumnWidthMode( 1, Manual ); }
void main(){ init_curses(); init_colors(); while (1){ level_editor(); } }
void init_globals() { char temp[256]; MaxPlayer = 1; //TODO: Add multiple players option // getfont(); load_font(); // nosound(); init_random(); // OldHeapSize = memavail; // mark(OldHeapLimit); // getmem(tableground1,320*200); // getmem(tableground2,320*200); // getmem(tableground3,320*200); led_display = malloc(160*24); // getmem(arm_links,ArmBreiteLinks*ArmHoeheLinks*5); // getmem(arm_rechts,ArmBreiteRechts*ArmHoeheRechts*5); // getmem(arm_links_msk,ArmBreiteLinks*ArmHoeheLinks*5); // getmem(arm_rechts_msk,ArmBreiteRechts*ArmHoeheRechts*5); ball = malloc(256); ground = malloc(256); ball_sprite = malloc(256); underground = malloc(1024); tableground = malloc(9368); feder = malloc(480); // ledseg=seg(Led_display^); // armlinksseg:=seg(arm_links^); // armrechtsseg:=seg(arm_rechts^); // armlinks_mskseg:=seg(arm_links_msk^); // armrechts_mskseg:=seg(arm_rechts_msk^); // ballseg:=seg(ball^); // groundseg:=seg(ground^); // ballspriteseg:=seg(ball_Sprite^); // undergroundseg:=seg(underground^); // tablegroundseg:=seg(tableground^); // federseg:=seg(Feder^); led_hoehe=24; led_color_1=129; led_color_2=130; led_funktion=0; // {twix-mode 320x400 } // vga320x400Overscan(); //{setlinecomp(400-46);} load_table_tab(); load_table_gro(); load_feder(); init_colors(); sprintf(temp,"gfx/feder%c.mpa", tnr); load_mini_palette(temp); load_arm_links(); load_arm_rechts(); load_arm_links_msk(); load_arm_rechts_msk(); load_ball(); if (UseSound) init_soundkit(); }
int graphics_init (bool mousecapture) { graphics_subinit (); if (!init_colors ()) return 0; return 1; }
void init_curses(){ initscr(); init_colors(); cbreak(); noecho(); keypad(stdscr, TRUE); curs_set(0); resize_term(70, 150); }
/* get selected scheme */ static void scheme_chosen (const char *name) { if (strcmp ("Green/Original", name) == 0) conf.color_scheme = STD_GREEN; else if (strcmp ("Monochrome/Default", name) == 0) conf.color_scheme = MONOCHROME; init_colors (); }
/* get selected scheme */ static void scheme_chosen (char *name) { if (strcmp ("Green/Original", name) == 0) conf.color_scheme = STD_GREEN; else conf.color_scheme = MONOCHROME; init_colors (); }
/* get selected scheme */ static void scheme_chosen (char *name) { if (strcmp ("Monochrome/Default", name) == 0) conf.color_scheme = MONOCHROME; else conf.color_scheme = STD_GREEN; init_colors (); }
void init_curses ( void ) { initscr ( ); cbreak ( ); noecho ( ); keypad ( stdscr, TRUE ); curs_set ( 0 ); init_colors ( ); }