Exemplo n.º 1
0
void PrintBoard(int x, int y){
	int i, j, k, l;
	k = x;
	l = y;

	char str[10];
	for(i=0; i<ROW; i++, l+=30){
		for(j=0; j<COL; j++, k+=45){
			if(board[i][j] == 0){
				write_text(" ", k, l, WHITE, 0);
			}else{
				sprintf(str, "%d", board[i][j]);
				write_text(str, k, l, WHITE, 0);
			}
		}
		k = x;
	}

	for(i=20;i<140;i++){
		write_pixel(i, 20, WHITE);
		write_pixel(i, 50, WHITE);
		write_pixel(i, 80, WHITE);
		write_pixel(i, 110, WHITE);
	}

	for(i=20;i<110;i++){
		write_pixel(20, i, WHITE);
		write_pixel(60, i, WHITE);	
		write_pixel(100, i, WHITE);
		write_pixel(140, i, WHITE);
	}
}
Exemplo n.º 2
0
void print_board(int x, int y){ //set up initial board 

	int i, j, a, b;
 	a=x;
 	b=y;
 	char str[15];

	//display level
   	write_text("Level",135,5,WHITE,0); 
	sprintf(str,"%d",level);
   	write_text(str,190,5,WHITE,0);

	//print the 25 bulbs
	for(i=0; i<maxrow; i++, b+=24){
		for(j=0; j<maxcol; j++, a+=31)
			print_bulb(i, j, a, b);
		a=x;
	}
	
	//display legend
	write_text("Up-W",5,35,WHITE,0);
	write_text("Dn-S",5,45,WHITE,0);
	write_text("Lf-A",5,55,WHITE,0);
	write_text("Rt-D",5,65,WHITE,0);
	
	write_text("Flip-L",5,75,WHITE,0);
	write_text("Exit-X",5,85,WHITE,0);
	write_text("Reset-R",5,95,WHITE,0);

	//show number of flips
	write_text("Flips:",5,115,WHITE,0);
	
}
Exemplo n.º 3
0
// ################
// ## 6. LE MAIN ##
// ################
int main () {
    int n;
    BOOL b;

    init_graphics(600,600);

    write_text("Bonjour");
    write_text("Au revoir");
    write_text("ЮИХНТОГ юихнтог");

    n = 23;
    write_int(n);
    write_int(42);

    b = (2<3);
    write_bool(b);
    write_bool(2 == 3);

    POINT centre;
    centre = wait_clic();
    draw_fill_circle(centre, 20, rouge);

    wait_escape();
    exit (0);
}
Exemplo n.º 4
0
void OnInitDialogPal(void *w)
{
  GEM_WINDOW     *wnd = (GEM_WINDOW *) w ;
  WEXTENSION_PAL *wext = wnd->DlgData->UserData ;
  OBJECT         *adr_mkpal = wnd->DlgData->BaseObject ;
  int            off_y ;
  char           buf[15] ;

  adr_mkpal[MKPAL_BOX].ob_spec.userblk->ub_code = draw_colors ;
  adr_mkpal[MKPAL_BOX].ob_spec.userblk->ub_parm = (long) wext ;
  adr_mkpal[MKPAL_CURRCOL].ob_spec.userblk->ub_code = draw_currentcolor ;
  adr_mkpal[MKPAL_CURRCOL].ob_spec.userblk->ub_parm = (long) wext ;

  get_vdipalette( wext->curr_pal ) ;
  wext->index = 0 ;
  wext->stdeg = wext->enddeg = 500 ;
  wext->hf    = (float) (adr_mkpal[MKPAL_REDBOX].ob_height-adr_mkpal[MKPAL_RED].ob_height) ;
  vq_color(handle, wext->index, 0, wext->rgb) ;
  sprintf(buf, "%.4d",wext->rgb[0]) ;
  write_text(adr_mkpal, MKPAL_TRED, buf) ;
  sprintf(buf, "%.4d", wext->rgb[1]) ;
  write_text(adr_mkpal, MKPAL_TGREEN, buf) ;
  sprintf(buf, "%.4d", wext->rgb[2]) ;
  write_text(adr_mkpal, MKPAL_TBLUE, buf) ;
  off_y = (int) ((1000-wext->rgb[0])*(float)wext->hf/1000.0) ;
  adr_mkpal[MKPAL_RED].ob_y = off_y ;
  off_y = (int) ((1000-wext->rgb[1])*(float)wext->hf/1000.0) ;
  adr_mkpal[MKPAL_GREEN].ob_y = off_y ;
  off_y = (int) ((1000-wext->rgb[2])*(float)wext->hf/1000.0) ;
  adr_mkpal[MKPAL_BLUE].ob_y = off_y ;
  wext->flag_aff = 0 ;
}
Exemplo n.º 5
0
void init_kickstart()
{
	if (uae4all_init_rom(romfile))
	{
#ifndef USE_GUICHAN
		SDL_Event ev;
		text_draw_background();
		text_draw_window(2, 6, 42, 12, "--- ERROR ---");
		write_text(6, 12, romfile);
		write_text(8, 14, "not found!");
		write_text(8, 16, "Please check settings");
		write_text(8, 18, "Press any button to continue");
		text_flip();
		SDL_Delay(333);
		while (SDL_PollEvent(&ev))
				SDL_Delay(10);
		while (!SDL_PollEvent(&ev))
			SDL_Delay(10);
		while (SDL_PollEvent(&ev))
			if (ev.type == SDL_QUIT)
				exit(1);
		text_draw_background();
		text_flip();
		SDL_Delay(333);
#endif
		kickstart_warning=1;
	}
	else
	{
		kickstart_warning=0;
		bReloadKickstart=1;
	}
}
Exemplo n.º 6
0
static void draw_fileinfoMenu(int c)
{
	int menuLine = 0;
	SDL_Rect r;
	extern SDL_Surface *text_screen;
	r.x=80-64; r.y=60; r.w=110+64+64; r.h=120;

	text_draw_background();
	text_draw_window(80-64,12,160+64+64,220,text_str_fileinfo_title);

	menuLine = 4;
	write_text(3, menuLine, "File info:");
	menuLine+=2;
	write_text(3, menuLine, "----------");
	menuLine+=4;

	// now wrap the filename if necessary (at 32)
	int i = 0;
	char line [40];
	const int LINELEN = 32;

	for (i = 0; i < strlen(fileInfo_fileName); i+=LINELEN)
	{
		strncpy(line, fileInfo_fileName + i, LINELEN);
		line[LINELEN] = '\0';

		write_text(3, menuLine, line);
		menuLine+=2;
	}
	
	text_flip();
}
Exemplo n.º 7
0
lref_t lwrite_strings(size_t argc, lref_t argv[])
{
     if (argc < 1)
          vmerror_unsupported(_T("Must specify port to write-strings"));

     lref_t port = argv[0];

     if (!TEXT_PORTP(port))
          vmerror_wrong_type_n(1, port);

     if (PORT_INPUTP(port))
          vmerror_unsupported(_T("cannot write-strings to input ports"));

     for (size_t ii = 1; ii < argc; ii++) {
          lref_t str = argv[ii];

          if (STRINGP(str)) {
               write_text(port, str->as.string.data, str->as.string.dim);
          } else if (CHARP(str)) {
               _TCHAR ch = CHARV(str);

               write_text(port, &ch, 1);
          } else
               vmerror_wrong_type_n(ii, str);
     }

     return port;
}
Exemplo n.º 8
0
void OnInitDialogGamma(void *w)
{
  GEM_WINDOW       *wnd = (GEM_WINDOW *) w ;
  WEXTENSION_GAMMA *wext = wnd->DlgData->UserData ;
  OBJECT           *adr_gamma = wnd->DlgData->BaseObject ;
  char             buf[20] ;

  if ( nb_plane == 16 ) wext->nb_bits = 5 ;
  else                  wext->nb_bits = 8 ;
  wext->rgamma = wext->vgamma = wext->bgamma = 1.0 ;
  sprintf(buf, "%.2f", wext->rgamma) ;
  write_text(adr_gamma, GAMMA_RVAL, buf) ;
  write_text(adr_gamma, GAMMA_VVAL, buf) ;
  write_text(adr_gamma, GAMMA_BVAL, buf) ;
  wext->wbar = adr_gamma[GAMMA_RBAR].ob_width-adr_gamma[GAMMA_RSLIDER].ob_width ;
  if ( Truecolor )
  {
    set_tcgamma( wext->rgamma, wext->tcrgamma, wext->nb_bits ) ;
    memcpy( wext->tcvgamma, wext->tcrgamma, 256) ;
    memcpy( wext->tcbgamma, wext->tcrgamma, 256) ;
  }
  else
  {
    set_gamma( gamma, wext->trgamma) ;
    memcpy( wext->tvgamma, wext->trgamma, 1030*2) ;
    memcpy( wext->tbgamma, wext->trgamma, 1030*2) ;
  }
  wext->off_x = (int) ( wext->rgamma*(float)wext->wbar/2.0 ) ;
  adr_gamma[GAMMA_RSLIDER].ob_x = wext->off_x ;
  adr_gamma[GAMMA_VSLIDER].ob_x = wext->off_x ;
  adr_gamma[GAMMA_BSLIDER].ob_x = wext->off_x ;
}
Exemplo n.º 9
0
void load_icon(GEM_WINDOW *wnd, int num)
{
  WEXTENSION_ALBUM *wext = wnd->DlgData->UserData ;
  OBJECT           *adr_album = wnd->DlgData->BaseObject ;
  char             *c ;
  char             buf[200] ;
  char             comment[SIZE_COMMENT] ;

  if (tab_index == NULL) return ;

  if ( wext->last_num != num )
  {
    if ((num < catalog_header.nb_records+catalog_header.nb_deleted) && tab_index[num].is_visible)
    {
      wext->albumimg.fd_nplanes = nb_plane ;
      if (wext->albumimg.fd_addr != NULL) free(wext->albumimg.fd_addr) ;
      if (wext->imginf.palette != NULL)
      {
        free(wext->imginf.palette) ;
        wext->imginf.palette = NULL ;
      }
      catalog_loadicon(num, &wext->albumimg, &wext->imginf, comment) ;
      set_palette(&wext->imginf) ;
      c = &catalog_header.category_names[tab_index[num].category_1][0] ;
      if ((wext->last_num < 0) || (tab_index[num].category_1 != tab_index[wext->last_num].category_1))
      {
        sprintf(buf, "  %s", c) ;
        write_text(adr_album, ALBUM_CATEGORIE1, buf) ;
        xobjc_draw( wnd->window_handle, adr_album, ALBUM_CATEGORIE1 ) ;
      }
      if ((wext->last_num < 0) || (tab_index[num].category_2 != tab_index[wext->last_num].category_2))
      {
        c = &catalog_header.category_names[tab_index[num].category_2][0] ;
        sprintf(buf, "  %s", c) ;
        write_text(adr_album, ALBUM_CATEGORIE2, buf) ;
        xobjc_draw( wnd->window_handle, adr_album, ALBUM_CATEGORIE2 ) ;
      }
      if ((wext->last_num < 0) || (tab_index[num].category_3 != tab_index[wext->last_num].category_3))
      {
        c = &catalog_header.category_names[tab_index[num].category_3][0] ;
        sprintf(buf, "  %s", c) ;
        write_text(adr_album, ALBUM_CATEGORIE3, buf) ;
        xobjc_draw( wnd->window_handle, adr_album, ALBUM_CATEGORIE3 ) ;
      }
      if ( strcmp( comment, wext->img_comment ) )
      {
        strcpy( wext->img_comment, comment ) ;
        write_text( adr_album, ALBUM_COMMENT, wext->img_comment ) ;
        xobjc_draw( wnd->window_handle, adr_album, ALBUM_COMMENT ) ;
      }
    }
    else if (wext->albumimg.fd_addr != NULL) img_raz(&wext->albumimg) ;
    wext->last_num = num ;
  }
}
Exemplo n.º 10
0
void show_dimpage(GEM_WINDOW *wnd, PAGE *page, OBJECT *adr_print)
{
  char buf[20] ;

  sprintf(buf, "%.1f", page->largeur) ;
  write_text(adr_print, PRINT_SIZEPAGEW, buf) ;
  xobjc_draw( wnd->window_handle, adr_print, PRINT_SIZEPAGEW ) ;
  sprintf(buf, "%.1f", page->hauteur) ;
  write_text(adr_print, PRINT_SIZEPAGEH, buf) ;
  xobjc_draw( wnd->window_handle, adr_print, PRINT_SIZEPAGEH ) ;
}
Exemplo n.º 11
0
void move_cursor(SDL_Surface *sdl_screen, int where) {
    if(where == UP && cursor_pos > 0) {
        write_text("\1", 5, cursor_pos*10 + 20, sdl_screen);
        cursor_pos--;
        write_text(">", 5, cursor_pos*10 + 20, sdl_screen);
    }
    else if(where == DOWN && cursor_pos < 22) {
        write_text("\1", 5, cursor_pos*10 + 20, sdl_screen);
        cursor_pos++;
        write_text(">", 5, cursor_pos*10 + 20, sdl_screen);
    }
}
Exemplo n.º 12
0
void OnInitDialogSldShow(void *w)
{
  GEM_WINDOW *wnd = (GEM_WINDOW *) w ;
  WEXTENSION_SLDSHOW *wext = wnd->DlgData->UserData ;
  WDLG_DATA          *wdlg = wnd->Extension ;
  OBJECT             *adr_sldshow = wnd->DlgData->BaseObject ;
  int                i ;
  char               buffer[20] ;

  if ( config.display_type & DISPLAYTYPE_ZOOM ) select( adr_sldshow, SSH_AFFZOOM ) ;
  else                                          deselect( adr_sldshow, SSH_AFFZOOM ) ;
  if ( config.display_type & DISPLAYTYPE_REDUC ) select( adr_sldshow, SSH_AFFREDUC ) ;
  else                                          deselect( adr_sldshow, SSH_AFFREDUC ) ;
  
  wext->transition = config.transition ;
  wdlg->popup_transition = popup_make(3, 13) ;
  if (wdlg->popup_transition == NULL) return ;
  for (i = 0; i <= 2; i++)
    strcpy(wdlg->popup_transition[1+i].ob_spec.free_string, msg[MSG_TRANSIT0+i]) ;
  write_text(adr_sldshow, SSH_TRANSITION, msg[MSG_TRANSIT0+wext->transition]) ;

  wext->back = config.back ;
  wdlg->popup_back = popup_make(2, 13) ;
  if (wdlg->popup_back == NULL) return ;
  strcpy(wdlg->popup_back[1].ob_spec.free_string, msg[MSG_NOIR]) ;
  strcpy(wdlg->popup_back[2].ob_spec.free_string, msg[MSG_BLANC]) ;

  if ( config.cycle ) select(adr_sldshow, SSH_CYCLE) ;
  else                deselect(adr_sldshow, SSH_CYCLE) ;
  if ( config.do_not_cls_scr ) deselect(adr_sldshow, SSH_CLSSCREEN) ;
  else                         select(adr_sldshow, SSH_CLSSCREEN) ;
  if ( config.aff_name ) select(adr_sldshow, SSH_SHOWNAME) ;
  else                   deselect(adr_sldshow, SSH_SHOWNAME) ;
  if ( config.aff_prog ) select(adr_sldshow, SSH_SHOWPROG) ;
  else                   deselect(adr_sldshow, SSH_SHOWPROG) ;

  if ( config.wait_mini_sec >= 0 )
  {
    sprintf( buffer, "%02d", config.wait_mini_sec ) ;
    write_text(adr_sldshow, SSH_WAITMINI, buffer) ;
    adr_sldshow[SSH_WAITMINI].ob_state   &= ~DISABLED ;
    adr_sldshow[SSH_TWAITMINI].ob_state  &= ~DISABLED ;
    deselect( adr_sldshow, SSH_NOTIMER ) ;
  }
  else
  {
    strcpy( buffer, "00" ) ;
    write_text(adr_sldshow, SSH_WAITMINI, buffer) ;
    adr_sldshow[SSH_WAITMINI].ob_state   |= DISABLED ;
    adr_sldshow[SSH_TWAITMINI].ob_state  |= DISABLED ;
    select( adr_sldshow, SSH_NOTIMER ) ;
  }
}
Exemplo n.º 13
0
void OnInitDialogPref(void *w)
{
  GEM_WINDOW *wnd = (GEM_WINDOW *) w ;
  WEXTENSION_PREF *wext = wnd->DlgData->UserData ;
  WDLG_PREF       *wdlg = wnd->Extension ;
  OBJECT          *adr_pref = wnd->DlgData->BaseObject ;
  int             i ;

  memcpy( &wext->save, &config, sizeof(VISION_CFG) ) ;
  wext->display_toolbar = config.flags & FLG_TOOLBAR ;
  if (config.flag_fullscreen == 1)    select(adr_pref, PREF_PECRAN) ;
  else                                deselect(adr_pref, PREF_PECRAN) ;
  if (config.w_info == 1)             select(adr_pref, PREF_WKIND) ;
  else                                deselect(adr_pref, PREF_WKIND) ;
  if (config.quitte == 1)             select(adr_pref, PREF_QUIT) ;
  else                                deselect(adr_pref, PREF_QUIT) ;
  if (config.clip_gem == 1)           select(adr_pref, PREF_CLIP) ;
  else                                deselect(adr_pref, PREF_CLIP) ;
  if (config.souris_viseur == 1)      select(adr_pref, PREF_MVISEUR) ;
  else                                deselect(adr_pref, PREF_MVISEUR) ;
  if (config.flags & FLG_HELP)        select(adr_pref, PREF_AIDE) ;
  else                                deselect(adr_pref, PREF_AIDE) ;
  if (config.flags & FLG_SPLASH)      select(adr_pref, PREF_SPLASH) ;
  else                                deselect(adr_pref, PREF_SPLASH) ;
  if (config.flags & FLG_TOOLBAR)     select(adr_pref, PREF_TOOLBAR) ;
  else                                deselect(adr_pref, PREF_TOOLBAR) ;
  if (config.flags & FLG_LONGFNAME) select(adr_pref, PREF_LONGFNAME) ;
  else                              deselect(adr_pref, PREF_LONGFNAME) ;
  if (config.flags & FLG_DITHERAUTO)  select(adr_pref, PREF_DITHERAUTO) ;
  else                                deselect(adr_pref, PREF_DITHERAUTO) ;

  wdlg->popup_cp = popup_make(3, 14) ;
  if (wdlg->popup_cp == NULL) return ;
  for (i = 0; i <= 2; i++) strcpy(wdlg->popup_cp[1+i].ob_spec.free_string, msg[MSG_CPNONE+i]) ;

  wext->cp = config.color_protect ;
  write_text(adr_pref, PREF_CP, msg[MSG_CPNONE+wext->cp]) ;

  wdlg->popup_dm = popup_make(3, 26) ;
  if (wdlg->popup_dm == NULL) return ;
  for (i = 0; i <= 2; i++) strcpy(wdlg->popup_dm[1+i].ob_spec.free_string, msg[MSG_DITHERAUTO+i]) ;

  wext->dm = config.dither_method ;
  write_text(adr_pref, PREF_DITHER, msg[MSG_DITHERAUTO+wext->dm]) ;

  wdlg->popup_language = popup_make( config.nb_languages, 17 ) ;
  if ( wdlg->popup_language == NULL ) return ;
  for ( i = 1; i <= config.nb_languages; i++)
    sprintf( wdlg->popup_language[i].ob_spec.free_string, "  %s", config.all_languages[i-1] ) ;

  sprintf( wext->language, "  %s", config.language ) ;
  write_text( adr_pref, PREF_LANGUE, wext->language ) ;
}
Exemplo n.º 14
0
//displays header
header(int x, int y){

	bulb_row2(x,0+y);
	bulb_pair1(x,24+y);
	bulb_pair2(x,48+y);
	bulb_pair1(x,72+y);
	bulb_row2(x,96+y);
	
	write_text("LIGHTSOUT!",120,40,WHITE,1); //title

	//menu options
	write_text("Play",40,160,WHITE,0); 
	write_text("Quit",200,160,WHITE,0);
}
Exemplo n.º 15
0
static int OnObjectNotify(void *w, int obj)
{
  GEM_WINDOW           *wnd = (GEM_WINDOW *) w ;
  WEXTENSION_LDVDETAIL *wext = wnd->DlgData->UserData ;
  WDLG_LDVDETAIL       *wdlg = wnd->Extension ;
  OBJECT               *bobj = wnd->DlgData->BaseObject ;
  int                  i, off_x, off_y, code = -1 ;

  switch( obj )
  {
     case LDVD_NPLANES : objc_offset( bobj, obj, &off_x, &off_y ) ;
                         i = popup_formdo( &wdlg->popup_nplanes, off_x, off_y, wext->inplanes, -1 ) ;
                         if ( i > 0 ) wext->inplanes = i ;
                         write_text( bobj, obj, wdlg->popup_nplanes[wext->inplanes].ob_spec.free_string ) ;
                         setup_details( wnd, 1 ) ;
                         deselect( bobj, obj ) ;
                         xobjc_draw( wnd->window_handle, bobj, obj ) ;
                         break ;

     case LDVD_CLOSE   : code = IDCANCEL ;
                         break ;
  }

  if ( code == IDOK )
  {

  }

  return( code ) ;
}
Exemplo n.º 16
0
	// Affiche tous les objets et vérifie que la fonction init_graphics 
	// a été appelée précédemment et affiche un message d'erreur sinon.	
void affiche_all()
	{
	SDL_Event event;
	if (SDL_PollEvent(&event)) if (event.type == SDL_QUIT) exit(0);
	if (__init_graphics_is_already_called == 25) SDL_Flip(SDL_screen);
		else {
		     init_graphics(380,80);
		     write_text("init_graphics() n'a pas été appelée.");
		     write_text("");
		     write_text("           Cliquer pour terminer.");
		     fprintf(stderr,"init_graphics() n'a pas été appelée.\n");
		     fprintf(stderr,"Cliquer pour terminer.\n");
		     wait_clic();
		     exit(1);
		     }
	}
Exemplo n.º 17
0
int OnTimerBuyMe(void *w, int mx, int my)
{
  GEM_WINDOW       *wnd = (GEM_WINDOW *) w ;
  WEXTENSION_BUYME *wext = wnd->DlgData->UserData ;
  OBJECT           *adr_shareware = wnd->DlgData->BaseObject ;
  char             buf[50] ;

  wext->nb_sec = (int) ( ( clock() - wext->t0 ) / CLK_TCK ) ;
  if ( wext->nb_sec < SHAREWARE_WAIT )
  {
    sprintf( buf, "%02d", SHAREWARE_WAIT - wext->nb_sec ) ;
    write_text( adr_shareware, SHARE_WAIT, buf ) ;
    xobjc_draw( wnd->window_handle, adr_shareware, SHARE_WAIT ) ;
  }

  if ( wext->nb_sec >= SHAREWARE_WAIT )
  {
    GWKillTimer( wnd ) ;
    adr_shareware[SHARE_WAIT].ob_flags     |= HIDETREE ;
    adr_shareware[SHARE_REGISTER].ob_flags &= ~HIDETREE ;
    adr_shareware[SHARE_CANCEL].ob_flags   &= ~HIDETREE ;
    GWRePaint( wnd ) ;
  }

  return( GW_EVTCONTINUEROUTING ) ;
}
Exemplo n.º 18
0
void update_nav(GEM_WINDOW *wnd)
{
  WBROWSER *wb  = wnd->Extension ;
  OBJECT   *bobj = wnd->DlgData->BaseObject ;
  char     buf[20] ;

  if ( wb->fimg_list )
  {
    bobj[IMGB_PREVIOUS].ob_state &= ~DISABLED ;
    bobj[IMGB_NEXT].ob_state     &= ~DISABLED ;
    bobj[IMGB_EDIT].ob_state     &= ~DISABLED ;
    bobj[IMGB_DELETE].ob_state   &= ~DISABLED ;
  }
  else
  {
    bobj[IMGB_PREVIOUS].ob_state |= DISABLED ;
    bobj[IMGB_NEXT].ob_state     |= DISABLED ;
    bobj[IMGB_EDIT].ob_state     |= DISABLED ;
    bobj[IMGB_DELETE].ob_state   |= DISABLED ;
  }

  if ( wb->pos == 0 ) bobj[IMGB_PREVIOUS].ob_state |= DISABLED ;
  if ( wb->pos == wb->nb_files - 1 ) bobj[IMGB_NEXT].ob_state |= DISABLED ;

  if ( wb->nom[0] ) sprintf( buf, "%d/%d", 1 + wb->pos, wb->nb_files ) ;
  else              buf[0] = 0 ;
  write_text( bobj, IMGB_TEXT2, buf ) ;

  xobjc_draw( wnd->window_handle, bobj, IMGB_PREVIOUS ) ;
  xobjc_draw( wnd->window_handle, bobj, IMGB_NEXT ) ;
  xobjc_draw( wnd->window_handle, bobj, IMGB_TEXT2 ) ;
  xobjc_draw( wnd->window_handle, bobj, IMGB_EDIT ) ;
  xobjc_draw( wnd->window_handle, bobj, IMGB_DELETE ) ;
}
Exemplo n.º 19
0
static size_t
write_text(conversion_context &context, const char *text, size_t length,
	BDataIO *target = NULL) throw (status_t)
{
	size_t prefix = 0;
	if (context.new_line) {
		prefix = context.first_line_indent;
		context.new_line = false;
	}

	if (target == NULL)
		return prefix + length;

	for (uint32 i = 0; i < prefix; i++) {
		write_text(context, " ", 1, target);
	}

	ssize_t written = target->Write(text, length);
	if (written < B_OK)
		throw (status_t)written;
	else if ((size_t)written != length)
		throw (status_t)B_IO_ERROR;

	return prefix + length;
}
Exemplo n.º 20
0
int main (int argc, char* const argv[])
{
  	const char* const socket_name = argv[1];
  	const char* const message = argv[2];
  	int socket_fd;
  	struct sockaddr name;
  	/* Create the socket. */
  	socket_fd = socket (PF_LOCAL, SOCK_STREAM, 0);
	if(socket_fd < 0){
		printf("socket() failed\n");
		exit(ESOCK);
	}
  	/* Store the server’s name in the socket address. */
  	name.sa_family = AF_LOCAL;
  	strcpy (name.sa_data, socket_name);
  	/* Connect the socket. */
  	if(connect (socket_fd, &name, strlen(name.sa_data)) < 0){
		printf("connect failed\n");
		exit(ECONN);
	}
  	/* Write the text on the command line to the socket. */
  	write_text (socket_fd, message);
  	close (socket_fd);
  	return 0;
}
Exemplo n.º 21
0
static void OnDestroy(HWND hwnd)
{
	write_text();
	config_write();
	systray_del(hwnd,1024);
	PostQuitMessage(0);
}
Exemplo n.º 22
0
/*
 * Write current entry
 */
void write_current_entry()
{
	section_data *curr_section = NULL;
	entry_data *curr_entry = NULL;
	book_data *curr_book = NULL;

	// Assert master exists
	g_assert_nonnull(master);

	// If no current selection then
	// Return without warning
	curr_book = master->curr_book;
	if(curr_book == NULL) return;

	curr_section = curr_book->curr_section;
	if(curr_section == NULL) return;

	curr_entry = curr_section->curr_entry;
	if(curr_entry == NULL) return;

	sn_trace("< Writing current entry [%s/%s].",
		curr_section->name, curr_entry->name);

	write_text(curr_book, curr_entry);

	if(curr_entry->need_rename == TRUE) {
		curr_entry->need_rename = FALSE;
		if(options.auto_name_entry == TRUE)
			rename_entry();
	}

	return;
} // Write current entry
Exemplo n.º 23
0
static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op))
{
	ReportList *reports = CTX_wm_reports(C);
	Text *txt;
	char *str;
	
	/* create new text-block to write to */
	txt = add_empty_text("Recent Reports");
	
	/* convert entire list to a display string, and add this to the text-block
	 *	- if commandline debug option enabled, show debug reports too
	 *	- otherwise, up to info (which is what users normally see)
	 */
	str = BKE_reports_string(reports, (G.f & G_DEBUG)? RPT_DEBUG : RPT_INFO);

	if (str) {
		write_text(txt, str);
		MEM_freeN(str);

		return OPERATOR_FINISHED;
	}
	else {
		return OPERATOR_CANCELLED;
	}
}
Exemplo n.º 24
0
void write_num(int x, int y, int v)
{
  char str[24];
  
  sprintf(str, "%d", v);
  write_text(x, y, str);
}
Exemplo n.º 25
0
int main() {
	write_text();
	write_bin();
	write_text2();
	write_bin2();
	return 0;
}
Exemplo n.º 26
0
int
write_objects(FILE *fp)
{
    F_arc	   *a;
    F_compound	   *c;
    F_ellipse	   *e;
    F_line	   *l;
    F_spline	   *s;
    F_text	   *t;

    /*
     * A 2 for the orientation means that the origin (0,0) is at the upper 
     * left corner of the screen (2nd quadrant).
     */

    if (!update_figs)
	put_msg("Writing . . .");
#ifdef I18N
    /* set the numeric locale to C so we get decimal points for numbers */
    setlocale(LC_NUMERIC, "C");
#endif  /* I18N */
    write_fig_header(fp);
    for (a = objects.arcs; a != NULL; a = a->next) {
	num_object++;
	write_arc(fp, a);
    }
    for (c = objects.compounds; c != NULL; c = c->next) {
	num_object++;
	write_compound(fp, c);
    }
    for (e = objects.ellipses; e != NULL; e = e->next) {
	num_object++;
	write_ellipse(fp, e);
    }
    for (l = objects.lines; l != NULL; l = l->next) {
	num_object++;
	write_line(fp, l);
    }
    for (s = objects.splines; s != NULL; s = s->next) {
	num_object++;
	write_spline(fp, s);
    }
    for (t = objects.texts; t != NULL; t = t->next) {
	num_object++;
	write_text(fp, t);
    }
#ifdef I18N
    /* reset to original locale */
    setlocale(LC_NUMERIC, "");
#endif  /* I18N */
    if (ferror(fp)) {
	fclose(fp);
	return (-1);
    }
    if (fclose(fp) == EOF)
	return (-1);


    return (0);
}
Exemplo n.º 27
0
static void draw_loadMenu(int c)
{
	int i,j;
	static int b=0;
	int bb=(b%6)/3;
	SDL_Rect r;
	extern SDL_Surface *text_screen;
	r.x=80-64; r.y=0; r.w=110+64+64; r.h=240;

	text_draw_background();
	text_draw_window(80-64,12,160+64+64,220,text_str_load_title);

	if (text_dir_num_files_index<min_in_dir)
	{
		min_in_dir=text_dir_num_files_index;
		max_in_dir=text_dir_num_files_index+SHOW_MAX_FILES;
	}
	else
		if (text_dir_num_files_index>=max_in_dir)
		{
			max_in_dir=text_dir_num_files_index+1;
			min_in_dir=max_in_dir-SHOW_MAX_FILES;
		}
	if (max_in_dir>text_dir_num_files)
		max_in_dir=text_dir_num_files-min_in_dir;


	for (i=min_in_dir,j=1;i<max_in_dir;i++,j+=2)
	{
		write_text(3,j,text_str_load_separator);

		SDL_SetClipRect(text_screen,&r);

		if ((text_dir_num_files_index==i)&&(bb))
			write_text_inv(4,j+1,(char *)&text_dir_files[i].d_name);
		else
			write_text(4,j+1,(char *)&text_dir_files[i].d_name);

		SDL_SetClipRect(text_screen,NULL);

		if (text_dir_files[i].d_type==4)
			write_text(32,j+1,text_str_load_dir);
	}
	write_text(3,j,text_str_load_separator);
	text_flip();
	b++;
}
Exemplo n.º 28
0
void text_draw_saving(int per, int max)
{
	text_draw_background();
	text_draw_window(80,64,172,36,"Saving");
	text_draw_barra(84, (9*8)+1, 158, 16, per, max);
	write_text(14,9,"Please wait");
	text_flip();
}
Exemplo n.º 29
0
void write_char(lref_t port, _TCHAR ch)
{
     assert(TEXT_PORTP(port) && PORT_OUTPUTP(port));

     write_text(port, &ch, 1);

     if (ch == _T('\n'))
          lflush_port(port);
}
Exemplo n.º 30
0
void ae::write_text( std::vector< ae::Entity > &vec, const std::string &line, EManager &emanager, int line_nr )
{
	// calculate the size of the string, if to long cut it off
	std::vector< std::string > words = ae::split_string( line, ' ' );

	std::string printable;
	std::string rest;

	bool is_there_more = false;

	// Preparing checking if there are multiple lines needed and divide if needed
	if( words.size() > 65 )
	{
		std::cerr << "WARNING: STRING IS TO LONG: " << line << std::endl;
	}
	if( words.size() > 13 )
	{
		for( int i = 0; i < 13; i++ )
		{
			printable.append(words[i]);
			printable.append(" ");
		}
		words.erase(words.begin(), words.begin() + 13);
		is_there_more = true;
	}
	else
	{
		printable = line;
	}

	for( std::string str : words )
	{
		rest.append( str.c_str() );
		rest.append( " " );
	}


	auto entity = emanager.create_entity();
	vec.push_back(entity);
	auto model = ae::Locator::get_loader().load_text( printable );
	auto shader = ae::Locator::get_loader().load_shader( "FontShader" );

	math::mat4 matrix { 1.0f };

	// Fix the position of the lines, y-axis only
	matrix = math::translate( matrix, { -0.8f, (float)(-0.45f - (line_nr * 0.05) ), 0.0f } );
    matrix = math::scale( matrix, { 0.15f, 0.15f, 0.0f } );

	emanager.message( ae::ms::add_position( entity, matrix ) );
	emanager.message( ae::ms::add_render( entity, model, shader ) );

	if(is_there_more)
	{
		write_text( vec, rest, emanager, ++line_nr );
	}
}