news... I want to download "Allero Source Version (2.7Mb)" to method B but dont work ... The page cannot be displayed for DOS / Windows
Why dont work ?
other link's to installing LIB ALLEGRO ?
source for a simple map-editor wrote in c
LOOK What I can do!
It makes 1's into X's! So far I can't find any use for this. Yay!
#include <cstdlib>#include <iostream>using namespace std;#define NUM_X 10#define NUM_Y 10int board[NUM_X][NUM_Y] = {0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 1,1,1,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,};void DrawBoard(void);int main(int argc, char *argv[]){ DrawBoard(); system("PAUSE"); return EXIT_SUCCESS;}void DrawBoard(void){ int n, m; for (n=0; n < NUM_X; n++) { for (m=0; m < NUM_Y; m++) { if (board[n][m] == 1) cout << 'X'; else cout << 'O'; } if (m == NUM_Y) cout << "\n"; }}
ok...any links for installing Allegro? I need for trying to make a map-editor in there tutorial ! I read other threads in this forum...but...they want to create in MFC, and others;
I have a other question :
I want to return a RANDOM of other char up[126]="---"; (I dont know hwo say in english)
Is it a function for my problem ??
I have a other question :
I want to return a RANDOM of other char up[126]="---"; (I dont know hwo say in english)
Is it a function for my problem ??
news... I download to this site http://www.talula.demon.co.uk/allegro/wip.html
first .zip "Source code for all platforms in DOS/Windows friendly format."
oh...I forgot... and download 3 dll's who name's
alld40.dll
alleg40.dll and
allp40.dll
This is only i need to installing this "legend" lib...? "Legend": because it is for me this...
Please tell me how installing this thing ...
P.S. I know that i will irritate you but I am a novice(not a noob) (I now to create programs for highschool-only that- and this is the reason to create other things...i.e. I creating a minigame text mod and try to create a map-editor)
"Thats right. You dont need to know OOP or Win32 API." and what release from this tutorial? (an map-editor on DOS or windows)
See you soon and thank's for everything...
first .zip "Source code for all platforms in DOS/Windows friendly format."
oh...I forgot... and download 3 dll's who name's
alld40.dll
alleg40.dll and
allp40.dll
This is only i need to installing this "legend" lib...? "Legend": because it is for me this...
Please tell me how installing this thing ...
P.S. I know that i will irritate you but I am a novice(not a noob) (I now to create programs for highschool-only that- and this is the reason to create other things...i.e. I creating a minigame text mod and try to create a map-editor)
"Thats right. You dont need to know OOP or Win32 API." and what release from this tutorial? (an map-editor on DOS or windows)
See you soon and thank's for everything...
I have a problem: why write me this
--------------------Configuration: ga - Win32 Debug--------------------
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/ga.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
ga.exe - 2 error(s), 0 warning(s)
I use VC++ and version allegro 4.2.0
--------------------Configuration: ga - Win32 Debug--------------------
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/ga.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
ga.exe - 2 error(s), 0 warning(s)
I use VC++ and version allegro 4.2.0
#include <stdio.h>#include <stdlib.h>#include <allegro.h>#define NUM_TILES 10 // number of tiles in the datafile#define TILE_SIZE 32 // tile size#define MAP_SIZE 14 // size of the mapDATAFILE *datTiles; // tiles graphicsunsigned char map[MAP_SIZE][MAP_SIZE]; // map dataint currentTile; // current tile used to draw/*********************************************************************************** * Just zero out all the entries in 2D array which holds map values * Call this function to create new map */void newMap(void){ int i, j; for (i=0; i<MAP_SIZE; i++) for (j=0; j<MAP_SIZE; j++) map[j] = 0;}/*********************************************************************************** * saves a map to file named: filename * */void saveMap(char* filename){ FILE *file; // open the file in write binary mode file = fopen(filename, "wb"); if (!file) return; // write the map data fwrite(map, sizeof(unsigned char), MAP_SIZE*MAP_SIZE, file); // never forget to close the file fclose(file);}/*********************************************************************************** * load a map from file: filename * */void loadMap(char* filename){ FILE *file; // open file in read binary mode file = fopen(filename, "rb"); if (!file) return; // read map data fread(map, sizeof(unsigned char), MAP_SIZE*MAP_SIZE, file); fclose(file);}/*********************************************************************************** * Draw a map to the screen * using map 2D array * */void drawMap(void){ int i, j; // loop counters int tile; // hide the mouse show_mouse(NULL); // iterate through map data for (i=0; i<MAP_SIZE; i++) { for (j=0; j<MAP_SIZE; j++) { tile = map[j]; // if tile is there draw it if (tile > 0) draw_sprite(screen, (BITMAP*)datTiles[tile].dat, i*TILE_SIZE, j*TILE_SIZE); // else just draw black rectangle else rectfill(screen, i*TILE_SIZE, j*TILE_SIZE, i*TILE_SIZE+TILE_SIZE, j*TILE_SIZE+TILE_SIZE, 0); } } // show mouse again show_mouse(screen);}/*********************************************************************************** * if map area was clicked put tile there * using currentTile * */void mapClicked(void){ int tile; // tile to be drawn int tileX; // tile in x direction to draw onto int tileY; // tile in y direction to draw onto // if no mouse button pressed exit function if (!mouse_b) return; // if mouse was clicked outside the map area exit function if (mouse_x >= TILE_SIZE*MAP_SIZE || mouse_y >= TILE_SIZE*MAP_SIZE) return; // if left button pressed draw the tile if (mouse_b & 1) tile = currentTile; // else erase tiles else tile = 0; tileX = mouse_x / TILE_SIZE; // x tile clicked tileY = mouse_y / TILE_SIZE; // y tile clicked map[tileX][tileY] = tile; // assign the value of the map to tile // and redraw the map drawMap();}/*********************************************************************************** * initialize editor. Load datafile with tiles and create new map * */void initEditor(void) { currentTile = 1; // we start with tile #1 being drawn // now load the datafile datTiles = load_datafile("eddat.dat"); // if can't load datafile, give error message if (!datTiles) { printf("Error loading eddat.dat\n"); exit(-1); } newMap(); // create a new map}/*********************************************************************************** * Start message loop which checks * for keypresses that control editor and mouse clicked for drawing * */void startEditor(void){ // draw initial map drawMap(); while (1) { mapClicked(); // check if map was clicked // keys 1 to 0 change the currently used tile if (key[KEY_1]) currentTile = 1; else if (key[KEY_2]) currentTile = 2; else if (key[KEY_3]) currentTile = 3; else if (key[KEY_4]) currentTile = 4; else if (key[KEY_5]) currentTile = 5; else if (key[KEY_6]) currentTile = 6; else if (key[KEY_7]) currentTile = 7; else if (key[KEY_8]) currentTile = 8; else if (key[KEY_9]) currentTile = 9; else if (key[KEY_0]) currentTile = 10; // F1 pressed new map else if (key[KEY_F1]) { newMap(); drawMap(); } // F2 pressed save map else if (key[KEY_F2]) { saveMap("map1.map"); drawMap(); } // F3 pressed load map else if (key[KEY_F3]) { loadMap("map1.map"); drawMap(); } // ESC pressed exit program else if (key[KEY_ESC]) break; }}/***********************************************************************************/int main(int argc, char** argv){ allegro_init(); // initialize editor initEditor(); // we are going to use 640x480 graphics mode set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0); // install timer, mouse and keyboard install_timer(); install_mouse(); install_keyboard(); // clear the screen to background color clear(screen); // make sure 0th entry in datafile is pallete set_pallete((RGB*)datTiles[0].dat); // display the mouse show_mouse(screen); // start processing events startEditor(); exit(0); // succesfully exit}
If you're using main, you should probably create a Console project-application(when you start your project).
Hi i do what u say but not effect
i do and with win32aplication but don't work...
Any sugestions?
bye
i do and with win32aplication but don't work...
Any sugestions?
bye
Quote:Original post by TheFlea
Hi ... I understand @Bob Janova you are perfectly right. I want an example for a map-editor (or a tutorial) 2D ,not 3D . I need for a strategy game.
I repeat : A SIMPLE MAP-EDITOR. I find a long time a tutorial, but he included allegro.h ( and I dont know hwo installing this library) I use Visual C++ 6
I know only create problem for highschool(-school:PASCAL :((boring; Home:C/C++-)
P.S. sorry for my bad english (with this problem, I learn English(very well) and i please ,you when i wrong in a senteces with a gramatical problem, tell me!!! )
thank you in advance.
Hi TheFlea, glad people seem to be willing to help you with your coding problems! Though it doesn't look like anyone has so far responded to your request to point out when you use ungrammatical english.
I don't know if this will help, but i'll write your request out in the way that i would write it as a native english speaker, with some comments included:
"Hi...Yes, Bob Janova, you are definitely right". /* i would use "definitely" instead of perfectly, though "perfectly" is grammatically correct */I'd like an example (or tutorial) of a 2D, not 3D, map-editor. /* i would not use ", not 3D," unless i really wanted to emphasis that point */I repeat: A SIMPLE MAP-EDITOR. /*probably unnecessary emphasis, although that's a subjective point. */I have found an old tutorial, but it uses allegro.h (and i'm not sure how toinstall this library). I'm using Visual C++ 6. I only know how to programthrough working on problems from highschool (at school, i use pascal...it'sboring. at home, c++).P.S. sorry for my bad english (since i've been working on this problem, i'mworking on learning English (hopefully very well), so when i use ungrammaticalsentences, please tell me!). thank you in advance.
just wanted to say it's cool that people are willing to help someone who is (to me at least) half-way around the world (nearly). good luck, man.
Hey, post here the error when you start the console application
P.S.Read more of this forum and you will be more intelligible(and you could also get a subscription to a TV cable company and watch Discovery, or if you can not afford to do such thing or no TV cable comp.nearby your location, try to listen and reproduce mentally what actors say in English language based films)
What age are you?
(I am from Romania too..)
Hey, console app with an empty project or a simple app at most(no MFC or alike),I am not aware of last MSVC options, as my knowledge is based on an ancient MSVC 6.0, good enough for what I do at home
P.S.Read more of this forum and you will be more intelligible(and you could also get a subscription to a TV cable company and watch Discovery, or if you can not afford to do such thing or no TV cable comp.nearby your location, try to listen and reproduce mentally what actors say in English language based films)
What age are you?
(I am from Romania too..)
Hey, console app with an empty project or a simple app at most(no MFC or alike),I am not aware of last MSVC options, as my knowledge is based on an ancient MSVC 6.0, good enough for what I do at home
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement