|
Pure game programming problem |
keprast
Member #16,794
January 2018
|
hello For example: a rectangle, rotating in the plane. (The actual rotation, not just the camera) |
keprast
Member #16,794
January 2018
|
Thank you for your help. I think it's very useful. But, obviously, I can't find this example. |
Neil Roy
Member #2,229
April 2002
|
There is no "ex_camera.c" for Allegro 5 (that comes with the source anyhow). Allegro 4 has that though. I honestly can't find an equivalent example for Allegro 5. --- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Yes, yes there is. It's right there in the examples folder. ex_camera.c . Yes, Allegro 5 has ex_camera.c . https://github.com/liballeg/allegro5/blob/master/examples/ex_camera.c My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Neil Roy
Member #2,229
April 2002
|
The last version of Allegro 5 I have doesn't have it (which honestly surprised me as it used to be there). Strange. (checks version I have) I have v5.1.9 source on my system... so a little out of date. I just noticed it is in 5.2.2, last compiled version I have, my bad, sorry. --- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I get mine from github with git, so I always have an up to date version. If you'll kindly remember, when we were messing around with skyboxes and opengl = never did get that to work using a triangle fan )Elias pointed out that he updated ex_camera.c to use a skybox. You should really try building allegro again sometime. It's a very satisfying experience to have it all do what you tell it to. That's the problem with computers, they only do what you tell them to, disregarding hardware failure. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Neil Roy
Member #2,229
April 2002
|
Edgar Reynaldo said: Elias pointed out that he updated ex_camera.c to use a skybox. You're right. I checked that out. Looked good. I dont' use a triangle fan for skyboxes. Just a cube made up of either quads or two triangles per side. There isn't much of a hit on performance no matter which way you do it. I kind of like quads for it so when I view everything in wireframe mode I just see a normal box. I'm not sure how one would do a cube with a triangle fan. Check my City3D source I sent you, you should be able to copy the OpenGL from it straight into Allegro as the OpenGL is independent of that. I still have yet to build Allegro 5, though I came close. It is a better option, I just always seem to run into problems. Never had a problem with Allegro 4. It's those Allegro 5 dependencies that always get me. --- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I'll teach you a trick. I've already compiled all the dependencies for you. Use those binaries I gave you. They include the /include and /lib folders for all the dependencies to build allegro yourself. Just use cmake-gui and specify the correct directories and libraries for allegro to link to. Or you can do like the manual suggests and use the build/deps directory to store the lib and include folders for the dependencies. Makes it easier so I hear. Just check out allegro from git here : https://github.com/liballeg/allegro5.git At a c:\ prompt, enter the following : mkdir allegro cd allegro git clone https://github.com/liballeg/allegro5.git git checkout master git pull mkdir build cd build mkdir deps copy c:\path\to\distrofolder\* deps\ mkdir include mkdir lib mkdir bin cmake-gui -DCMAKE_INSTALL_PREFIX=.\ .. {specify a whole bunch of stuff, hope it sees the deps folder} make make install And you'll note I had to patch several libraries. I'll see if there are newer versions that fix the problems the old ones had. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
keprast
Member #16,794
January 2018
|
@Edgar Reynaldo Hello, developer. But it is still as it was like, I do not know how to play. However, although there are many problems, but he still is a complete game. I checked your picture, found a lot of purple background, can not directly use the transparent background? |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I made skyline in 24 hours. There are bugs I never got around to fixing. It was made with allegro 4 not 5. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
keprast
Member #16,794
January 2018
|
Sorry, I did not notice. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Yes , by loading a proper image file such as 32 bit png. I think .tga is supported too. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
keprast
Member #16,794
January 2018
|
Oh, that's awesome. |
Neil Roy
Member #2,229
April 2002
|
My Deluxe Pacman 2 game is written in C using Allegro 5 and it uses all PNGs for the menu buttons etc... all have transparent backgrounds. The player, ghosts, pills etc... are all transparent PNGs. --- |
keprast
Member #16,794
January 2018
|
@Neil Roy I also play your game, but as always. Talking about, do you have a complete example of moving the Camera? |
Neil Roy
Member #2,229
April 2002
|
I'm not exactly certain what you mean by "moving the Camera"? 3D? 2D scrolling? Don't feel bad about my game, I suck at it too!!! --- |
keprast
Member #16,794
January 2018
|
Yes,of course it is a 2D. |
Neil Roy
Member #2,229
April 2002
|
If you have a 2D game with a large scrolling map, where only part of your map is visible on the screen. What you have is an X and Y co-ordinate, scroll_x and scroll_y, you store which keeps track of the upper left corner of the area you are viewing. When you scroll left, you increase the scroll_x co-ordinate until you cannot scroll any more. If for example you are viewing the rightmost section of the screen and you cannot scroll to the right any more, you have reached the maximum scroll_x co-ordinate so that the right size of the viewable area is the right side of the map. Then you start to move the character to the right instead of scroll the screen. When moving the character back to the left, when he reaches the center of the screen, you then start to scroll back to the left again until you cannot scroll left anymore, in which case your character moves left of center. The same for up and down movements. When you draw the map, you start drawing it at the scroll_x and scroll_y co-ordinates which will be the upper left corner of the area to view and then you show that area on the main screen. The scroll_x and scroll_y (or whatever you call it) can be the upper left TILES of the screen, or, pixel area or whatever, depending on your game type. --- |
|