A GAME PROGRAMMING LIBRARY Allegro Low Level Game Routines



Documentos relacionados
A UTILIZAÇÃO DA BIBLIOTECA ALLEGRO PARA O DESENVOLVIMENTO DE APLICAÇÕES MULTIMÍDIA. Luana Pereira de Lima luanaelima@gmail.com

User Guide Manual de Utilizador

II Workshop de Sistemas de Informação

Accessing the contents of the Moodle Acessando o conteúdo do Moodle

Bom se você gravou tudo certinho vai aparecer essa tela no seu play2. Essa é a tela principal do scummvm, nela temos ao botões:

Este tutorial está publicado originalmente em

Programação científica C++

Aula 14: Sons e imagens

Introdução a Programação de Jogos

Conceitos Básicos sobre Programação Prática

TUTORIAL DE UTILIZAÇÃO DA BIBLIOTECA ALLEGRO PARA INICIANTES

ÍNDICE PORTUGUÊS INDEX ENGLISH

Slides_Java_1 !"$ % & $ ' ' Output: Run java. Compile javac. Name of program. Must be the same as name of file. Java source code.

Capítulo 4. Programação em ASP

PlayLib Educational Game Programming Library Documentação

NOVO SISTEMA DE CORREIO ELETRONICO PARA OS DOMINIOS ic.uff.br & dcc.ic.uff.br

INSTALANDO O WINDOWS SERVER 2008

GraphicsLib Biblioteca Gráfica 2D. Documentação

Procedimento para instalação. Importante

Métodos Formais em Engenharia de Software. VDMToolTutorial

Introdução a Programação de Jogos

Strings. COM10615-Tópicos Especiais em Programação I edmar.kampke@ufes.br 2014-II

Capítulo 5. Figura 5.2. Conector para o monitor.

Usando emacs, vim e gdb. Um guia BEM básico

Parts of the Solar Charger. Charging the Solar Battery. Using the Solar Lamp. Carry in hand. Shows how much light is left. Table light.

OProtocolo RPC é um dos protocolos de aplicação mais utilizados, pois permite

Manual de Instalação e Configuração MySQL

Instruções de Instalação do Agente RMON2

Este tutorial está publicado originalmente em

Configurações do Windows Media Encoder para transmissão ao vivo

Exportando PDF para Agráfica Illustrator

1. PROLOGO ==========

Tópicos em Sistemas Operacionais. Chamadas de Sistema. Islene Calciolari Garcia. Segundo Semestre de Instituto de Computação - Unicamp

Desenvolvimento de Jogos de Computadores Usando Software Livre. Development of Computer Games Using Open Source Software

Universidade da Beira Interior. Sistemas Distribuídos /2015 Curso: Engª Informática. Folha 11. JAX-RS: Java API for RESTful Web Services

Aceder à plataforma do concurso Accessing the call for applications platform. Submeter documentos Upload documents. Apagar documentos Delete documents

Fundamentos de Programação II. Introdução à linguagem de programação C++

HANDS ON DARK GDK Outubro/2008 Prof. F.Osório / ICMC-USP - fosorio <at> gmail.com. DICAS DE INSTALAÇÃO DO DARK GDK / TheGameCreators (TGC)

Roteiro de Uso do InstallShield

Harrison Kinsley Will McGugan

Usando áudio no Flash

PROGRAMAÇÃO ORIENTADA A OBJETOS. CC 3º Período

Organização do Curso. Instalação e Configuração. Módulo II. Pós Graduação em Projeto e Gerencia de Redes de Computadores

Hae Yong Kim. Cekeikon4 pode ser utilizado livremente tanto para fins não-lucrativos (acadêmicos e educacionais) como para fins comerciais, desde que:

Infra-Estrutura de Software. Introdução. (cont.)

Introdução a Programação de Jogos

Click the + sign to add new server details. Clique no sinal de "+" para adicionar novos detalhes do servidor. Enter a friendly name for your BI Server

MANUAL DO USUÁRIO. MP5 Digital Player UT-09

Introdução à Ciência da Computação

PlusTV ISDB-T USB Stick KW-UB320-i Manual de Instalação

Thunder Pro II Gold Edition Manual de operações v 8.7 Rev:b

Prof. MSc. João Ricardo Bittencourt

Roteiro. MC-102 Aula 01. Hardware e dispositivos. O que é um computador? Primeiro Semestre de A linguagem C

Atividade Física Adaptada: Qualidade de Vida para Pessoas com Necessidades Especiais (Portuguese Edition)

Roteiro para legendar vídeos

UNIVERSIDADE FEDERAL DO RIO GRANDE DO NORTE - UFRN DEPARTAMENTO DE INFORMÁTICA E MATEMÁTICA APLICADA DIMAP

2. Execute o arquivo com o comando a seguir: sudo./alfresco-community-4.2.b-installer-linux-x64.bin

Easy Linux! FUNAMBOL FOR IPBRICK MANUAL. IPortalMais: a «brainware» company Manual

Instalação da Ferramenta Eclipse no Windows Prof. Bruno Emerson Gurgel Gomes Instituto Federal de Educação, Ciência e Tecnologia do RN

Completing your Participant Agreement Como preencher o Contrato de Participação

2. O AMBIENTE DE PROGRAMAÇÃO EM C

Transcript name: 1. Introduction to DB2 Express-C

Seu primeiro jogo no Game Maker - tradução livre do tutorial do Game Maker. Traduzido por: Fernanda Monteiro Eliott.

Oracle PL/SQL Overview

Redes de Computadores

hdd enclosure caixa externa para disco rígido

Programação Engenharia Informática (11543) 1º ano, 1º semestre Tecnologias e Sistemas de Informação (6619) 1º ano, 1º semestre

Iniciação à Administração Geral (Portuguese Edition)

Chien 2D Tutorial Básico

MANUAL TECLADO ADAPTADO IntelliKeys USB

Manual de Instalação Placa PVR-TV 713X

WATER MATTRESS MASSAGE SYSTEM 20439

Como instalar o sistema operacional pfsense no Citrix Xen Server

Vim - Um editor para Hackers

Guião M. Descrição das actividades

Como posso usar o HP Easy Printer Care através de USB ou conexão paralela?

CRIANDO e GRAVANDO DVD usando o NERO 7 ULTRA EDITION

Desvendando Jogos 2D. Por Marcos Romero Setembro / Cyborg Arena - RHGames

Aqui pode escolher o Sistema operativo, e o software. Para falar, faça download do Cliente 2.

Computação Gráfica. 5385: Licenciatura em Engenharia Informática. Cap. 3 Janelas e Visores. Janelas e Visores

GERENCIAMENTO PELAS DIRETRIZES (PORTUGUESE EDITION) BY VICENTE FALCONI

Prática em Laboratório N.04 (Parte 01) Criando uma aplicação composta a partir de um serviço Web

A necessidade da oração (Escola da Oração) (Portuguese Edition)

MANUAL DE INSTALAÇÃO DVR-USB ST-104

Treinamento T2Ti Jogos - Java Básico

ftp://ftp.cr-df.rnp.br/pub/netinfo/training/rnp/kit-bsb/html/guia.zip novembro 1996 Tutorial - Autoria em World Wide Web

Instrução para Exportação de Certificados Digitais de Servidor Web IIS 6 e IIS 7

Ambiente de Desenvolvimento

Programação de Computadores I. Conhecendo a IDE Code::Blocks

FireMonkey Deep Dive

UNIVERSIDADE FEDERAL DO RIO GRANDE DO SUL INSTITUTO DE INFORMÁTICA INFORMÁTICA APLICADA

Transcrição:

A GAME PROGRAMMING LIBRARY Allegro Low Level Game Routines > Allegro 4.1 // WinAllegro (DirectX) // XWinAllegro > Compilador: DJGPP - GNU C/C++ for PC s > Sistema Operacional: DOS, Windows e Linux WEB: http://www.talula.demon.uk/allegro/ ALLEGRO - Conceitos Básicos: - Conjunto de rotinas para acesso ao dispositivos periféricos: mouse, timer, teclado, joystick, placas gráficas (drivers, palette, funções gráficas bit-map/2d/3d/animação), sons, músicas, compressão de armazenamento de dados, funções matemáticas e GUI (Graphical User Interface). - Programação em C / C++ usando o compilador GNU para PC - Library em C e Assembly a ser linkada ao programa do usuário - Orientada ao desenvolvimento de Jogos - Vantagens: Facilidade de uso e desenvolvimento de aplicações Portabilidade: ao contrário do DirectX, não está restrita apenas a plataforma PC/Windows (roda em DOS, Windows e Linux) - Concorrentes diretos: DirectX, OpenGL e Java (Java3D / JMF) 1

ALLEGRO - Referências Básicas: WEB: Site Oficial Allegro Vivace WinAllegro XWinAllegro Allegro Games http://www.talula.demon.uk/allegro http://www.canvaslink.com/gfoot/vivace Tutorial: criação de jogos usando C (DJGPP + Allegro) para DOS/Win95 http://www.casema.net/~berryfra/winallg.htm http://www.canvaslink.com/gfoot/winallegro/ http://www.canvaslink.com/allegro/xwinallegro/ http://agd.emuware.com/ http://www.dtek.chalmers.se/~d98peitz/fld/games.html How to Program Games - http://www.canvaslink.com/gfoot/htpg/ Allegro na Unisinos: Drive G: (Aplica) => G:\Djgpp\Allegro [Inclui Exemplos] ALLEGRO - Usando a library: => Incluir no programa: # include <allegro.h> Adicionar no path dos includes => Compilar com um comando do tipo: gcc foo.c -o foo.exe -lalleg - Arquivo da library: liballeg.a - Adicionar o path para o diretório onde se encontra a lib. => É possivel selecionar somente alguns dos módulos do Allegro. Exemplo - #define alleg_mouse_unused 1 => Possibilidade de usar o ambiente integrado de desenvolvimento de programas RHIDE (Interface idêntica a do Turbo Pascal) 2

ALLEGRO - Funções da library: => Grupos de rotinas: - Init - Drawing Primitives - Configure - RLE Sprites - Mouse - Compiles Sprites - Timer - Text Output - Keyboard - Polygon Rendering - Joystick - Transparency and Patterns - Graphics Modes - Color Conversion - Bitmap Objects - Video Memory Access - Load Image Files (BMP,PCX,TGA) - FLI/FLC Routines - Truecolor Pixel - Sound Init - Blitting and Sprites - Digital Sounds (Wav, Voc) - Palette Routines - Music Sounds (Midi) - File Compression (LZSS) - Audio Stream (big files) - Datafile Routines (Grab:.dat) - Recording Sounds - Math Routines - GUI Routines - 3D Math Routines - Debugging / This is a very simple program showing how to get into graphics mode and draw text onto the screen. int main() / you should always do this at the start of Allegro programs / set up the keyboard handler / set VGA graphics mode 13h (sized 320x200) / set the color pallete set_pallete(desktop_pallete); / write some text to the screen textout_centre(screen, font, "Hello, world!", SCREEN_W/2, SCREEN_H/2, 255); / wait for a keypress 3

/ This program demonstrates the use of memory bitmaps. It creates a small temporary bitmap in memory, draws some circles onto it, and then blits lots of copies of it onto the screen. int main() BITMAP memory_bitmap; int x, y; / draw some circles onto it clear(memory_bitmap); for (x=0; x<16; x++) circle(memory_bitmap, 10, 10, x, x); / blit lots of copies of it onto the screen for (y=0; y<screen_h; y+=20) for (x=0; x<screen_w; x+=20) blit(memory_bitmap, screen, 0, 0, x, y, 20, 20); / free the memory bitmap destroy_bitmap(memory_bitmap); set_pallete(desktop_pallete); / make a memory bitmap sized 20x20 memory_bitmap = create_bitmap(20, 20); / This program demonstrates how to get mouse input. int main() int mickeyx = 0; int mickeyy = 0; BITMAP custom_cursor; char msg[80]; int c = 0; install_mouse(); install_timer(); set_pallete(desktop_pallete); do / the mouse position is stored in the variables mouse_x and mouse_y sprintf(msg, "mouse_x = %-5d", mouse_x); textout(screen, font, msg, 16, 16, 255); sprintf(msg, "mouse_y = %-5d", mouse_y); textout(screen, font, msg, 16, 32, 255); / or you can use this function to measure the speed of movement. Note that we only call it every fourth time round the loop: there's no need for that other than to slow the numbers down a bit so that you will have time to read them... c++; if ((c & 3) == 0) get_mouse_mickeys(&mickeyx, &mickeyy); sprintf(msg, "mickey_x = %-7d", mickeyx); textout(screen, font, msg, 16, 64, 255); sprintf(msg, "mickey_y = %-7d", mickeyy); textout(screen, font, msg, 16, 80, 255); / the mouse button state is stored in the variable mouse_b if (mouse_b & 1) textout(screen, font, "left button is pressed ", 16, 112, 255); else textout(screen, font, "left button not pressed", 16, 112, 255); if (mouse_b & 2) textout(screen, font, "right button is pressed ", 16, 128, 255); else textout(screen, font, "right button not pressed", 16, 128, 255); if (mouse_b & 4) textout(screen, font, "middle button is pressed ", 16, 144, 255); else textout(screen, font, "middle button not pressed", 16, 144, 255); vsync(); while (!keypressed()); clear_keybuf(); / To display a mouse pointer, call show_mouse(). There are several things you should be aware of before you do this, though. For one, it won't work unless you call install_timer() first. For another, you must never draw anything onto the screen while the mouse pointer is visible. So before you draw anything, be sure to turn the mouse off with show_mouse(null), and turn it back on again when you are done. clear(screen); textout_centre(screen, font, "Press a key to change cursor", SCREEN_W/2, SCREEN_H/2, 255); show_mouse(screen); show_mouse(null); 4

/ create a custom mouse cursor bitmap... custom_cursor = create_bitmap(32, 32); clear(custom_cursor); for (c=0; c<8; c++) circle(custom_cursor, 16, 16, c2, c); / select the custom cursor and set the focus point to the middle of it set_mouse_sprite(custom_cursor); set_mouse_sprite_focus(16, 16); clear(screen); textout_centre(screen, font, "Press a key to quit", SCREEN_W/2, SCREEN_H/2, 255); show_mouse(screen); show_mouse(null); destroy_bitmap(custom_cursor); / This program demonstrates how to load and display a bitmap file. / destroy the bitmap destroy_bitmap(the_image); int main(int argc, char argv[]) BITMAP the_image; PALLETE the_pallete; if (argc!= 2) printf("usage: 'ex15 filename.[bmp lbm pcx tga]'\n"); / read in the bitmap file the_image = load_bitmap(argv[1], the_pallete); if (!the_image) printf("error reading bitmap file '%s'\n", argv[1]); / select the bitmap pallete set_pallete(the_pallete); / blit the image onto the screen blit(the_image, screen, 0, 0, (SCREEN_W-the_image->w)/2, (SCREEN_H-the_image->h)/2, the_image->w, the_image->h); 5

/ This program demonstrates how to play MIDI files. int main(int argc, char argv[]) MIDI the_music; if (argc!= 2) printf("usage: 'ex16 filename.mid'\n"); printf("midi driver: %s\n", midi_driver->name); printf("playing %s\n", argv[1]); / start up the MIDI file play_midi(the_music, TRUE); / wait for a keypress / destroy the MIDI file destroy_midi(the_music); install_timer(); / install a MIDI sound driver if (install_sound(digi_autodetect, MIDI_AUTODETECT, argv[0])!= 0) printf("error initialising sound system\n%s\n", allegro_error); / read in the MIDI file the_music = load_midi(argv[1]); if (!the_music) printf("error reading MIDI file '%s'\n", argv[1]); 6