예제 #1
0
 Text splitText(int offset) 
 { 
   return Text(tImpl()->splitText(offset)); 
 } // splitText
예제 #2
0
파일: text.cpp 프로젝트: abadd/glTools
glt::Text glt::makeSegoeUI(size_t buffers, size_t capacity)
{
    auto bitmap = glt::BitmapFont(segoeui.data(), segoeui.size());
    return Text(bitmap, buffers, capacity);
}
예제 #3
0
파일: URLView.cpp 프로젝트: bbjimmy/YAB
void URLView::DoPersonDrag() {
	// Handle all of the bookmark dragging.  This includes setting up
	// the drag message and drawing the dragged bitmap.
	
	// Set up the drag message to support both BTextView dragging (using
	// the e-mail address) and file dropping (to Tracker).
	BMessage *dragMessage = new BMessage( B_MIME_DATA );
	dragMessage->AddInt32( "be:actions", B_COPY_TARGET );
	dragMessage->AddString( "be:types", "application/octet-stream" );
	dragMessage->AddString( "be:filetypes", "application/x-person" );
	dragMessage->AddString( "be:type_descriptions", "person" );
	dragMessage->AddString( "be:clip_name", Text() );
	
	// This allows the user to drag the e-mail address into a
	// standard BTextView.
	BString email = GetImportantURL();
	dragMessage->AddData( "text/plain", B_MIME_DATA, email.String(),
						  email.Length() + 1 );
	
	// Query for the system's icon for bookmarks.
	BBitmap *personIcon = new BBitmap( BRect( 0, 0, iconSize - 1,
									   iconSize - 1 ), B_CMAP8 );
	#ifdef ZETA
		BMimeType mime( "application/x-vnd.Be-PEPL" );
	#else
		BMimeType mime( "application/x-person" );
	#endif
	if( iconSize == 16 ) mime.GetIcon( personIcon, B_MINI_ICON );
	else mime.GetIcon( personIcon, B_LARGE_ICON );
	
	// Find the size of the bitmap to drag.  If the text is bigger than the
	// icon, use that size.  Otherwise, use the icon's.  Center the icon
	// vertically in the bitmap.
	BRect rect = GetTextRect();
	rect.right += iconSize + 4;
	if( (rect.bottom - rect.top) < iconSize ) {
		int adjustment = (int) ((iconSize - (rect.bottom - rect.top)) / 2) + 1;
		rect.top -= adjustment;
		rect.bottom += adjustment;
	}
	
	// Make sure the rectangle starts at 0,0.
	rect.bottom += 0 - rect.top;
	rect.top = 0;
	
	// Create the bitmap to draw the dragged image in.
	BBitmap *dragBitmap = new BBitmap( rect, B_RGBA32, true );
	BView *dragView = new BView( rect, "Drag View", 0, 0 );
	dragBitmap->Lock();
	dragBitmap->AddChild( dragView );
	
	BRect frameRect = dragView->Frame();
	
	// Make the background of the dragged image transparent.
	dragView->SetHighColor( B_TRANSPARENT_COLOR );
	dragView->FillRect( frameRect );

	// We want 'g's, etc. to go below the underline.  When the BeOS can
	// do underlining of any font, this code can be removed.
	font_height height;
	GetFontHeight( &height );
	float descent = height.descent;

	// Find the vertical center of the view so we can vertically
	// center everything.
	int centerPixel = (int) ((frameRect.bottom - frameRect.top) / 2);
	int textCenter  = (int) (descent + underlineThickness) + centerPixel;

	// We want to draw everything only half opaque.
	dragView->SetDrawingMode( B_OP_ALPHA );
	dragView->SetHighColor( 0.0, 0.0, 0.0, 128.0 );
	dragView->SetBlendingMode( B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE );

	// Center the icon in the view.
	dragView->MovePenTo( BPoint( frameRect.left,
								 centerPixel - (iconSize / 2) ) );
	dragView->DrawBitmap( personIcon );

	// Draw the text in the same font (size, etc.) as the link view.
	// Note:  DrawString() draws the text at one pixel above the pen's
	//		  current y coordinate.
	BFont font;
	GetFont( &font );
	dragView->SetFont( &font );
	dragView->MovePenTo( BPoint( frameRect.left + iconSize + 4, textCenter ) );
	dragView->DrawString( Text() );
	
	// Be sure to flush the view buffer so everything is drawn.
	dragView->Flush();
	dragBitmap->Unlock();
	
	// The Person icon adds some width to the bitmap that we are
	// going to draw.  So horizontally offset the bitmap proportionally
	// to where the user clicked on the link.
	float horiz = dragOffset.x / GetTextRect().Width();
	dragOffset.x = horiz * frameRect.right;

	DragMessage( dragMessage, dragBitmap, B_OP_ALPHA,
				 BPoint( dragOffset.x,
				 		 (rect.Height() + underlineThickness) / 2 + 2), this );
	delete dragMessage;

	draggedOut = true;
}
예제 #4
0
void SpatiaLiteDB::queryGeometry(
		std::string table,
		std::string geometry_col,
		double left,
		double bottom,
		double right,
		double top,
		std::string label_col) {

	_pointlist.clear();
	_linestringlist.clear();
	_polygonlist.clear();
	bool getLabel = label_col.size() != 0;

	// Search for geometry and name

	// The query will be either
	//
	// SELECT Geometry FROM  table WHERE MbrWithin(Column, BuildMbr(left, bottom, right, top));
	//    or
	// SELECT Geometry,Label FROM  table WHERE MbrWithin(Column, BuildMbr(left, bottom, right, top));
	//
	// where Geometry is the geometry column name and Label is the column containing a name or label.
	std::string label;
	if (getLabel) {
		label = "," + label_col;
	}
	std::stringstream s;
	s <<
		 "SELECT "           <<
		 geometry_col        <<
		 label               <<
		 " FROM "            <<
		 table               <<
		 " WHERE  MbrIntersects(" <<
		 geometry_col        <<
		 ", BuildMbr("         <<
		 left                <<
		 ","                 <<
		 bottom              <<
		 ","                 <<
		 right               <<
		 ","                 <<
		 top                 <<
		 "));";

	// prepare the query
	prepare(s.str());

	// fetch the next result row
	while (step()) {
		// get the geometry
		gaiaGeomCollPtr geom = Geom(0);
		// get the label, if we asked for it
		std::string label;
		if (getLabel) {
			label = Text(1);
		}
		// the following will create lists for points, lines and polygons found in
		// a single geometry. In practice it seems that only one of those types
		// exists for a given geometry, but it's not clear if this is a requirement
		// or just occurs in the sample databases we have been working with.
		PointList points = point_list(geom, label);
		for (PointList::iterator i = points.begin(); i != points.end(); i++) {
			_pointlist.push_back(*i);
		}
		LinestringList lines = linestring_list(geom, label);
		for (LinestringList::iterator i = lines.begin(); i != lines.end(); i++) {
			_linestringlist.push_back(*i);
		}
		PolygonList polys = polygon_list(geom, label);
		for (PolygonList::iterator i = polys.begin(); i != polys.end(); i++) {
			_polygonlist.push_back(*i);
		}
	}

	// finish with this query
	finalize();
}
예제 #5
0
파일: text.cpp 프로젝트: abadd/glTools
glt::Text glt::makeConsolas(size_t buffers, size_t capacity)
{
    auto bitmap = glt::BitmapFont(consolas.data(), consolas.size());
    return Text(bitmap, buffers, capacity);
}
예제 #6
0
const Compound operator+(const Item &a, const char * const text)
{
    return Compound(a, Text(text));
}
예제 #7
0
//Convenience constructor so you can say Item("foo")
Item::Item(const char * const text) : generator(Text(QByteArray(text)).generator) {}
예제 #8
0
void Text(LNGID MsgId)
{
    Text(MSG(MsgId));
}
예제 #9
0
void HiText(const string& Str,const FarColor& HiColor,int isVertText)
{
    string strTextStr;
    FarColor SaveColor;
    strTextStr = Str;
    size_t pos = strTextStr.find(L'&');

    if (pos == string::npos)
    {
        if (isVertText)
            VText(strTextStr);
        else
            Text(strTextStr);
    }
    else
    {
        /*
           &&      = '&'
           &&&     = '&'
                      ^H
           &&&&    = '&&'
           &&&&&   = '&&'
                      ^H
           &&&&&&  = '&&&'
        */
        const wchar_t *ChPtr = strTextStr.data() + pos;
        int I=0;
        const wchar_t *ChPtr2=ChPtr;

        while (*ChPtr2++ == L'&')
            ++I;

        if (I&1) // нечет?
        {
            string LeftPart(strTextStr.data(), pos);

            if (isVertText)
                VText(LeftPart);
            else
                Text(LeftPart); //BUGBUG BAD!!!

            if (ChPtr[1])
            {
                wchar_t Chr[]= {ChPtr[1],0};
                SaveColor=CurColor;
                SetColor(HiColor);

                if (isVertText)
                    VText(Chr);
                else
                    Text(Chr);

                SetColor(SaveColor);
                string strText = (ChPtr+1);
                ReplaceStrings(strText,L"&&",L"&",-1);

                if (isVertText)
                    VText(strText.data()+1);
                else
                    Text(strText.data()+1);
            }
        }
        else
        {
            ReplaceStrings(strTextStr,L"&&",L"&",-1);

            if (isVertText)
                VText(strTextStr);
            else
                Text(strTextStr); //BUGBUG BAD!!!
        }
    }
}
예제 #10
0
template <> void XMLWriter_Element::Text<const wchar_t*>(const wchar_t* text, bool cdata)
{
	Text( CStrW(text).ToUTF8().c_str(), cdata );
}
예제 #11
0
void DrawLine(int Length,int Type, const wchar_t* UserSep)
{
    if (Length>1)
    {
        string Buffer = MakeSeparator(Length, Type, UserSep);
        // 12 - UserSep horiz
        // 13 - UserSep vert
        (Type >= 4 && Type <= 7) || (Type >= 10 && Type <= 11) || Type == 13? VText(Buffer) : Text(Buffer);
    }
}
예제 #12
0
// FloatValue
float
NummericalTextView::FloatValue() const
{
	fFloatValueCache = atof(Text());
	return fFloatValueCache;
}
예제 #13
0
// IntValue
int32
NummericalTextView::IntValue() const
{
	fIntValueCache = atoi(Text());
	return fIntValueCache;
}
예제 #14
0
파일: Layouts.c 프로젝트: PsyPhy/GripMMI
void LayoutTitle (Layout layout, char *string, int x, int y, double dir) {

  float	 x_sense, y_sense, x_offset;

  Display display = layout->display;
  
  char   temp[1024], *line;
  unsigned int    lines = 1, i;
  int    right_justify = FALSE, center_justify = FALSE;
  
  /* Handle carriage returns. */
  for ( i = 0; i < strlen( string ); i++ ) {
    if ( string[i] == '\n' ) lines++;
  }
  
  x_sense = layout->display_right > layout->display_left ? 1 : -1;
  y_sense = layout->display_bottom > layout->display_top ? 1 : -1;
  
  /*
  A value less than 0 for x or y implies a keyword.
  */
  if (x < 0) {
    
    switch ( (int) x ) {
      
    case (INSIDE_LEFT):
      x = layout->display_left;
      break;
      
    case (OUTSIDE_LEFT):
      x = layout->display_left - x_sense;
      right_justify = TRUE;
      /*	x_sense * TextWidth(display, string); */
      break;
      
    case (INSIDE_RIGHT):
      x = layout->display_right - 1;
      right_justify = TRUE;
      /*	x_sense * TextWidth(display, string); */
      break;
      
    case (OUTSIDE_RIGHT):
      x = layout->display_right;
      break;
      
    case (CENTER):
      x = ( layout->display_left + layout->display_right 
        - x_sense * TextWidth(display, string)) / 2;
      
      center_justify = TRUE;
      break;
      
    default:
      fprintf(stderr, "Unknown title x alignment code: %d\n", x);
      break;
      
    }
  }
  
  if (y < 0) {
    
    switch ( (int) y ) {
      
    case (INSIDE_BOTTOM):
      y = layout->display_bottom -
        y_sense * ( lines - 1) * TextHeight(display, string);
      break;
      
      
    case (OUTSIDE_BOTTOM):
      y = layout->display_bottom + 
        y_sense * ( TextHeight(display, string) - 2 );
      break;
      
    case (INSIDE_TOP):
      y = layout->display_top +
        y_sense * TextHeight(display, string);
      break;
      
    case (OUTSIDE_TOP):
      y = layout->display_top;
      break;
      
    case (CENTER):
      y = ( layout->display_bottom + layout->display_top 
        + y_sense * lines * TextHeight(display, string)) / 2;
      break;
      
    default:
      fprintf(stderr, "Unknown title y alignment code: %d\n", y);
      break;
      
    }
  }
  
  strcpy( temp, string );
  line = strtok( temp, "\n" );
  while ( line ) {
    if ( right_justify ) x_offset = - x_sense * TextWidth( display, line );
    else if ( center_justify ) x_offset = ( - x_sense * TextWidth( display, line )) / 2.0;
    else x_offset = 0;
    Text( display, line, x + x_offset, y, dir);
    y += y_sense * TextHeight(display, line);
    line = strtok( 0, "\n" );
  }
}
예제 #15
0
	// Get integer value
	long Value(void)
	{
		return atol(Text());
	}
예제 #16
0
void Painter::Text (Canvas* c, const char* s) {
    int len = strlen(s);
    Text(c, s, len, curx, cury);
    curx += font->Width(s, len);
}
예제 #17
0
// ApplyChanges
void
PopupTextView::ApplyChanges(int32 next)
{
	fPopup->TextEdited(Text(), next);
}
예제 #18
0
void Painter::Text (Canvas* c, const char* s, int len) {
    Text(c, s, len, curx, cury);
    curx += font->Width(s, len);
}
예제 #19
0
const Compound operator+(const char * const text, const Item &b)
{
    return Compound(Text(text), b);
}
예제 #20
0
void Painter::Text (Canvas* c, const char* s, Coord x, Coord y) {
    Text(c, s, strlen(s), x, y);
}
예제 #21
0
파일: scrsaver.cpp 프로젝트: elfmz/far2l
static void ShowSaver(int Step)
{
	for (size_t I=0; I<ARRAYSIZE(Star); I++)
		if (Star[I].Type!=STAR_NONE && !(Step%Star[I].Speed))
		{
			SetColor(F_LIGHTCYAN|B_BLACK);
			GotoXY(Star[I].X/100,Star[I].Y/100);
			Text(L" ");
			int dx=Star[I].X/100-ScrX/2;
			Star[I].X+=dx*10+((dx<0) ? -1:1);
			int dy=Star[I].Y/100-ScrY/2;
			Star[I].Y+=dy*10+((dy<0) ? -1:1);

			if (Star[I].X<0 || Star[I].X/100>ScrX || Star[I].Y<0 || Star[I].Y/100>ScrY)
				Star[I].Type=STAR_NONE;
			else
			{
				SetColor(Star[I].Color|B_BLACK);
				GotoXY(Star[I].X/100,Star[I].Y/100);

				if (abs(dx)>3*ScrX/8 || abs(dy)>3*ScrY/8)
				{
					if (Star[I].Type==STAR_PLANET)
					{
						SetColor(Star[I].Color|FOREGROUND_INTENSITY|B_BLACK);
						Text(StarSymbol[0]);
					}
					else
					{
						SetColor(F_WHITE|B_BLACK);
						Text(StarSymbol[1]);
					}
				}
				else if (abs(dx)>ScrX/7 || abs(dy)>ScrY/7)
				{
					if (Star[I].Type==STAR_PLANET)
					{
						SetColor(Star[I].Color|FOREGROUND_INTENSITY|B_BLACK);
						Text(StarSymbol[1]);
					}
					else
					{
						if (abs(dx)>ScrX/4 || abs(dy)>ScrY/4)
							SetColor(F_LIGHTCYAN|B_BLACK);
						else
							SetColor(F_CYAN|B_BLACK);

						Text(StarSymbol[2]);
					}
				}
				else
				{
					if (Star[I].Type==STAR_PLANET)
					{
						SetColor(Star[I].Color|B_BLACK);
						Text(StarSymbol[3]);
					}
					else
					{
						SetColor(F_CYAN|B_BLACK);
						Text(StarSymbol[4]);
					}
				}
			}
		}

	for (size_t I=0; I<ARRAYSIZE(Star); I++)
		if (Star[I].Type==STAR_NONE)
		{
			static const int Colors[]={F_MAGENTA,F_RED,F_BLUE};
			Star[I].Type=random(77)<3 ? STAR_PLANET:STAR_NORMAL;
			Star[I].X=(ScrX/2-ScrX/4+random(ScrX/2))*100;
			Star[I].Y=(ScrY/2-ScrY/4+random(ScrY/2))*100;
			Star[I].Color=Colors[random(ARRAYSIZE(Colors))];
			Star[I].Speed=(Star[I].Type==STAR_PLANET) ? 1:2;
			break;
		}
}
예제 #22
0
static int get_key(AIN_DeviceID ID, int *keycode, int *offset)
{
    static char *window_text;
    struct Window *window;
    AIN_InputEvent *event;
    int done = 0;

    window_text = translate_text(IDS_PRESS_KEY_BUTTON);
    *keycode = *offset = -1; /* no key */

    if (ID != -1) {
        ai_handle[0] = AIN_ObtainDevice(CTX, ID);
        if (ai_handle[0] != NULL) {
            AIN_SetDeviceParameter(CTX, ai_handle[0], AINDP_EVENT, TRUE);
        }
    }

    window = OpenWindowTags(NULL,
                            WA_Title, (ULONG)"",
                            WA_Flags, WFLG_NOCAREREFRESH|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_RMBTRAP|WFLG_GIMMEZEROZERO,
                            WA_IDCMP, IDCMP_CLOSEWINDOW|WFLG_REPORTMOUSE|IDCMP_RAWKEY|IDCMP_CHANGEWINDOW,
                            WA_Left, 100,
                            WA_Top, 100,
                            WA_Width, 100,
                            WA_Height, 40,
                            WA_Activate, TRUE,
                            TAG_DONE);

    if (window != NULL) {
        struct IntuiMessage *imsg = NULL;
        ULONG imCode, imClass;

        /* Resize window and set pens */
        int length = TextLength(window->RPort, window_text, strlen(window_text));

        ChangeWindowBox(window, 100, 100, window->BorderLeft+length+window->BorderRight+8, window->BorderTop+window->IFont->tf_YSize*2+window->BorderBottom);
        SetAPen(window->RPort, 1);
        SetBPen(window->RPort, 0);

        /* Wait until window has been resized */
        while (done == 0) {
            /* Wait for messages */
            Wait((1L << window->UserPort->mp_SigBit) | (1L << ai_port->mp_SigBit));

            /* Check for IDCMP messages */
            while ((imsg = (struct IntuiMessage *)GetMsg(window->UserPort))) {
                imClass = imsg->Class;
                imCode = imsg->Code;

                ReplyMsg((struct Message *)imsg);

                if (imClass == IDCMP_CHANGEWINDOW) {
                    Move(window->RPort, 4, window->IFont->tf_YSize);
                    Text(window->RPort, window_text, strlen(window_text));
                } else if (imClass == IDCMP_RAWKEY) {
                    imCode &= 0x7f;
                    if (imCode != 69) {
                        *keycode = imCode;
                    }
                    done = 1; /* KEY ok */
                } else if (imClass == IDCMP_CLOSEWINDOW) {
                    done = -1; /* cancel */
                }
            }

            /* Check for AI messages */
            if (ai_handle[0] != NULL) {
                while ((event = AIN_GetEvent(CTX))) {
                    switch(event->Type) {
                        case AINET_AXIS:
                            if ((event->Value >= (ONOFF_VALUE)) || (event->Value <= (-(ONOFF_VALUE)))) {
                                *offset = event->Index;
                                done = 2; /* AI ok */
                            }
                            break;
                        case AINET_BUTTON:
                            *offset = event->Index;
                            done = 2; /* AI ok */
                            break;
                        case AINET_HAT:
                            *offset = event->Index;
                            done = 2; /* AI ok */
                            break;
                        default:
                            break;
                    }

                    AIN_FreeEvent(CTX, event);
                }
            }
        }
        CloseWindow(window);
    }

    if (ai_handle[0] != NULL) {
        AIN_SetDeviceParameter(CTX, ai_handle[0], AINDP_EVENT, FALSE);
        /* Remove pending AI messages */
        while ((event = AIN_GetEvent(CTX))) {
            AIN_FreeEvent(CTX, event);
        }
        AIN_ReleaseDevice(CTX, ai_handle[0]);
        ai_handle[0] = NULL;
    }

    return done;
}
예제 #23
0
파일: dumpfont.c 프로젝트: MarginC/kame
main()
{
  unsigned char str[256], *pp;
  int i;
  struct TextAttr ta = { "topaz.font", 8, FS_NORMAL, FPF_ROMFONT };
  struct RastPort rp;
  struct BitMap bm = { 256, 	/* bytes per row */
		         8,	/* rows */
			 0,	/* flags */
			 1,	/* depth */
			 0,	/* pad */
			 0 };	/* planes */
  struct TextFont *tf;

  InitRastPort (& rp);
  rp.BitMap = &bm;
  bm.Planes[0] = pp = AllocRaster (256 * 8, 8);

  if (!pp)
    {
      fprintf (stderr, "Can't allocate raster!\n");
      exit (1);
    }
  bzero (pp, 256 * 8);
  
  tf = OpenFont (& ta);
  if (! tf)
    {
      fprintf (stderr, "can't open topaz font.\n");
      exit (1);
    }

  SetFont (&rp, tf);

  /* initialize string to be printed */
  for (i = 32; i < 256; i++) str[i - 32] = i;

  Move (&rp, 0, 6);
  
  Text (&rp, str, 256 - 32);
  {
    int bin = open ("bitmap", 1);
    if (bin >= 0)
      {
        write (bin, pp, 256*8);
        close (bin);
      }
  }
  
  /* dump them.. */
  printf ("/* generated automatically by dumpfont.c. *DONT* distribute\n");
  printf ("   this file, it contains information Copyright by Commodore!\n");
  printf ("\n");
  printf ("   This is the (new) topaz80 system font: */\n\n");
  
  printf ("unsigned char kernel_font_width  = 8;\n");
  printf ("unsigned char kernel_font_height = 8;\n");
  printf ("unsigned char kernel_font_lo = 32;\n");
  printf ("unsigned char kernel_font_hi = 255;\n\n");
  
  printf ("unsigned char kernel_cursor[] = {\n");
  printf ("  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };\n\n");
  printf ("unsigned char kernel_font[] = {\n");
  
  for (i = 0; i < 256 - 32; i++)
    {
      printf ("/* %c */ ", i + 32);
      printf ("0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x,\n",
      	      pp[i+0*256], pp[i+1*256], pp[i+2*256], pp[i+3*256],
      	      pp[i+4*256], pp[i+5*256], pp[i+6*256], pp[i+7*256]);
    }
  printf ("};\n");
  
  CloseFont (tf);
  FreeRaster (pp, 256 * 8, 8);
}
예제 #24
0
IPTR GTText__GM_RENDER(Class *cl, struct Gadget *g, struct gpRender *msg)
{
    UWORD 		*pens = msg->gpr_GInfo->gi_DrInfo->dri_Pens;
    UBYTE 		textbuf[256], *str;
    struct TextData 	*data = INST_DATA(cl, g);
    WORD 		left, left2, top, width, height, numchars, tlength;
    struct TextFont 	*oldfont;
    struct RastPort 	*rp = msg->gpr_RPort;
    
    EnterFunc(bug("Text::Render()\n"));

    left   = g->LeftEdge;
    top    = g->TopEdge;
    width  = g->Width;
    height = g->Height;

    if (msg->gpr_Redraw == GREDRAW_REDRAW)
    {
        if (data->frame)
	{
	    DrawImageState(msg->gpr_RPort,
		    (struct Image *)data->frame,
		    left,
		    top,
		    IDS_NORMAL,
		    msg->gpr_GInfo->gi_DrInfo);
	}
	
	renderlabel(GadToolsBase, g, msg->gpr_RPort, data->labelplace);
    }
    
    if (data->toprint || (data->gadgetkind != TEXT_KIND))
    {
	/* preserve font */
	oldfont = rp->Font;
	SetFont(rp, data->font);

	str = textbuf;
	if (data->gadgetkind == TEXT_KIND)
	{
	    strncpy(str, (char *)data->toprint, sizeof(textbuf));
	    textbuf[sizeof(textbuf) - 1] = '\0';
	}
	else /* NUMERIC_KIND or label of SLIDER_KIND */
	{
	    RawDoFmt(data->format, &(data->toprint), (VOID_FUNC)AROS_ASMSYMNAME(puttostr), &str);
	}

	D(bug("Text formatted into: %s\n", textbuf));
	numchars = strlen(textbuf);

	if (data->flags & TEXTF_BORDER)
	{
    	    left += VBORDER + 1;
    	    top  += HBORDER + 1;
    	    width  = g->Width -  (VBORDER + 1) * 2;
    	    height = g->Height - (HBORDER + 1) * 2;
	}

	if (data->flags & TEXTF_CLIPPED)
	{
    	    struct TextExtent te;

    	    /* See how many chars fits into the display area */
    	    numchars = TextFit(rp, textbuf, numchars, &te, NULL, 1, width, g->Height);
	}

	tlength = TextLength(rp, textbuf, numchars);

	left2 = left;
	switch (data->justification)
	{
    	    case GTJ_LEFT:
    		break;
    	    case GTJ_RIGHT:
    		left2 += (width - tlength);
    		break;
    	    case GTJ_CENTER:
    		left2 += ((width - tlength) / 2);
    		break;
	}

	/* Render text */
	D(bug("Rendering text of lenghth %d at (%d, %d)\n", numchars, left, top));
	SetABPenDrMd(rp, pens[data->backpen], pens[data->backpen], JAM2);
	RectFill(rp, left, top, left + width - 1, top + height - 1);
	SetAPen(rp, pens[data->frontpen]);

	Move(rp, left2, 
    	     top + ((height - data->font->tf_YSize) / 2) + data->font->tf_Baseline);
	Text(rp, textbuf, numchars);

	SetFont(rp, oldfont);

    } /* if (data->toprint || (data->gadgetkind != TEXT_KIND)) */
    
    ReturnInt("Text::Render", IPTR, 0);
}
예제 #25
0
파일: text.cpp 프로젝트: abadd/glTools
glt::Text glt::makeConsolas(size_t buffers, size_t capacity, const Shader & fragmentShader)
{
    auto bitmap = glt::BitmapFont(consolas.data(), consolas.size());
    return Text(bitmap, buffers, capacity, fragmentShader);
}
예제 #26
0
// main game logic goes in here 
void GamePlay::Game()
{
	Checks ck1;
	Checks ck2;
	Checks ck3;
	Poker a;
	

	int x = 24;
	int y = 3;

	duringhand = true;



	if (g == 0)
	{
		PlayerHandValue = 0;
		CpuHandValue = 0;
		result = "";

		system("cls");
		showc = false;
		shows = false;
		foldc = false;
		fold = " ";
		a.createhand(hand, 25, 40);
		a.createtable(tablehand, 5, 17);  // this will create the table, passing in the table hand, always pass in 5 and 7 for location
		Cards();//creating the hands  
		a.drawdefaultcpu(cpuhand, x, y);
		PlayerHandValue = ck1.DetermineHand(PlayerValues, psuits);// determine the player hand storing value in PlayerHandValue
		CpuHandValue = ck1.DetermineHand(cvalues, csuits);// determine the cpu hand storing value in CpuHandValue
		if (!showc)
		{
			chand = "?????";
		}
		if (!shows)
		{
			PressEnterToContinue = " ";
		}
		if (!foldc)
		{
			fold = " ";
		}
		random = rand() % 10;
		if (random < 3)
		{
			CpuFold(CpuHandValue);
		}
		Text(); // method to display the text on screen
		//
		//betting logic

		// method for cpu betting logic, passing in CpuHandValue to determine what it does
		bet = menu(); // storing the variable returned from menu class to bet
		Betting(bet); // player betting method passing in the value stored at bet
		CpuBetting(bet);


		g++;
		Game();
	}
	if (g == 1)
	{
		PlayerHandValue = 0;
		CpuHandValue = 0;
		result = "";
		system("cls");
		a.createhand(hand, 25, 40);
		if (!allin)
		{
			a.tablecards(deck, 9);
		}
		a.createtable(tablehand, 5, 17);
		a.createtable(tablehand, 5, 17);// this will create the table, passing in the table hand, always pass in 5 and 7 for location
		Cards();//creating the hands  
		a.drawdefaultcpu(cpuhand, x, y);
		PlayerHandValue = ck2.DetermineHand(PlayerValues, psuits);// determine the player hand storing value in PlayerHandValue
		CpuHandValue = ck2.DetermineHand(cvalues, csuits);// determine the cpu hand storing value in CpuHandValue
		if (!showc)
		{
			chand = "?????";
		}
		if (!shows)
		{
			PressEnterToContinue = " ";
		}
		if (!foldc)
		{
			fold = " ";
		}
		random = rand() % 10;
		if (random < 3)
		{
			CpuFold(CpuHandValue);
		}
		Text(); // method to display the text on screen
		//
		bet = menu(); // storing the variable returned from menu class to bet
		Betting(bet); // player betting method passing in the value stored at bet
		CpuBetting(bet);

		g = 2;
		//Game();
	}
	if (g == 2)
	{
		PlayerHandValue = 0;
		CpuHandValue = 0;
		result = "";

		system("cls");
		a.createhand(hand, 25, 40);
		if (!allin)
		{
			a.tablecards(deck, 10);
		}
		a.createtable(tablehand, 5, 17);  // this will create the table, passing in the table hand, always pass in 5 and 7 for location
		Cards();//creating the hands  
		a.drawdefaultcpu(cpuhand, x, y);
		PlayerHandValue = ck3.DetermineHand(PlayerValues, psuits);// determine the player hand storing value in PlayerHandValue
		CpuHandValue = ck3.DetermineHand(cvalues, csuits);// determine the cpu hand storing value in CpuHandValue
		if (!showc)
		{
			chand = "?????";
		}
		if (!shows)
		{
			PressEnterToContinue = " ";
		}
		if (!foldc)
		{
			fold = " ";
		}

		random = rand() % 10;
		if (random < 3)
		{
			CpuFold(CpuHandValue);
		}
		Text(); // method to display the text on screen
		//
		bet = menu(); // storing the variable returned from menu class to bet
		Betting(bet); // player betting method passing in the value stored at bet
		CpuBetting(bet);

		g = 3;
		//Game();
	}
	if (g == 3)
	{
		thirdhand();
	}
}
예제 #27
0
파일: text.cpp 프로젝트: abadd/glTools
glt::Text glt::makeSegoeUI(size_t buffers, size_t capacity, const Shader & fragmentShader)
{
    auto bitmap = glt::BitmapFont(segoeui.data(), segoeui.size());
    return Text(bitmap, buffers, capacity, fragmentShader);
}
예제 #28
0
void GamePlay::thirdhand()
{
	Checks b;
	PlayerHandValue = 0;
	CpuHandValue = 0;
	result = "";
	int x = 24;
	int y = 3;
	showc = true;
	shows = true;
	PressEnterToContinue = "Press Enter To Continue...";

	Checks ck;
	Poker a;
	Aesthetics cb;
	system("cls");
	a.createhand(hand, 25, 40);
	a.createtable(tablehand, 5, 17);  // this will create the table, passing in the table hand, always pass in 5 and 7 for location
	Cards();
	a.createtable(cpuhand, x, y);//creating the hands  
	PlayerHandValue = ck.DetermineHand(PlayerValues, psuits);// determine the player hand storing value in PlayerHandValue
	CpuHandValue = ck.DetermineHand(cvalues, csuits);// determine the cpu hand storing value in CpuHandValue

	if (foldv)
	{
		PlayerHandValue = 0;
	}
	ck.determine(PlayerHandValue, CpuHandValue);
	if (showc)
	{
		chand = chand;
	}
	if (shows)
	{
		PressEnterToContinue = PressEnterToContinue;
	}
	if (!foldc)
	{
		fold = " ";
	}
	if (foldc == true)
	{
		//fold = "YOU LOSE!";
	}
	Text(); // method to display the text on screen
	cin.get();
	cout << chand;
	g = 0;
	duringhand = true;
	if (!duringhand)
	{
		cb.text1("You Ran Out of Money!");
		cin.get();
		system("cls");
		Clear();
		NGameMenu();
	}
	if (cash == 0)
	{
		Clear();
		system("cls");
		NGameMenu();
	}
	if (cpucash == 0)
	{
		system("cls");
		Aesthetics a;
		a.textattr(13);
		cout << " " << endl;
		cout << " " << endl;
		cout << "               /////////////////////////////////////////////////" << endl;
		cout << "               // "; a.textattr(3); cout << "*         *  *           *        *       * "; a.textattr(13); cout << "//" << endl;
		cout << "               //    "; a.textattr(3); cout << " * "; a.textattr(6); cout << "    CPU RAN OUT OF MONEY!         "; a.textattr(3); cout << "*   "; a.textattr(13); cout << "//" << endl;
		cout << "               // "; a.textattr(3); cout << "*                                     *     "; a.textattr(13); cout << "//" << endl;
		cout << "               //   "; a.textattr(3); cout << "*          "; a.textattr(6); cout << "You Win!                     "; a.textattr(3); cout << "* "; a.textattr(13); cout << "//" << endl;
		cout << "               //  "; a.textattr(3); cout << "*   "; a.textattr(3); cout << "*                             *    *   "; a.textattr(13); cout << "//" << endl;
		a.textattr(13); cout << "               //"; a.textattr(3); cout << "*********************************************"; a.textattr(13); cout << "//" << endl;
		a.textattr(13); cout << "               /////////////////////////////////////////////////" << endl;
		cout << " " << endl;
		cout << " " << endl;
		cout << " " << endl;
		NGameMenu2();
	}
	NewHand();

}
예제 #29
0
파일: osdbase.c 프로젝트: flensrocker/vdr
void cOsdItem::SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, bool Current, bool Selectable)
{
  DisplayMenu->SetItem(Text(), Index, Current, Selectable);
}
예제 #30
0
// return the value in the text control
wxString wxGridCellPathEditor::GetValue() const
{
  return Text()->GetValue();
}