PocketMatrix forums

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

Pocket Frog-based editor on desktop PCs...

Hi,

I'm thinking about trying to use PF to do an editor for a PDA game (so I can share code, and will only have to get familiar with one graphics API). However, I'd like to run the editor on my desktop PC in a large window, since it will provide a better editing area.

Is there an easy way to set the screensize using the simplified Game class framework, or should I be looking more at creating my own display surface?

To be honest I've not exactly thought this through entirely, so maybe I shouldn't be trying to use PF for this at all!

All suggestions welcome,

L.
I've done this. There may be a better way, but I modified PF to include a couple of extra variables (desktopWidth and desktopHeight)

in game.h
Code:

struct Config
{
LPCTSTR szWindowName; // Window title
Orientation orientation; // Screen orientation (default = ORIENTATION_NORTH)


int desktopWidth;
int desktopHeight;
} m_config;


And in game.cpp
Code:

Game::Game()
{
m_config.szWindowName = _T( "PocketFrog" );
m_config.orientation = ORIENTATION_NORMAL;

m_config.desktopWidth = 240;
m_config.desktopHeight = 320;

ZeroMemory( &m_keys, sizeof(m_keys) );
}




bool Game::Init()
{

#if defined(FROG_HPC)
// Handheld PC: force orientation to NORTH
m_config.orientation = ORIENTATION_NORMAL;
#endif

m_bSuspended = false;

//GetWndClassInfo().m_wc.style &= ~CS_DBLCLKS;
GetWndClassInfo().m_wc.style = CS_HREDRAW | CS_VREDRAW;
GetWndClassInfo().m_wc.hbrBackground = 0;

// Create the window
#if defined(_WIN32_WCE)
Rect r( 0, 0, ::GetSystemMetrics( SM_CXSCREEN ), ::GetSystemMetrics( SM_CYSCREEN ) );
DWORD style = WS_VISIBLE;
#else
Rect r( CW_USEDEFAULT, CW_USEDEFAULT, 0, 0 );
DWORD style = WS_SYSMENU;
#endif

#if defined(FROG_HPC)
DWORD exStyle = WS_EX_TOPMOST;
#else
DWORD exStyle = 0;
#endif

if (!Create( 0, r, m_config.szWindowName, style, exStyle ))
{
FatalError( _T("Window creation failed") );
return false;
}

#if defined(FROG_PC)
// Make sure the window is of the proper size
// Changed 06-10-2003 by Frank W. Zammetti
int width, height;

// J Elmore 09/05/2004
width = m_config.desktopWidth;//240;
height = m_config.desktopHeight;//320;

if (m_config.orientation == ORIENTATION_ROTATE90CW || m_config.orientation == ORIENTATION_ROTATE90CCW)
swap( width, height );

ResizeClient( width, height );
#endif

// Init display
PHAL::DisplayParameters params;
params.m_orientation = m_config.orientation;

// J Elmore 09/05/2004
params.m_height = m_config.desktopHeight;
params.m_width = m_config.desktopWidth;


m_display.reset( Display::Create( m_hWnd, params ) );
if (!m_display.get())
return false;


#if defined(FROG_PC)
ShowWindow( SW_SHOWNORMAL );
#endif


// Init input
if (!PHAL::GetKeyList( &m_keys, m_config.orientation ))
return false;

// In case ORIENTATION_UNKNOWN was selected
m_config.orientation = m_display->GetOrientation();

return true;
}



Then in your editor, you can specify the height/width of the window you want in your app when you set the parameters of m_config.
Excellent, thanks for the help! :)

L.
What version of PF was this done in? With PF8 I can't get the PHAL buffer to resize.
That 'was' 0.8 (using phal 0.7.6) before I tweaked it. I assume I posted everything correctly, since the other poster didn't have problems.

Did you rebuild the PF lib after you made the changes? For the correct platform and release?
Sorry, I didn't have my setup correct. I got it to successfully switch resolutions on the desktop.

Thanks for responding.