PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Pocket Frog new release?

Hi,

Now that PocketHal has been released, is there any sign of a PF 8.0 release?

Glen.
It's almost there... I have the Blit sample running on my device... I am toying with the idea of getting rid of the Rasterizer class right now (instead of waiting for one more release).

But this doesn't mean the shaders will go away. They will of course stay.

Most of the work needed at this point is project settings and configuration management (god do I hate these things).
Thierry wrote:I am toying with the idea of getting rid of the Rasterizer class right now (instead of waiting for one more release).

Whoa..... Getting rid of the Rasterizer class? What would take its place? Or where would its functions move to?

For those who don't know, the Rasterizer class has the following functions:
Code:
// Primitives
void Blit( int destX, int destY, const Surface* source, const Rect* srcRect = 0 );
void Blit( Point dest, const Surface* source, const Rect* srcRect = 0 );
void Clear( Pixel color );
void SetPixel( int x, int y, Pixel color );
void SetPixel( Point point, Pixel color );
void DrawCircle( int x, int y, int radius, Pixel color );
void DrawCircle( Point point, int radius, Pixel color );
void DrawLine( int x1, int y1, int x2, int y2, Pixel color );
void DrawLine( Point point1, Point point2, Pixel color );
void DrawHLine( int x, int y, int length, Pixel color );
void DrawHLine( Point point, int length, Pixel color );
void DrawVLine( int x, int y, int length, Pixel color );
void DrawVLine( Point point, int length, Pixel color );
void DrawRect( int x1, int y1, int x2, int y2, Pixel color );
void DrawRect( const Rect& rect, Pixel color );
void FillRect( int x1, int y1, int x2, int y2, Pixel color );
void FillRect( const Rect& rect, Pixel color );
void DrawPoly( Point points[], int pointCount, Pixel color );
void FillPoly( Point points[], int pointCount, Pixel Color );
void DrawVGAText( unsigned char* pFont, TCHAR* string, int align, int locX, int locY, Pixel color );
void BlitRotated( int destX, int destY, float angle, const Surface* source );
void BlitStretch( const Rect& dest, const Surface* source, const Rect* srcRect = 0 );
void BlitRotatedStretch( int destx, int desty, float angle, const Surface* source, Surface* stretch_surface, const Rect* src_rect);
void BlitRotatedStretch( Point point, float angle, const Surface* source, Surface* stretch_surface, const Rect* src_rect);
Pixel GetPixel( int x, int y );
const Rect& GetClipping() const { return m_clipper; }
void SetBlending( uint8_t alpha );
void SetClipping( const Rect& rect );
void SetDefaultShader();
void SetPixelShader( PixelShader* shader );
Surface* SetRenderTarget( Surface* target );


That's such an important collection of functions... Thierry, please enlighten me as to how these will be implemented without the Rasterizer class. (I obviously know they won't be disappearing, but how you intend to implement them currently eludes me.)

Thanks,
-John
Presto:

They would become free standing function. An extra parameter would be added to each one for the destination surface. Clipping would be moved to the surface (i.e. Surface::SetClip()).

Drawing a line would become:

Code:

Line( destSurface, x1, y1, x2, y2, color )


Shaders would be implemented using templates (instead of a virtual function call), and you would use them like this:

Code:

Line( destSurface, x1, y1, x2, y2, color, AlphaBlend( 100 ) );


The Rasterizer class currently does only 2 things:
1) Hold the clipping rect
2) Abstract the use of the internal "GraphicBuffer" class.

Thing is #2 doesn't apply anymore (there isn't a need for the GraphicBuffer class anymore since PocketFrog doesn't need rotated surfaces anymore).

Which leave us with only clipping. Using templatized functions would be so much better then virtual functions, and this isn't possible with EVC3.0/4.0 inside a class. (No member templates.)

Hence my reasoning...
I like the idea. The only concern I would have is porting older code. It's obviously going to take some work to put the dest durface in all the function calls.

Here's a suggestion... Create something along the lines of a SetDestSurface method that would, as it's name implies, set a default surface as the output of all functions formerly in the rasterizer. Then, overload all those methods so that one version is as you stated in this thread, another is as it previously was, without the dest surface. If you use the later, as old code would essentially do, then the surface specified by the SetDestSurface call applies.

Then, porting old code, I THINK anyway, is reduced to just adding that new SetDestSurface call in the GameLoop.

I may not have thought this out clearly and far enough, but details aside I think the basic idea is sound.
That's not a bad idea Fzammetti. Something like a stand-alone SetRenderTarget(). Only this time it would be a free standing function instead of a class method. I like this. I can see this as being useful for most uses anyways.
I like it too. It makes the standalone functions I've written seem like they'll fit in. (like FillCircle() and Collision()... if anybody wants them). My FillCircle function doesn't use clipping, but if that's moving to the surface, it doesn't need it.

I can finally see your point Thierry about PF being a lot smaller, faster and more functionally capable than ever before.

Soon we should consider having an extensive device library which correctly maps button presses. It seems the D-Pads use the same keycodes (for the most part), but A, B, C and Start are a free-for-all.

-John
Ah good, I had one good thought today. My job here is done :)

As for the key mapping thing, my thought there would be to simply have generic names for the value constants, and leave mapping as an application-level thing.

As an extreme example, say you have vkA, vkB, vkC, vkD, vkE, vkF, and so on, and these are the values that will be sent to the KeyDoen method, or whatever you call it. Now, on MOST devices vkA will be the code for UP, but we don't call it vkUP because on some devices maybe that underlying value ISN'T up. So, it's up to the app developer to provide a mapping function to get this right.

This makes coding slightly tougher, but it means that most applications would have to provide a mapping function, and basically as an application programmer I would have a variable called vkUp and I would assign it's value as one of the constants depending on what the user choose.

Basically what I'm getting at is put the responsibility on the application programmer, not PF. No need to collect device profiles for everything out there so that PF can do this for you. I'm actually not even sure *I* like this idea to be honest, I have to think about it some more. But, as I think most apps should provide a key mapping function, games certainly, this almost forces the issue (you would of course have some default values that probably are going to work for most devices anyway, certainly the directions as Presto pointed out should be fine 99% of the time)
Concerning keys mapping: we already have the keylist as returned by GAPI. PocketHAL also return other keys not available in GAPI.

So it is simply a matter of calling PHAL::GetKeylist() and comparing the pressed key codes with the key list.

What more is needed? Am I missing anything?
Sufficient as far as I can see. I'll be including a key mapper in all my new projects anyway, regardless of library, so for me it's kind of a moot point really. Just trying to think it there was an even more flexible approach is all.
Sure, I use GetKeyList(), and provide key-mapping functionality in Dr. Pocket.

Here's where I'm coming from. When Dr. Pocket was first released, I didn't include key-mapping functionality. When the game was reviewed, I discovered (to my surprise) that the right-most button on the Axim X5 (vkStart), is the D-Pad center button on the h1910.

So... If the right-most button is supposed to do a certain function, how will I know if the button being pressed IS the right-most button? I used to think I could check for vkStart... Now I know I can't.

Also, when keymapping... You have to remember that for each button press, you get the ButtonDown() and ButtonUp() functions called twice. Once with a dummy key value, and once with the real key value. Some other threads state that not even the dummy values are the same across devices, so discarding certain values can be dangerous.

It doesn't seem like there are any good solutions to this.