comp.lang.ada
 help / color / mirror / Atom feed
* Text in sdlada
@ 2015-12-01 22:27 Björn Lundin
  2015-12-02 16:31 ` Lucretia
  0 siblings, 1 reply; 4+ messages in thread
From: Björn Lundin @ 2015-12-01 22:27 UTC (permalink / raw)



Hi!
I'm playing with sdlada 2.1.1 and I am looking for a way to write text
on my window.

Looking at c(++)- tutorials they all seem to use SDL2_TTF
which I think is not part of 'core' SDL,
and I cannot find anything like it in the sdlada binding.

So, how would I write "Hello" in a window created like
(No I do not use everything in the code just yet)




with SDL;
with SDL.Error;
with SDL.Log;
with SDL.Video.Palettes;
with SDL.Video.Pixel_Formats;
with SDL.Video.Pixels;
with SDL.Video.Renderers.Makers;
with SDL.Video.Textures.Makers;
with SDL.Video.Windows.Makers;
with SDL.Versions;
with SDL.Video.Rectangles;


procedure Rectangles is

   W                : SDL.Video.Windows.Window;
   Renderer         : SDL.Video.Renderers.Renderer;
   Texture          : SDL.Video.Textures.Texture;
   Pixels           : SDL.Video.Pixels.ARGB_8888_Access.Pointer;
   Pitches          : SDL.Video.Pixels.Pitch_Access.Pointer;
   W_Size           : SDL.Video.Windows.Sizes := (640, 480);

   Rectangle1       : SDL.Video.Rectangles.Rectangle := (50,50,50,50);

begin
   SDL.Log.Set (Category => SDL.Log.Application, Priority => SDL.Log.Debug);
   SDL.Log.Put_Debug ("initilise");

   if SDL.Initialise then
     SDL.Video.Windows.Makers.Create (Win    => W,
                                      Title  => "Rektanglar test)",
                                      X      => 100,
                                      Y      => 100,
                                      Width  => 640,
                                      Height => 480,
                                      Flags  =>
SDL.Video.Windows.Resizable);
     SDL.Log.Put_Debug ("window created");


     SDL.Video.Renderers.Makers.Create (Renderer, W);
     SDL.Log.Put_Debug ("Renderer created");


     SDL.Video.Textures.Makers.Create (Tex      => Texture,
                                       Renderer => Renderer,
                                       Format   =>
SDL.Video.Pixel_Formats.Pixel_Format_ARGB_8888,
                                       Kind     =>
SDL.Video.Textures.Streaming,
                                       Size     => W_Size);
     SDL.Log.Put_Debug ("Texture created");


     Renderer.Draw ( Rectangle => Rectangle1);
     SDL.Log.Put_Debug ("Rectangle drawn by rendered");

     Renderer.Present;
     SDL.Log.Put_Debug ("Rectangle presented by renderer");



   else
     SDL.Log.Put_Debug ("initialise failed");

   end if;
   delay 5.0;
   W.Finalize;
   SDL.Log.Put_Debug ("finalised");
   SDL.Finalise;
end Rectangles;



-- 
--
Björn

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Text in sdlada
  2015-12-01 22:27 Text in sdlada Björn Lundin
@ 2015-12-02 16:31 ` Lucretia
  2015-12-02 22:23   ` Björn Lundin
  0 siblings, 1 reply; 4+ messages in thread
From: Lucretia @ 2015-12-02 16:31 UTC (permalink / raw)


On Tuesday, 1 December 2015 22:27:27 UTC, björn lundin  wrote:
> Hi!
> I'm playing with sdlada 2.1.1 and I am looking for a way to write text
> on my window.
> 
> Looking at c(++)- tutorials they all seem to use SDL2_TTF
> which I think is not part of 'core' SDL,
> and I cannot find anything like it in the sdlada binding.
> 

I've not added TTF yet. It's on the TODO list.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Text in sdlada
  2015-12-02 16:31 ` Lucretia
@ 2015-12-02 22:23   ` Björn Lundin
  2015-12-04  0:45     ` Luke A. Guest
  0 siblings, 1 reply; 4+ messages in thread
From: Björn Lundin @ 2015-12-02 22:23 UTC (permalink / raw)


On 2015-12-02 17:31, Lucretia wrote:
> On Tuesday, 1 December 2015 22:27:27 UTC, björn lundin  wrote:
>> Hi!
>> I'm playing with sdlada 2.1.1 and I am looking for a way to write text
>> on my window.
>>
>> Looking at c(++)- tutorials they all seem to use SDL2_TTF
>> which I think is not part of 'core' SDL,
>> and I cannot find anything like it in the sdlada binding.
>>
> 
> I've not added TTF yet. It's on the TODO list.
> 

Yes, I noticed. But I was thinking if there is
another way - not using TT-fonts.
But I guess not then.

Thanks for a good binding though

-- 
--
Björn


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Text in sdlada
  2015-12-02 22:23   ` Björn Lundin
@ 2015-12-04  0:45     ` Luke A. Guest
  0 siblings, 0 replies; 4+ messages in thread
From: Luke A. Guest @ 2015-12-04  0:45 UTC (permalink / raw)


Björn Lundin <b.f.lundin@gmail.com> wrote:
> On 2015-12-02 17:31, Lucretia wrote:
>> On Tuesday, 1 December 2015 22:27:27 UTC, björn lundin  wrote:
>>> Hi!
>>> I'm playing with sdlada 2.1.1 and I am looking for a way to write text
>>> on my window.
>>> 
>>> Looking at c(++)- tutorials they all seem to use SDL2_TTF
>>> which I think is not part of 'core' SDL,
>>> and I cannot find anything like it in the sdlada binding.
>>> 
>> 
>> I've not added TTF yet. It's on the TODO list.
>> 
> 
> Yes, I noticed. But I was thinking if there is
> another way - not using TT-fonts.
> But I guess not then.
> 
> Thanks for a good binding though
> 

The alternative way of doing text is to create a font as a texture and map
that to quads that you render. I've just spent the last 2 days getting my
oses back after a motherboard and you change.

I'm now back at work so it'll be a while before I get back to it. 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-04  0:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-01 22:27 Text in sdlada Björn Lundin
2015-12-02 16:31 ` Lucretia
2015-12-02 22:23   ` Björn Lundin
2015-12-04  0:45     ` Luke A. Guest

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox