public static extern IntPtr TTF_RenderUTF8_BlendedNative(IntPtr font, IntPtr text, SDL.SDL_Color fg);
public SDLSurface RenderGlyph_Shaded(char Ch, SDL.SDL_Color Fg, SDL.SDL_Color Bg) { return(new SDLSurface(SDL_ttf.TTF_RenderGlyph_Shaded(myPtr, Ch, Fg, Bg))); }
private static extern IntPtr INTERNAL_TTF_RenderUTF8_Solid( IntPtr font, byte[] text, SDL.SDL_Color fg );
public IntPtr RenderUNICODE_SolidPtr(string Text, SDL.SDL_Color Fg) { return(SDL_ttf.TTF_RenderUNICODE_Solid(myPtr, Text, Fg)); }
//Render_UNICODE_Shaded public SDLSurface RenderUNICODE_Shaded(string Text, SDL.SDL_Color Fg, SDL.SDL_Color Bg) { return(new SDLSurface(SDL_ttf.TTF_RenderUNICODE_Shaded(myPtr, Text, Fg, Bg))); }
public static extern IntPtr TTF_RenderGlyph_Shaded( IntPtr font, ushort ch, SDL.SDL_Color fg, SDL.SDL_Color bg );
private static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Blended_Wrapped( IntPtr font, byte *text, SDL.SDL_Color fg, uint wrapped );
public bool load(string filename_ttf, UInt32 pointSize, SDL.SDL_Color color, int style = SDL_ttf.TTF_STYLE_NORMAL) { SDL_FontCache.FC_ClearFont(font); return(SDL_FontCache.FC_LoadFont(font, filename_ttf, (int)pointSize, color, style) != 0); }
public SDL2_GPU.GPU_Rect draw(SDL2_GPU.GPU_Target_PTR dest, float x, float y, ref SDL.SDL_Color color, string formatted_text) { if (formatted_text == null) { return(SDL2_GPU.GPU_MakeRect(x, y, 0, 0)); } return(SDL_FontCache.FC_DrawColor(font, dest, x, y, color, formatted_text, __arglist())); }
public NFont(IntPtr ttf, ref SDL.SDL_Color color) { init(); load(ttf, color); }
public NFont(string filename_ttf, UInt32 pointSize, ref SDL.SDL_Color color, int style = SDL_ttf.TTF_STYLE_NORMAL) { init(); load(filename_ttf, pointSize, color, style); }
static int Main(string[] args) { SDL.SDL_SetHint(SDL.SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING, "1"); Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; //Start up SDL and create window var success = init(); if (success == false) { Console.WriteLine("Failed to initialize!"); } else { //Load media success = loadMedia(); if (success == false) { Console.WriteLine("Failed to load media!"); } else { //Main loop flag bool quit = false; //Event handler SDL.SDL_Event e; //Set text color as black SDL.SDL_Color textColor = new SDL.SDL_Color { a = 255 }; //The frames per second timer LTimer fpsTimer = new LTimer(); //In memory text stream string timeText; //Start counting frames per second int countedFrames = 0; fpsTimer.start(); //While application is running while (!quit) { //Handle events on queue while (SDL.SDL_PollEvent(out e) != 0) { //User requests quit if (e.type == SDL.SDL_EventType.SDL_QUIT) { quit = true; } } //Calculate and correct fps float avgFPS = countedFrames / (fpsTimer.getTicks() / 1000f); if (avgFPS > 2000000) { avgFPS = 0; } //Set text to be rendered timeText = ""; timeText += "Average Frames Per Second " + string.Format("{0:.0000}", avgFPS); //Render text if (!gFPSTextTexture.loadFromRenderedText(timeText, textColor)) { Console.WriteLine("Unable to render FPS texture!"); } //Clear screen SDL.SDL_SetRenderDrawColor(gRenderer, 0xFF, 0xFF, 0xFF, 0xFF); SDL.SDL_RenderClear(gRenderer); //Render textures gFPSTextTexture.render((SCREEN_WIDTH - gFPSTextTexture.getWidth()) / 2, (SCREEN_HEIGHT - gFPSTextTexture.getHeight()) / 2); //gFPSTextTexture.render(50, (SCREEN_HEIGHT - gFPSTextTexture.getHeight()) / 2); //Update screen SDL.SDL_RenderPresent(gRenderer); ++countedFrames; } } } //Free resources and close SDL close(); if (success == false) { Console.ReadLine(); } return(0); }
public static extern IntPtr TTF_RenderUTF8_Blended_WrappedNative(IntPtr font, IntPtr text, SDL.SDL_Color fg, uint wrapped);
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ public static IntPtr TTF_RenderUTF8_Blended_Wrapped(IntPtr font, string text, SDL.SDL_Color fg, uint wrapped) { var textUTF8 = Utf8String.ReusableBufferPtr(text); return(TTF_RenderUTF8_Blended_WrappedNative(font, textUTF8, fg, wrapped)); }
public static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Solid_Wrapped( IntPtr font, byte *text, SDL.SDL_Color fg, uint wrapLength );
public void setDefaultColor(ref SDL.SDL_Color color) { SDL_FontCache.FC_SetDefaultColor(font, color); }
private static extern unsafe IntPtr INTERNAL_TTF_RenderUTF8_Shaded( IntPtr font, byte *text, SDL.SDL_Color fg, SDL.SDL_Color bg );
public Effect(ref Scale scale, ref SDL.SDL_Color color) { alignment = AlignEnum.LEFT; this.scale = scale; use_color = true; this.color = color; }
public static extern IntPtr TTF_RenderText_Blended( IntPtr font, [In()][MarshalAs(UnmanagedType.LPStr)] string text, SDL.SDL_Color fg );
public Effect(AlignEnum alignment, ref Scale scale, ref SDL.SDL_Color color) { this.alignment = alignment; this.scale = scale; use_color = true; this.color = color; }
public static extern IntPtr TTF_RenderGlyph32_Blended( IntPtr font, uint ch, SDL.SDL_Color fg );
void Wings(int width, int height, int frontWidth, int backWidth, int offsetX, int offsetY)//FTL & guns { byte r = 84; byte g = 84; byte b = 84; byte a = 255; SDL.SDL_Color colour = new SDL.SDL_Color() { r = r, g = g, b = b, a = a }; PointD p0 = new PointD() { X = offsetX, Y = (int)(offsetY - height * 0.5) }; PointD p1 = new PointD() { X = offsetX + frontWidth, Y = (int)(offsetY - height * 0.5) }; PointD p2 = new PointD() { X = (int)(offsetX + width * 0.5), Y = (int)(offsetY - height * 0.3) }; PointD p3 = new PointD() { X = (int)(offsetX + width * 0.5), Y = -(int)(offsetY - height * 0.25) }; PointD p4 = new PointD() { X = offsetX + backWidth, Y = -(int)(offsetY - height * 0.5) }; PointD p5 = new PointD() { X = offsetX, Y = -(int)(offsetY - height * 0.5) }; PointD p6 = new PointD() { X = offsetX - backWidth, Y = (int)(offsetY + height * 0.5) }; PointD p7 = new PointD() { X = (int)(offsetX + -width * 0.5), Y = (int)(offsetY + height * 0.25) }; PointD p8 = new PointD() { X = (int)(offsetX + -width * 0.5), Y = -(int)(offsetY + height * 0.3) }; PointD p9 = new PointD() { X = offsetX - frontWidth, Y = -(int)(offsetY + height * 0.5) }; PointD p10 = new PointD() { X = offsetX, Y = -(int)(offsetY + height * 0.5) }; var shape = new Shape() { Color = colour, Points = new PointD[] { p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 } }; Shapes.Add(shape); }
//RenderGlyph_Solid public SDLSurface RenderGlyph_Solid(ushort Ch, SDL.SDL_Color Fg) { return(new SDLSurface(SDL_ttf.TTF_RenderGlyph_Solid(myPtr, Ch, Fg))); }
public void generateNameSurface(IntPtr font, SDL.SDL_Color color) { nameSurface = SDL_ttf.TTF_RenderText_Solid(font, name, color); }
public SDLTexture RenderUNICODE_Shaded_Texture(string Text, SDL.SDL_Color Fg, SDL.SDL_Color Bg, IntPtr Renderer) { IntPtr Result = SDL_ttf.TTF_RenderUNICODE_Shaded(myPtr, Text, Fg, Bg); try { return(new SDLTexture(SDL.SDL_CreateTextureFromSurface(Renderer, Result))); } finally { SDL.SDL_FreeSurface(Result); } }
public void SetPaletteColor(SDL.SDL_Color Color) { Util.ThrowIfResultIsError(SDL.SDL_SetPaletteColors(myPtr, new SDL.SDL_Color[] { Color }, 0, 1)); }
//RenderUTF8_Blended public SDLSurface RenderUTF8_Blended(string Text, SDL.SDL_Color Fg) { return(new SDLSurface(SDL_ttf.TTF_RenderUTF8_Blended(myPtr, Text, Fg))); }
private static void Setup(List <Icon> icons) { List <Shape> shapes = new List <Shape>(); PointD[] lpoints1 = new PointD[] { new PointD { X = 0, Y = -160 }, new PointD { X = 0, Y = 160 }, }; PointD[] lpoints2 = new PointD[] { new PointD { X = -25, Y = 0 }, new PointD { X = 25, Y = 0 } }; SDL.SDL_Color lcolor = new SDL.SDL_Color() { r = 0, g = 255, b = 0, a = 255 }; shapes.Add(new Shape() { Points = lpoints1, Color = lcolor }); shapes.Add(new Shape() { Points = lpoints2, Color = lcolor }); PositionDB lpos = new PositionDB(new Vector3(0, 0, 0), new Guid()); icons.Add(new Icon(lpos) { Shapes = shapes }); for (int i = 0; i < 4; i++) { PointD[] points = CreatePrimitiveShapes.CreateArc(50 + 50 * i, 400, 100, 100, 0, 4.71, 160); SDL.SDL_Color color = new SDL.SDL_Color() { r = (byte)(i * 60), g = 100, b = 100, a = 255 }; Shape shape = new Shape() { Points = points, Color = color }; PositionDB pos1 = new PositionDB(new Vector3(0, 0, 0), new Guid()); icons.Add(new Icon(pos1) { Shapes = new List <Shape> { shape } }); } /* * PositionDB pos2 = new PositionDB(new Vector4(0, -0, 0, 0), new ID()); * var shape2 = new Shape() { Color = new SDL.SDL_Color() { r = 255, g = 0, b = 0, a = 255 }, Points = CreatePrimitiveShapes.RoundedCylinder(50, 100, 0, 0) }; * var shapes2 = new List<Shape>() { shape2 }; * * icons.Add(new Icon(pos2) { Shapes = shapes2 }); */ PositionDB pos3 = new PositionDB(new Vector3(100, 0, 0), new Guid()); icons.Add(new ShipIcon(pos3)); }
public static extern IntPtr TTF_RenderUNICODE_Solid( IntPtr font, [In()][MarshalAs(UnmanagedType.LPWStr)] string text, SDL.SDL_Color fg );
/* IntPtr refers to an SDL_Surface*, font to a TTF_Font* */ public static IntPtr TTF_RenderUTF8_Shaded(IntPtr font, string text, SDL.SDL_Color fg, SDL.SDL_Color bg) { var textUTF8 = Utf8String.ReusableBufferPtr(text); return(TTF_RenderUTF8_ShadedNative(font, textUTF8, fg, bg)); }