Programmer_20 [11:16 AM]
what is the function to read keyboard input?

what is the function to read keyboard input?

Apiza [11:17 AM]
Here is a function that might help with that:

```bool al_key_down(const ALLEGRO_KEYBOARD_STATE *state, int keycode)```

Programmer_20 [11:19 AM]
what is the api for allocating ALLEGRO_KEYBOARD_STATE?

Apiza [11:19 AM]
Here is a function that might help with that:

```void al_clear_keyboard_state(ALLEGRO_DISPLAY *display)```

Programmer_20 [11:20 AM]
give me example of al_key_down usage

Apiza [11:21 AM]
Here is an example of keyboard input:

https://wiki.allegro.cc/index.php?title=Basic_Keyboard_Example

Programmer_20 [11:34 AM]
how to you play an audio wav file

Apiza [11:35 AM]
Here is a function that might help with that:

```bool al_play_sample(ALLEGRO_SAMPLE *spl, float gain, float pan, float speed,
   ALLEGRO_PLAYMODE loop, ALLEGRO_SAMPLE_ID *ret_id)```

Programmer_20 [11:36 AM]
give me example of playing a wav file

Apiza [11:36 AM]
Here is an example of playing a wav file:

https://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Addons/Audio

Programmer_20 [11:42 AM]
what is the function to display numbers on screen

Apiza [11:45 AM]
Here is a function that might help with that:

```ALLEGRO_DISPLAY *al_create_display(int w, int h)```

Programmer_20 [11:46 AM]
give me example of display numbers to display

Apiza [11:47 AM]
Here is an example of using displays:

https://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Displays

Programmer_20 [11:49 AM]
how to draw text on display

Apiza [11:50 AM]
Here is a function that might help with that:

```void al_draw_text(const ALLEGRO_FONT *font,
   ALLEGRO_COLOR color, float x, float y, int flags,
   char const *text)``` 

Programmer_20 [11:50 AM]
how to get size of display

Apiza [11:51 AM]
Here is a function that might help with that:

```int al_get_display_width(ALLEGRO_DISPLAY *display)```

Programmer_20 [11:52 AM]
show me example of using al_draw_text

Apiza [11:52 AM]
Here is an example of drawing text:

https://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Addons/Fonts

Programmer_20 [12:05 PM]
show me man page for  al_load_ttf_font

Apiza [12:06 PM]
Here is the documentation for `al_load_ttf_font`:

```Loads a TrueType font from a file using the FreeType library. Quoting from the FreeType FAQ this means support for many different font formats:

TrueType, OpenType, Type1, CID, CFF, Windows FON/FNT, X11 PCF, and others

The size parameter determines the size the font will be rendered at, specified in pixels. The standard font size is measured in units per EM, if you instead want to specify the size as the total height of glyphs in pixels, pass it as a negative value.

    Note: If you want to display text at multiple sizes, load the font multiple times with different size parameters.

The following flags are supported:

    ALLEGRO_TTF_NO_KERNING - Do not use any kerning even if the font file supports it.

    ALLEGRO_TTF_MONOCHROME - Load as a monochrome font (which means no anti-aliasing of the font is done).

    ALLEGRO_TTF_NO_AUTOHINT - Disable the Auto Hinter which is enabled by default in newer versions of FreeType. Since: 5.0.6, 5.1.2

See also: al_init_ttf_addon, al_load_ttf_font_f```

Programmer_20 [12:10 PM]
what are the reasons al_load_ttf_font fails?

Apiza [12:11 PM]
I'm sorry, I'm not sure how to answer that question.

Programmer_20 [12:12 PM]
when does al_load_ttf_font return NULL

Apiza [12:14 PM]
Here is the source code for `al_load_ttf_font`:
```/* Function: al_load_ttf_font
 */
ALLEGRO_FONT *al_load_ttf_font(char const *filename, int size, int flags)
{
   return al_load_ttf_font_stretch(filename, 0, size, flags);
}```

Programmer_20 [12:15 PM]
show me source code for al_load_ttf_font_stretch

Apiza [12:16 PM]
Here is the source code for `al_load_ttf_font_stretch`:
```/* Function: al_load_ttf_font_stretch
 */
ALLEGRO_FONT *al_load_ttf_font_stretch(char const *filename, int w, int h,
   int flags)
{
   ALLEGRO_FILE *f;
   ALLEGRO_FONT *font;
   ASSERT(filename);

   f = al_fopen(filename, "rb");
   if (!f) {
      ALLEGRO_ERROR("Unable to open file for reading: %s\n", filename);
      return NULL;
   }

   /* The file handle is owned by the function and the file is usually only
    * closed when the font is destroyed, in case Freetype has to load data
    * at a later time.
    */
   font = al_load_ttf_font_stretch_f(f, filename, w, h, flags);

   return font;
}```

Programmer_20 [12:16 PM]
show me source code for al_load_ttf_font_stretch_f

Apiza [12:18 PM]
Untitled 
Here is the source code for `al_load_ttf_font_stretch_f`:
```
/* Function: al_load_ttf_font_stretch_f
 */
ALLEGRO_FONT *al_load_ttf_font_stretch_f(ALLEGRO_FILE *file,

Programmer_20 [12:20 PM]
how to enable Allegro logging

Apiza [12:22 PM]
Here is a function that might help with that:

```ALLEGRO_TEXTLOG *al_open_native_text_log(char const *title, int flags)```

Programmer_20 [12:22 PM]
show me example of using al_open_native_text_log
show me example of debugging allegro

Apiza [12:24 PM]
Here is an example of using dialog:

https://wiki.allegro.cc/index.php?title=Showing_a_basic_native_GUI_message_box
I'm sorry, I don't have an example of debugging allegro.

Programmer_20 [12:26 PM]
show me example of enabling trace messages

Apiza [12:27 PM]
I'm sorry, I don't have an example of enabling trace messages.

Programmer_20 [12:28 PM]
show me example of creating a bitmap from an image

Apiza [12:28 PM]
Here is an example of using bitmaps:

https://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Bitmaps

Programmer_20 [12:32 PM]
how to load an image into a bitmap

Apiza [12:33 PM]
Here is a function that might help with that:

```ALLEGRO_BITMAP *al_load_bitmap(const char *filename)```

Programmer_20 [12:33 PM]
how to resize a bitmap

Apiza [12:35 PM]
Here is a function that might help with that:

```void al_draw_scaled_bitmap(ALLEGRO_BITMAP *bitmap,
   float sx, float sy, float sw, float sh,
   float dx, float dy, float dw, float dh, int flags)```

Programmer_20 [12:35 PM]
show me example of using al_draw_scaled_bitmap

Apiza [12:35 PM]
I'm sorry, I don't have an example of that.