📄 app.cpp
字号:
#include "App.h"
#include "dprintf.h"
#include <lang/GlobalStorage.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <config.h>
using namespace lang;
App::App()
{
for ( int i = 0 ; i < KEY_COUNT ; ++i )
m_keydown[i] = false;
// set path
strcpy( path, "" );
lang::GlobalStorage::get().userGlobals = this;
}
App::~App()
{
}
bool App::isInitDone()
{
return true;
}
void App::init( Context* /*context*/, SoundContext* /*soundcontext*/ )
{
}
bool App::update( Fix /*dt*/, Context* /*context*/ )
{
return true;
}
void App::keyDown( KeyType key )
{
m_keydown[key] = true;
}
void App::keyUp( KeyType key )
{
m_keydown[key] = false;
}
bool App::isKeyDown( KeyType key ) const
{
return m_keydown[key];
}
const char* App::expandPath( const char* fname ) const
{
assert( int(strlen(fname)+strlen(path)) < (int)sizeof(m_expandedPath) );
strcpy( m_expandedPath, path );
strcat( m_expandedPath, fname );
for ( int i = 0 ; 0 != m_expandedPath[i] ; ++i )
if ( '/' == m_expandedPath[i] )
m_expandedPath[i] = '\\';
return m_expandedPath;
}
App* App::get()
{
return reinterpret_cast<App*>( lang::GlobalStorage::get().userGlobals );
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -