-
-
Notifications
You must be signed in to change notification settings - Fork 8
Overview: Proce55 Class Family
There are a series of classes located under Framework > Proce55
that enable the creation of "actors" or "entities" -- or as I like to call them -- fragments of animation and interactivity. There are a number of ways to view Proce55or objects, from simple to complex.
In its simplest form, a Proce55or is just a "miniature GLWindow", allowing you to define input interactivity (mouse,keyboard,etc) and keep animated objects with their own relative and individual states in a list. In turn this derived class and its viewer/manager class can be "attached" to a GLWindow. Most simply, without all of the extras of the other viewer/manager classes, Proce55or objects can be grouped in a Proce55ors list and its functionality invoked from your GLWindow, alongside other special layers you've created, to create a game or game view. You can seen an example of the simplest form of these classes in action by watching the video Intro to Proce55ors
See the bottom of this page for the code created in the above Intro video.
This part of the code allows the following 2D worlds to be created:
-
class Proce55ors
Simple lists of objects to be independently drawn and animation -
class Zoned*
Complex "zoned" large worlds where only parts of the world are active based on the camera/screen position. -
class ZSorted*
Z-sorted worlds like you might see in Double Dragon style platformer or a point-and-click adventure -
class FireAndForget*
or includeWrapping
orLimited
Worlds that wrap, are limited to a rectangle (don't wrap or wrap within an arbitrary size), or exist just to handle "fire and forget" particles - Parallax and/or animated textures (Render-to-Texture onto an FBO shown later in a 2D or 3D world) or backgrounds (when treated as a layer in a more complex system)
These classes are specialized to different purposes, and range from simpler to more complicated.
I anecdotally cover this portion of the engine in the following video: Overview of the Proce55or Class Family (video)
Another, of the more specific implementations, is a series of interlocking classes around the theme of "linear progression". Those classes are:
-
Presentation
A linear presentation medium that can also be looped, so that you can create interactivity and/or cutscenes in the style of a Macromedia Director / Flash / Powerpoint kind of way by programmatically creating artistic animations. -
Slide
Contains elements displayed over a specific duration of time -
VisualAid
/fx_*
Specialized children of the Proce55or class that work in the Presentation class and expect to work directly with Presentation as a parent manager class, as part of a Slide
Code from the Intro to Proce55ors video (built from MyFirstWindow.h)
#pragma once
#include "Art.h"
#include "GLWindow.h"
#include "Proce55or.h"
#include "TextureLibrary.h"
class Spaceman : public Proce55or {
public:
Zp<GLImage> guy;
Zdouble angle;
Crayon tint;
void Setup() {
guy=library.Load("data/images/astro.png");
angle=uniform()*360.0;
tint.Brights((int)(uniform()*1024.0));
}
void Between() {
x+=(int)(3.0*uniform()-1.5)*2;
y+=(int)(3.0*uniform()-1.5)*2;
angle+=uniform();
}
void Render() {
PivotedRotatedRectd(guy,tint,transparency,x,y,0.0,0.0,guy->height/2,guy->width/2,angle);
}
};
class MyFirstWindow : public GLWindow {
public:
Proce55ors p5;
void Init() {
Fullscreen();
background.Pick(black);
}
ZIndexed<Cartesian> stars;
void Setup() {
stars.Size(500);
for ( int i=0; i<(int)stars.length; i++ ) {
stars[i].Set((int)((double)this->w*uniform()),(int)((double)this->h*uniform()));
}
Spaceman *s=new Spaceman;
s->x=(int)((double)this->w*uniform());
s->y=(int)((double)this->h*uniform());
p5.Add(s);
p5.Go();
}
void Between() {
if ( input->KeyDown(DX_SPACE)) for (int i = 0; i < (int)stars.length; i++) {
stars[i].x += (int)(uniform()*3.0 - 1.5);
stars[i].y += (int)(uniform()*3.0 - 1.5);
} else if ( input->KeyDown(DX_LEFT) ) for (int i = 0; i < (int)stars.length; i++) {
stars[i].x -= 1;
} else if ( input->KeyDown(DX_RIGHT) ) for (int i = 0; i < (int)stars.length; i++) {
stars[i].x += 1;
} else if ( input->KeyDown(DX_UP) ) for (int i = 0; i < (int)stars.length; i++) {
stars[i].y -= 1;
} else if ( input->KeyDown(DX_DOWN) ) for (int i = 0; i < (int)stars.length; i++) {
stars[i].y += 1;
}
if ( input->left ) { // input->leftReleased() would limit to just 1 per click
Spaceman *s=new Spaceman;
s->x=input->mxi;
s->y=input->myi;
p5.Add(s);
s->Setup();
}
p5.Between();
}
Crayon ink;
void Render() {
for ( int i=0; i<(int)stars.length; i++ ) {
ink.Pick((Colors)(i+5));
Rectangle(ink,stars[i].x-1,stars[i].y-1,stars[i].x+1,stars[i].y+1);
}
p5.Render();
}
};
Find us on YouTube channel "GraphicsAddict" and explore the engine and framework: GraphicsAddict channel on YT