|
wip screenshot fun |
Mark Oates
Member #1,146
March 2001
|
Though I'm usually reluctant to post anything that hasn't maintained some polish, per 23's request I'm going to post a screenshot of something I'm working on. Basically I'm finishing off the core baseline of my framework. I'm thinking about releasing a version so I can use it in SpeedHack without having to include it in the entry. What you see in the screenshots dosn't represent any capability of the framework itself, more of a test-use that came together quickly. Screenshots
{"name":"604422","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/1\/310d4f147b68b1689bcd34d612e5c5c9.png","w":960,"h":720,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/1\/310d4f147b68b1689bcd34d612e5c5c9"} About the ScreenshotObviously it some kind of platform game. I put together an absolute-basic tilemap because I hadn't yet done that in A5. Minus the framework, this working demo has come together in about 2 days. The tall rectangle in the middle is the player's bounding box, and the smaller rectangles are bats. The second screenshot applies 3 filters: desaturate, a 1px blur, and a paper texture using multiply blending. This was more for fun than anything else. I think it looks awesome but I wouldn't want to use it in any full-length game. The thing I'm most stoked about is that there are only 5 tiles in this example! TILE_NONE, TILE_GRASS, TILE_BLOCK, TILE_PILLAR, and TILE_DIRT. All of the borders, shading, and grass edging are calculated on render and drawn using the component graphics. Makes things a lot quicker when putting together a level. ("Mehuh I was doing that back in 1992! meauh!" yea shuddup! ) About the Framework
For the program in the screenshot, my main() looks like this: int main(int argc, char *argv[]) { Framework *framework = new Framework(/* optional .cfg filename */); framework->timer_func = my_timer_func; framework->key_up_func = my_key_up_func; framework->key_down_func = my_key_down_func; framework->mouse_axes_func = my_mouse_axes_func; framework->run_loop(); return 0; } a typical timer func looks like this: void my_timer_func(Framework *f, ALLEGRO_TIMER_EVENT *ev) { al_clear_to_color(al_color_name("black")); update_animated(); /* update stuff here */ /* draw stuff here */ al_flip_display(); }
"af/framework.h"Here's what the framework looks like at the moment: 1#ifndef __FRAMEWORK_HEADER
2#define __FRAMEWORK_HEADER
3
4
5#include <sstream>
6#include <vector>
7#include <string>
8#include <iostream>
9#include <algorithm>
10
11using std::vector;
12using std::string;
13using std::cout;
14using std::endl;
15
16#include <allegro5/allegro.h>
17#include <allegro5/allegro_audio.h>
18#include <allegro5/allegro_acodec.h>
19#include <allegro5/allegro_font.h>
20#include <allegro5/allegro_ttf.h>
21#include <allegro5/allegro_color.h>
22#include <allegro5/allegro_memfile.h>
23#include <allegro5/allegro_primitives.h>
24
25#include <af/image_bin.h>
26#include <af/sample_bin.h>
27#include <af/font_bin.h>
28#include <af/vec2d.h>
29#include <af/useful.h>
30#include <af/logger.h>
31#include <af/profiling_timer.h>
32
33
34class Framework
35{
36public:
37 int w, h;
38 ALLEGRO_DISPLAY *display;
39 ALLEGRO_TIMER *timer;
40 ALLEGRO_TRANSFORM camera_tansform;
41 ALLEGRO_EVENT_QUEUE *queue;
42 ALLEGRO_PATH *resource_path;
43
44 ImageBin *image_bin;
45 SampleBin *sample_bin;
46 FontBin *font_bin;
47
48 bool abort_game;
49
50 void (*init_func)(Framework *f);
51 void (*timer_func)(Framework *f, ALLEGRO_TIMER_EVENT *ev);
52 void (*key_up_func)(Framework *f, ALLEGRO_KEYBOARD_EVENT *ev);
53 void (*key_down_func)(Framework *f, ALLEGRO_KEYBOARD_EVENT *ev);
54 void (*key_char_func)(Framework *f, ALLEGRO_KEYBOARD_EVENT *ev);
55 void (*mouse_up_func)(Framework *f, ALLEGRO_MOUSE_EVENT *ev);
56 void (*mouse_down_func)(Framework *f, ALLEGRO_MOUSE_EVENT *ev);
57 void (*mouse_axes_func)(Framework *f, ALLEGRO_MOUSE_EVENT *ev);
58 void (*joy_up_func)(Framework *f, ALLEGRO_JOYSTICK_EVENT *ev);
59 void (*joy_down_func)(Framework *f, ALLEGRO_JOYSTICK_EVENT *ev);
60 void (*joy_axis_func)(Framework *f, ALLEGRO_JOYSTICK_EVENT *ev);
61 void (*display_close_func)(Framework *f, ALLEGRO_DISPLAY_EVENT *ev);
62 void (*display_resize_func)(Framework *f, ALLEGRO_DISPLAY_EVENT *ev);
63
64 Framework(std::string config_filename="data/af.cfg");
65 ~Framework();
66 virtual void run_loop();
67};
68
69
70void framework_default_display_close_func(Framework *f, ALLEGRO_DISPLAY_EVENT *ev);
71
72
73
74
75#endif
class UIFrameworkI'm not planning on including this in the release, but class UIFramework : public Framework does more stuff "in the background" and among other things includes a UI. For example, it wraps the user's custom timer_func() by:
and also wraps most of the input functions with UI stuff. Using the UIFramework, I've put together a few programs where I haven't needed to use a custom timer_func() at all, because everything is object controlled. -- |
Matthew Leverton
Supreme Loser
January 1999
|
Raise your right hand if you looked at the pictures but didn't read any of the text. |
weapon_S
Member #7,859
October 2006
|
First I looked then I read. Looks good. Both the screenshots and the framework. Although I'm not sure I'd use it, because I get anal about controlling the timing. |
Mark Oates
Member #1,146
March 2001
|
weapon_S said: Does the paper texture move with the level? That would be awesome. Yea. It's a giant looping texture. -- |
Thomas Fjellstrom
Member #476
June 2000
|
weapon_S said: The 'testing lines' in that paper filter make it look like an old film filter. Does the paper texture move with the level? That would be awesome I just assumed it was an old film filter, given the dust/grains and lines on the texture. Looked exactly like an old reel to reel film. -- |
james_lohr
Member #1,947
February 2002
|
* raises right hand * It looks cool.
|
Mark Oates
Member #1,146
March 2001
|
Matthew Leverton said: Raise your right hand if you looked at the pictures but didn't read any of the text. From now on when I make big blocks of text, I'm going to drop in "Matthew sucks" somewhere in the middle. ... I encourage others to join me. -- |
_Kronk_
Member #12,347
November 2010
|
That looks amazing! Is it possible to get filter effects like that using A4? -------------------------------------------------- My blog: http://joshuadover.tumblr.com |
Michael Faerber
Member #4,800
July 2004
|
This looks great! ... and the text was interesting to read as well. -- |
MiquelFire
Member #3,110
January 2003
|
So, you going to release this thing so others can use it as well? --- |
Trent Gamblin
Member #261
April 2000
|
The old paper effect looks great.
|
Arvidsson
Member #4,603
May 2004
|
Woo! I have a fetish for frameworks, drool!
|
Mark Oates
Member #1,146
March 2001
|
MiquelFire said: So, you going to release this thing so others can use it as well? Yep. Hopefully soon. -- |
Neil Walker
Member #210
April 2000
|
Matthew Leverton said: Raise your right hand if you looked at the pictures but didn't read any of the text. Raise your left hand if you looked at the pictures but didn't read any of the text or anyone's replies. However, I have a question, is it my eyes or your screenshot - it looks like the screen is tilted slightly on an angle. I'm curious cos a 2D pivoting platformer sounds quite interesting Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
AMCerasoli
Member #11,955
May 2010
|
Good pictures. Are you going to make a little game using your framework?, I'll play the game and skip the rest . I have the same question that Neil posted in his last post, the map it's a little bit rotated?.
|
|