A few questions about Allegro

Relationship between C++, image drawing, text writing.

Page 1 of 1

4 Replies - 1373 Views - Last Post: 19 July 2010 - 09:52 AM Rate Topic: -----

#1 Guest_Arthur*


Reputation:

A few questions about Allegro

Posted 18 July 2010 - 11:19 AM

Hi everyone. I DON'T KNOW IF I'M POSTING IN THE RIGHT SECTION. Sorry, if i don't. Please move the topic then. But i'm a little confused. I can find tutorials on Allegro "For c++", but what is the relationship between them? I even seen a tic tac toe game without C++, just Allegro. Which is not working by the. This is the second question. I put y.bmp and y.bmp images into the project folder, impor them as resources in Visual studio 2010 and the program starts, maximizes a black screen, minimizes and you cannot get it up normally. You must it turn it off from processes. here is the code:

#include <allegro.h>

BITMAP *xSprite;
BITMAP *oSprite;

int main(){
 
    allegro_init();
    install_keyboard();
    set_color_depth(16);
    set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);
    
    xSprite = load_bitmap( "x.bmp", NULL);
    
    oSprite = load_bitmap( "o.bmp", NULL);

    acquire_screen();
    
    line( screen, 200, 0, 200, 480, makecol( 255, 255, 255));
    line( screen, 400, 0, 400, 480, makecol( 255, 255, 255));
    line( screen, 0, 150, 680, 150, makecol( 255, 255, 255));
    line( screen, 0, 300, 680, 300, makecol( 255, 255, 255));
    
    draw_sprite( screen, xSprite, 0, 0);
    draw_sprite( screen, oSprite, 200, 0);
    draw_sprite( screen, xSprite, 400, 0);
    
    draw_sprite( screen, oSprite, 0, 150);
    draw_sprite( screen, xSprite, 200, 150);
    draw_sprite( screen, oSprite, 400, 150);

    draw_sprite( screen, oSprite, 0, 300);
    draw_sprite( screen, xSprite, 200, 300);
    draw_sprite( screen, oSprite, 400, 300);
        
    release_screen();

    readkey();
    
    return 0;
    
}   
END_OF_MAIN();



And one more question: How can i make it type the text like a terminal, letter by letter? It should be an animation?

Thanks for answers and sorry if that's not the thread this should be posted at.

Is This A Good Question/Topic? 0

Replies To: A few questions about Allegro

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: A few questions about Allegro

Posted 18 July 2010 - 11:26 AM

As for your first question, this is from the Allegro homepage

Quote

Allegro is a game programming library for C/C++ developers distributed freely, supporting the following platforms: Unix (Linux, FreeBSD, etc.), Windows, MacOS X and Haiku/BeOS. Older versions also support DOS and QNX. It provides many functions for graphics, sounds, player input (keyboard, mouse and joystick) and timers. It also provides fixed and floating point mathematical functions, 3d functions, file management functions, compressed datafile and a GUI.


Simply put, it's a game programming library for C & C++. You can check out the FAQ here and the API here. They also have some tutorials you can look through as well.

EDIT: Since this is a question regarding a game development library I'm going to move this to Game Programming :)
Was This Post Helpful? 0
  • +
  • -

#3 newn  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 121
  • Joined: 22-April 09

Re: A few questions about Allegro

Posted 18 July 2010 - 11:42 AM

It was me not logged in. Anyway, thanks for answer. But i still don't get it a little bit. It's a library, okay. But library should be integrated into the main programming language, shouldn't it be? I see no integration here, just plain usage of Allegro.

Also, new readers, please read the first post for more questions unanswered. Thanks.
Was This Post Helpful? 0
  • +
  • -

#4 stayscrisp  Icon User is offline

  • フカユ
  • member icon

Reputation: 1040
  • View blog
  • Posts: 4,325
  • Joined: 14-February 08

Re: A few questions about Allegro

Posted 19 July 2010 - 05:51 AM

The library itself is written in C++, the functions are written using C++. The allegro library is essentially just a set of functions written by the developers (in C++) to do game specific things so you don't have to. When you write a program using allegro you use C++ syntax.

It is in every way a C++/C library. I hope that answers your question.
Was This Post Helpful? 0
  • +
  • -

#5 newn  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 121
  • Joined: 22-April 09

Re: A few questions about Allegro

Posted 19 July 2010 - 09:52 AM

Thanks for answer. Now i think i get it a little bit more... Allegro is written in C/C++, so you need to know at least basics of C or Cpp or both, to work with Allegro more efficiently.
Yea, thanks for the answer, that've answered my question.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1