mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
JoystickManager is not open by default.
DejaVu Sans Mono font has been replaced with the NerdFont version. eterm visual and performance improvements (support strike-through, underline, italics).
This commit is contained in:
BIN
bin/assets/fonts/DejaVuSansMono.ttf
Executable file → Normal file
BIN
bin/assets/fonts/DejaVuSansMono.ttf
Executable file → Normal file
Binary file not shown.
@@ -13,8 +13,10 @@ class EE_API GlyphDrawable : public DrawableResource {
|
||||
const std::string& resourceName = "" );
|
||||
|
||||
enum class DrawMode {
|
||||
Image, ///< It will be treated as a simple image, no special offset is applied.
|
||||
Text ///< Will add the glyph offset corresponding to that character
|
||||
Image, ///< It will be treated as a simple image, no special offset is applied.
|
||||
Text, ///< Will add the glyph offset corresponding to that character
|
||||
TextItalic ///< Will add the glyph offset corresponding to that character and simulate
|
||||
///< italic skew
|
||||
};
|
||||
|
||||
GlyphDrawable( Texture* texture, const Rect& srcRect, const std::string& resourceName = "" );
|
||||
@@ -55,7 +57,7 @@ class EE_API GlyphDrawable : public DrawableResource {
|
||||
Rectf mSrcRect;
|
||||
Float mPixelDensity;
|
||||
Vector2f mGlyphOffset;
|
||||
DrawMode mDrawMode{DrawMode::Image};
|
||||
DrawMode mDrawMode{ DrawMode::Image };
|
||||
};
|
||||
|
||||
}} // namespace EE::Graphics
|
||||
|
||||
@@ -9,6 +9,8 @@ namespace EE { namespace Window {
|
||||
/** @brief A Joystick Manager class */
|
||||
class EE_API JoystickManager {
|
||||
public:
|
||||
typedef std::function<void()> OpenCb;
|
||||
|
||||
JoystickManager();
|
||||
|
||||
virtual ~JoystickManager();
|
||||
@@ -31,12 +33,13 @@ class EE_API JoystickManager {
|
||||
virtual void close();
|
||||
|
||||
/** Open all the joysticks */
|
||||
virtual void open();
|
||||
virtual void open( OpenCb openCb = nullptr );
|
||||
|
||||
protected:
|
||||
friend class Joystick;
|
||||
|
||||
bool mInit;
|
||||
OpenCb mOpenCb;
|
||||
|
||||
Joystick* mJoysticks[MAX_JOYSTICKS];
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 7.0.2, 2022-06-20T19:53:42. -->
|
||||
<!-- Written by QtCreator 7.0.2, 2022-06-23T01:07:29. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{b6114084-39c2-4cd0-b9e2-d8803dc6b446}</value>
|
||||
<value type="QByteArray">{d43f4693-30c1-436c-b1d1-498aab2c2f8c}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
@@ -83,7 +83,6 @@
|
||||
<valuemap type="QVariantMap" key="ClangTools">
|
||||
<value type="bool" key="ClangTools.AnalyzeOpenFiles">false</value>
|
||||
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
|
||||
<value type="QString" key="ClangTools.DiagnosticConfig"></value>
|
||||
<value type="int" key="ClangTools.ParallelJobs">0</value>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
|
||||
@@ -109,7 +108,7 @@
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{388e5431-b31b-42b3-b9ad-9002d279d75d}</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">10</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">20</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">../../make/linux</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
@@ -1433,8 +1432,8 @@
|
||||
<variable>ProjectExplorer.Project.Target.1</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="DeviceType">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Replacement for "Imported Kit"</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Replacement for "Imported Kit"</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Imported Kit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Imported Kit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{c0864b34-7205-4013-af48-71ab04d386b1}</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
@@ -1519,6 +1518,16 @@
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>UserStickyKeys</variable>
|
||||
<valuelist type="QVariantList">
|
||||
<value type="QString">ProjectExplorer.Project.Target.0</value>
|
||||
<value type="QString">ProjectExplorer.Project.Target.0/ProjectExplorer.Target.ActiveRunConfiguration</value>
|
||||
<value type="QString">ProjectExplorer.Project.Target.1</value>
|
||||
<value type="QString">ProjectExplorer.Project.Target.1/ProjectExplorer.ProjectConfiguration.DefaultDisplayName</value>
|
||||
<value type="QString">ProjectExplorer.Project.Target.1/ProjectExplorer.ProjectConfiguration.DisplayName</value>
|
||||
</valuelist>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">22</value>
|
||||
|
||||
@@ -38,6 +38,12 @@ void GlyphDrawable::draw( const Vector2f& position, const Sizef& size ) {
|
||||
mSrcRect.Top + mSrcRect.Bottom );
|
||||
if ( mDrawMode == DrawMode::Image ) {
|
||||
BR->batchQuad( position.x, position.y, size.getWidth(), size.getHeight() );
|
||||
} else if ( mDrawMode == DrawMode::TextItalic ) {
|
||||
Float x = position.x + mGlyphOffset.x;
|
||||
Float y = position.y + mGlyphOffset.y;
|
||||
Float italic = 0.208f * size.getWidth(); // 12 degrees
|
||||
BR->batchQuadFree( x + italic, y, x, y + size.getHeight(), x + size.getWidth(),
|
||||
y + size.getHeight(), x + size.getWidth() + italic, y );
|
||||
} else {
|
||||
BR->batchQuad( position.x + mGlyphOffset.x, position.y + mGlyphOffset.y, size.getWidth(),
|
||||
size.getHeight() );
|
||||
|
||||
@@ -110,9 +110,6 @@ Scancode InputSDL::getScancodeFromKey( const Keycode& scancode ) const {
|
||||
void InputSDL::init() {
|
||||
mDPIScale = mWindow->getScale();
|
||||
mMousePos = queryMousePos();
|
||||
#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN
|
||||
mJoystickManager->open();
|
||||
#endif
|
||||
}
|
||||
|
||||
void InputSDL::sendEvent( const SDL_Event& SDLEvent ) {
|
||||
|
||||
@@ -44,10 +44,14 @@ void JoystickManagerSDL::openAsync() {
|
||||
create( i );
|
||||
|
||||
mInit = true;
|
||||
|
||||
if ( mOpenCb )
|
||||
mOpenCb();
|
||||
}
|
||||
}
|
||||
|
||||
void JoystickManagerSDL::open() {
|
||||
void JoystickManagerSDL::open( OpenCb openCb ) {
|
||||
mOpenCb = openCb;
|
||||
mAsyncInit.launch();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class EE_API JoystickManagerSDL : public JoystickManager {
|
||||
|
||||
void close();
|
||||
|
||||
void open();
|
||||
void open( OpenCb openCb = nullptr );
|
||||
|
||||
protected:
|
||||
void create( const Uint32& index );
|
||||
|
||||
@@ -5,8 +5,6 @@ namespace EE { namespace Window {
|
||||
JoystickManager::JoystickManager() : mInit( false ), mCount( 0 ) {
|
||||
for ( Uint32 i = 0; i < MAX_JOYSTICKS; i++ )
|
||||
mJoysticks[i] = NULL;
|
||||
|
||||
open();
|
||||
}
|
||||
|
||||
JoystickManager::~JoystickManager() {
|
||||
@@ -28,11 +26,13 @@ Joystick* JoystickManager::getJoystick( const Uint32& index ) {
|
||||
void JoystickManager::rescan() {
|
||||
close();
|
||||
|
||||
open();
|
||||
open( mOpenCb );
|
||||
}
|
||||
|
||||
void JoystickManager::close() {}
|
||||
|
||||
void JoystickManager::open() {}
|
||||
void JoystickManager::open( OpenCb openCb ) {
|
||||
mOpenCb = openCb;
|
||||
}
|
||||
|
||||
}} // namespace EE::Window
|
||||
|
||||
@@ -146,6 +146,9 @@ void EETest::init() {
|
||||
KM = mWindow->getInput();
|
||||
JM = KM->getJoystickManager();
|
||||
|
||||
if ( mJoyEnabled )
|
||||
KM->getJoystickManager()->open();
|
||||
|
||||
PS.resize( 5 );
|
||||
|
||||
Scenes[0] = cb::Make0( this, &EETest::physicsUpdate );
|
||||
@@ -901,7 +904,7 @@ void EETest::createNewUI() {
|
||||
->setLayoutSizePolicy( SizePolicy::MatchParent, SizePolicy::Fixed )
|
||||
->setSize( 0, 105 )
|
||||
->setParent( lay2 );
|
||||
lbox->addListBoxItems( {"This", "is", "a", "ListBox"} );
|
||||
lbox->addListBoxItems( { "This", "is", "a", "ListBox" } );
|
||||
lay2->setParent( layPar );
|
||||
lay->setParent( layPar );
|
||||
|
||||
@@ -909,7 +912,7 @@ void EETest::createNewUI() {
|
||||
drop->setLayoutMargin( Rectf( 10, 10, 10, 10 ) )
|
||||
->setLayoutSizePolicy( SizePolicy::MatchParent, SizePolicy::WrapContent )
|
||||
->setParent( layWin );
|
||||
drop->getListBox()->addListBoxItems( {"Car", "Bus", "Plane", "Submarine"} );
|
||||
drop->getListBox()->addListBoxItems( { "Car", "Bus", "Plane", "Submarine" } );
|
||||
drop->getListBox()->setSelected( 0 );
|
||||
win->show();
|
||||
|
||||
@@ -1135,7 +1138,7 @@ void EETest::createDecoratedWindow() {
|
||||
Button->addEventListener( Event::MouseClick, cb::Make1( this, &EETest::onButtonClick ) );
|
||||
|
||||
mUIWindow->setKeyBindingCommand( "button-click", [&] { addFlyingIcon(); } );
|
||||
mUIWindow->addKeyBinding( {KEY_C, KEYMOD_LALT}, "button-click" );
|
||||
mUIWindow->addKeyBinding( { KEY_C, KEYMOD_LALT }, "button-click" );
|
||||
|
||||
UITabWidget* TabWidget = UITabWidget::New();
|
||||
TabWidget->setLayoutMargin( Rectf( 5, 5, 5, 5 ) )
|
||||
@@ -1601,12 +1604,12 @@ void EETest::screen2() {
|
||||
if ( mUseShaders )
|
||||
mShaderProgram->unbind();
|
||||
|
||||
TNP[3]->draw( HWidth - 128, HHeight, 0, Vector2f::One, Color( 255, 255, 255, 150 ), BlendMode::Alpha(),
|
||||
RENDER_ISOMETRIC );
|
||||
TNP[3]->draw( HWidth - 128, HHeight, 0, Vector2f::One, Color( 255, 255, 255, 150 ),
|
||||
BlendMode::Alpha(), RENDER_ISOMETRIC );
|
||||
TNP[3]->draw( HWidth - 128, HHeight - 128, 0, Vector2f::One, Color( 255, 255, 255, 50 ),
|
||||
BlendMode::Alpha(), RENDER_ISOMETRIC );
|
||||
TNP[3]->draw( HWidth - 128, HHeight, 0, Vector2f::One, Color( 255, 255, 255, 50 ), BlendMode::Alpha(),
|
||||
RENDER_ISOMETRIC_VERTICAL );
|
||||
TNP[3]->draw( HWidth - 128, HHeight, 0, Vector2f::One, Color( 255, 255, 255, 50 ),
|
||||
BlendMode::Alpha(), RENDER_ISOMETRIC_VERTICAL );
|
||||
TNP[3]->draw( HWidth, HHeight, 0, Vector2f::One, Color( 255, 255, 255, 50 ), BlendMode::Alpha(),
|
||||
RENDER_ISOMETRIC_VERTICAL_NEGATIVE );
|
||||
|
||||
@@ -1692,7 +1695,7 @@ void EETest::screen2() {
|
||||
PR.setColor( Color( 255, 255, 0, 255 ) );
|
||||
|
||||
PR.setFillMode( DRAW_LINE );
|
||||
PR.drawCircle( Vector2f( Mousef.x, Mousef.y ), 80.f, ( Uint32 )( Ang / 3 ) );
|
||||
PR.drawCircle( Vector2f( Mousef.x, Mousef.y ), 80.f, (Uint32)( Ang / 3 ) );
|
||||
PR.drawTriangle( Triangle2f( Vector2f( Mousef.x, Mousef.y - 10.f ),
|
||||
Vector2f( Mousef.x - 10.f, Mousef.y + 10.f ),
|
||||
Vector2f( Mousef.x + 10.f, Mousef.y + 10.f ) ) );
|
||||
@@ -1760,8 +1763,8 @@ void EETest::screen4() {
|
||||
mVBO->unbind();
|
||||
|
||||
mFBOText.setAlign( TEXT_ALIGN_CENTER );
|
||||
mFBOText.draw( 128.f - ( Float )( Int32 )( mFBOText.getTextWidth() * 0.5f ),
|
||||
25.f - ( Float )( Int32 )( mFBOText.getTextHeight() * 0.5f ) );
|
||||
mFBOText.draw( 128.f - (Float)(Int32)( mFBOText.getTextWidth() * 0.5f ),
|
||||
25.f - (Float)(Int32)( mFBOText.getTextHeight() * 0.5f ) );
|
||||
}
|
||||
|
||||
Vector2f center( mFBO->getWidth() * 0.5f, mFBO->getHeight() * 0.5f );
|
||||
@@ -1916,7 +1919,9 @@ void EETest::render() {
|
||||
|
||||
void EETest::input() {
|
||||
KM->update();
|
||||
JM->update();
|
||||
|
||||
if ( mJoyEnabled )
|
||||
JM->update();
|
||||
|
||||
Mouse = KM->getMousePos();
|
||||
Mousef = Vector2f( (Float)Mouse.x, (Float)Mouse.y );
|
||||
@@ -2017,9 +2022,9 @@ void EETest::input() {
|
||||
if ( KM->isKeyUp( KEY_6 ) && KM->isControlPressed() )
|
||||
setScreen( 5 );
|
||||
|
||||
Joystick* Joy = JM->getJoystick( 0 );
|
||||
Joystick* Joy = mJoyEnabled ? JM->getJoystick( 0 ) : NULL;
|
||||
|
||||
if ( mJoyEnabled && NULL != Joy ) {
|
||||
if ( NULL != Joy ) {
|
||||
if ( Joy->isButtonDown( 0 ) )
|
||||
KM->injectButtonPress( EE_BUTTON_LEFT );
|
||||
if ( Joy->isButtonDown( 1 ) )
|
||||
|
||||
@@ -95,7 +95,7 @@ EE_MAIN_FUNC int main( int, char*[] ) {
|
||||
shell = "/bin/bash";
|
||||
}
|
||||
|
||||
terminal = ETerminalDisplay::create( win, fontMono, PixelDensity::dpToPx( 12 ),
|
||||
terminal = ETerminalDisplay::create( win, fontMono, PixelDensity::dpToPx( 11 ),
|
||||
win->getSize().asFloat(), shell, {}, "", 0 );
|
||||
}
|
||||
|
||||
|
||||
@@ -432,8 +432,14 @@ int ETerminalDisplay::resetColor( int index, const char* name ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool ETerminalDisplay::isBlinkingCursor() {
|
||||
return mCursorMode == EE::Terminal::BlinkingBlock ||
|
||||
mCursorMode == EE::Terminal::BlinkingBlockDefault ||
|
||||
mCursorMode == EE::Terminal::BlinkUnderline || mCursorMode == EE::Terminal::BlinkBar;
|
||||
}
|
||||
|
||||
void ETerminalDisplay::update() {
|
||||
if ( mClock.getElapsedTime().asSeconds() > 0.7 ) {
|
||||
if ( mFocus && isBlinkingCursor() && mClock.getElapsedTime().asSeconds() > 0.7 ) {
|
||||
mMode ^= MODE_BLINK;
|
||||
mClock.restart();
|
||||
invalidate();
|
||||
@@ -576,9 +582,11 @@ void ETerminalDisplay::draw( Vector2f pos ) {
|
||||
|
||||
float x = 0.0f;
|
||||
float y = std::floor( pos.y );
|
||||
const float line_height = fontSize;
|
||||
const float lineHeight = fontSize;
|
||||
auto defaultFg = termColor( mEmulator->getDefaultForeground(), mColors );
|
||||
auto defaultBg = termColor( mEmulator->getDefaultBackground(), mColors );
|
||||
auto borderPx = eeceil( PixelDensity::dpToPx( 1.f ) );
|
||||
auto cursorThickness = eeceil( PixelDensity::dpToPx( 1.f ) );
|
||||
|
||||
Primitives p;
|
||||
p.setForceDraw( false );
|
||||
@@ -588,7 +596,7 @@ void ETerminalDisplay::draw( Vector2f pos ) {
|
||||
for ( int j = 0; j < mRows; j++ ) {
|
||||
x = std::floor( pos.x );
|
||||
|
||||
if ( pos.y + line_height * j > mSize.getWidth() )
|
||||
if ( pos.y + lineHeight * j > mSize.getWidth() )
|
||||
break;
|
||||
|
||||
for ( int i = 0; i < mColumns; i++ ) {
|
||||
@@ -616,12 +624,12 @@ void ETerminalDisplay::draw( Vector2f pos ) {
|
||||
}
|
||||
|
||||
p.setColor( bg );
|
||||
p.drawRectangle( Rectf( { x, y }, { advanceX, line_height } ) );
|
||||
p.drawRectangle( Rectf( { x, y }, { advanceX, lineHeight } ) );
|
||||
|
||||
x += advanceX;
|
||||
}
|
||||
|
||||
y += line_height;
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
y = std::floor( pos.y );
|
||||
@@ -629,7 +637,7 @@ void ETerminalDisplay::draw( Vector2f pos ) {
|
||||
for ( int j = 0; j < mRows; j++ ) {
|
||||
x = std::floor( pos.x );
|
||||
|
||||
if ( pos.y + line_height * j > mSize.getWidth() )
|
||||
if ( pos.y + lineHeight * j > mSize.getWidth() )
|
||||
break;
|
||||
|
||||
for ( int i = 0; i < mColumns; i++ ) {
|
||||
@@ -670,45 +678,31 @@ void ETerminalDisplay::draw( Vector2f pos ) {
|
||||
|
||||
auto* gd = mFont->getGlyphDrawable( glyph.u, mFontSize, glyph.mode & ATTR_BOLD );
|
||||
gd->setColor( fg );
|
||||
gd->setDrawMode( GlyphDrawable::DrawMode::Text );
|
||||
gd->setDrawMode( glyph.mode & ATTR_ITALIC ? GlyphDrawable::DrawMode::TextItalic
|
||||
: GlyphDrawable::DrawMode::Text );
|
||||
gd->draw( { x, y } );
|
||||
|
||||
if ( glyph.mode & ATTR_UNDERLINE ) {
|
||||
p.setColor( fg );
|
||||
p.drawRectangle( Rectf( { x, y + borderPx + lineHeight - cursorThickness },
|
||||
{ advanceX, cursorThickness } ) );
|
||||
}
|
||||
|
||||
if ( glyph.mode & ATTR_STRUCK ) {
|
||||
p.setColor( fg );
|
||||
p.drawRectangle( Rectf( { x, y + borderPx + eefloor( lineHeight / 2.f ) },
|
||||
{ advanceX, cursorThickness } ) );
|
||||
}
|
||||
|
||||
if ( glyph.mode & ATTR_BOXDRAW && mUseBoxDrawing ) {
|
||||
// auto bd = TerminalEmulator::boxdrawindex( &glyph );
|
||||
// drawbox( x, y, advanceX, line_height, fg, bg, bd, vtx_write );
|
||||
// drawbox( x, y, advanceX, line_height, fg, bg, bd );
|
||||
}
|
||||
|
||||
/*if ( glyph.mode & ATTR_STRUCK ) {
|
||||
ImVec2 a( x, y + 2 * ascent / 3 );
|
||||
ImVec2 c( x + advanceX, a.y + 1 );
|
||||
ImVec2 b( c.x, a.y ), d( a.x, c.y ), uv( drawList->_Data->TexUvWhitePixel );
|
||||
idx_write[0] = vtx_current_idx;
|
||||
idx_write[1] = (ImDrawIdx)( vtx_current_idx + 1 );
|
||||
idx_write[2] = (ImDrawIdx)( vtx_current_idx + 2 );
|
||||
idx_write[3] = vtx_current_idx;
|
||||
idx_write[4] = (ImDrawIdx)( vtx_current_idx + 2 );
|
||||
idx_write[5] = (ImDrawIdx)( vtx_current_idx + 3 );
|
||||
vtx_write[0].pos = a;
|
||||
vtx_write[0].uv = uv;
|
||||
vtx_write[0].col = fg;
|
||||
vtx_write[1].pos = b;
|
||||
vtx_write[1].uv = uv;
|
||||
vtx_write[1].col = fg;
|
||||
vtx_write[2].pos = c;
|
||||
vtx_write[2].uv = uv;
|
||||
vtx_write[2].col = fg;
|
||||
vtx_write[3].pos = d;
|
||||
vtx_write[3].uv = uv;
|
||||
vtx_write[3].col = fg;
|
||||
vtx_write += 4;
|
||||
vtx_current_idx += 4;
|
||||
idx_write += 6;
|
||||
}*/
|
||||
|
||||
x += advanceX;
|
||||
}
|
||||
|
||||
y += line_height;
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
if ( !IS_SET( MODE_HIDE ) ) {
|
||||
@@ -728,9 +722,6 @@ void ETerminalDisplay::draw( Vector2f pos ) {
|
||||
|
||||
Vector2f a{}, b{}, c{}, d{};
|
||||
|
||||
auto borderpx = 1.f;
|
||||
auto cursorthickness = 2.f;
|
||||
|
||||
p.setColor( drawcol );
|
||||
/* draw the new one */
|
||||
if ( IS_SET( MODE_FOCUSED ) ) {
|
||||
@@ -747,8 +738,8 @@ void ETerminalDisplay::draw( Vector2f pos ) {
|
||||
auto* gd = mFont->getGlyphDrawable( mCursorGlyph.u, mFontSize );
|
||||
gd->setColor( termColor( mCursorGlyph.fg, mColors ) );
|
||||
gd->setDrawMode( GlyphDrawable::DrawMode::Text );
|
||||
gd->draw( { pos.x + borderpx + mCursor.x * spaceCharAdvanceX,
|
||||
pos.y + borderpx + mCursor.y * line_height } );
|
||||
gd->draw( { pos.x + borderPx + mCursor.x * spaceCharAdvanceX,
|
||||
pos.y + borderPx + mCursor.y * lineHeight } );
|
||||
break;
|
||||
}
|
||||
case 3: { /* Blinking Underline */
|
||||
@@ -757,9 +748,9 @@ void ETerminalDisplay::draw( Vector2f pos ) {
|
||||
}
|
||||
case 4: /* Steady Underline */
|
||||
p.drawRectangle( Rectf(
|
||||
{ pos.x + borderpx + mCursor.x * spaceCharAdvanceX,
|
||||
pos.y + borderpx + ( mCursor.y + 1 ) * line_height - cursorthickness },
|
||||
{ spaceCharAdvanceX, cursorthickness } ) );
|
||||
{ pos.x + borderPx + mCursor.x * spaceCharAdvanceX,
|
||||
pos.y + borderPx + ( mCursor.y + 1 ) * lineHeight - cursorThickness },
|
||||
{ spaceCharAdvanceX, cursorThickness } ) );
|
||||
break;
|
||||
case 5: { /* Blinking bar */
|
||||
if ( !( mMode & MODE_BLINK ) )
|
||||
@@ -767,16 +758,16 @@ void ETerminalDisplay::draw( Vector2f pos ) {
|
||||
}
|
||||
case 6: /* Steady bar */
|
||||
case TerminalCursorMode::MAX_CURSOR:
|
||||
p.drawRectangle( Rectf( { pos.x + borderpx + mCursor.x * spaceCharAdvanceX,
|
||||
pos.y + mCursor.y * line_height },
|
||||
{ spaceCharAdvanceX, line_height } ) );
|
||||
p.drawRectangle( Rectf( { pos.x + borderPx + mCursor.x * spaceCharAdvanceX,
|
||||
pos.y + mCursor.y * lineHeight },
|
||||
{ spaceCharAdvanceX, lineHeight } ) );
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
p.setFillMode( PrimitiveFillMode::DRAW_LINE );
|
||||
p.drawRectangle( Rectf( { pos.x + borderpx + mCursor.x * spaceCharAdvanceX,
|
||||
pos.y + borderpx + mCursor.y * line_height },
|
||||
{ spaceCharAdvanceX, line_height } ) );
|
||||
p.drawRectangle( Rectf( { pos.x + borderPx + mCursor.x * spaceCharAdvanceX,
|
||||
pos.y + borderPx + mCursor.y * lineHeight },
|
||||
{ spaceCharAdvanceX, lineHeight } ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -174,6 +174,8 @@ class ETerminalDisplay : public TerminalDisplay {
|
||||
|
||||
void setFocus( bool focus );
|
||||
|
||||
bool isBlinkingCursor();
|
||||
|
||||
protected:
|
||||
EE::Window::Window* mWindow;
|
||||
std::vector<TerminalGlyph> mBuffer;
|
||||
@@ -191,9 +193,9 @@ class ETerminalDisplay : public TerminalDisplay {
|
||||
std::atomic<bool> mDrawing{ false };
|
||||
Vector2i mCursor;
|
||||
TerminalGlyph mCursorGlyph;
|
||||
bool mUseBoxDrawing;
|
||||
bool mUseColorEmoji;
|
||||
bool mPasteNewlineFix;
|
||||
bool mUseBoxDrawing{ true };
|
||||
bool mUseColorEmoji{ true };
|
||||
bool mPasteNewlineFix{ true };
|
||||
bool mFocus{ true };
|
||||
Clock mClock;
|
||||
|
||||
|
||||
@@ -613,7 +613,7 @@ void TerminalEmulator::tsetdirt( int top, int bot ) {
|
||||
|
||||
LIMIT( top, 0, mTerm.row - 1 );
|
||||
LIMIT( bot, 0, mTerm.row - 1 );
|
||||
|
||||
mDirty = true;
|
||||
for ( i = top; i <= bot; i++ )
|
||||
mTerm.dirty[i] = 1;
|
||||
}
|
||||
@@ -842,6 +842,7 @@ void TerminalEmulator::tsetchar( Rune u, TerminalGlyph* attr, int x, int y ) {
|
||||
mTerm.dirty[y] = 1;
|
||||
mTerm.line[y][x] = *attr;
|
||||
mTerm.line[y][x].u = u;
|
||||
mDirty = true;
|
||||
|
||||
if ( isboxdraw( u ) )
|
||||
mTerm.line[y][x].mode |= ATTR_BOXDRAW;
|
||||
@@ -863,6 +864,7 @@ void TerminalEmulator::tclearregion( int x1, int y1, int x2, int y2 ) {
|
||||
|
||||
for ( y = y1; y <= y2; y++ ) {
|
||||
mTerm.dirty[y] = 1;
|
||||
mDirty = true;
|
||||
for ( x = x1; x <= x2; x++ ) {
|
||||
gp = &mTerm.line[y][x];
|
||||
if ( selected( x, y ) )
|
||||
@@ -2135,6 +2137,7 @@ void TerminalEmulator::tresize( int col, int row ) {
|
||||
tcursor( CURSOR_LOAD );
|
||||
}
|
||||
mTerm.c = c;
|
||||
mDirty = true;
|
||||
}
|
||||
|
||||
void TerminalEmulator::resettitle( void ) {
|
||||
@@ -2154,6 +2157,8 @@ void TerminalEmulator::drawregion( TerminalDisplay& dpy, int x1, int y1, int x2,
|
||||
|
||||
dpy.drawLine( mTerm.line[y], x1, y, x2 );
|
||||
}
|
||||
|
||||
mDirty = false;
|
||||
}
|
||||
|
||||
void TerminalEmulator::draw() {
|
||||
@@ -2406,9 +2411,8 @@ void TerminalEmulator::update() {
|
||||
--n;
|
||||
}
|
||||
|
||||
// TODO: Handle blink
|
||||
|
||||
draw();
|
||||
if ( n != 1024 || mDirty )
|
||||
draw();
|
||||
|
||||
mProcess->checkExitStatus();
|
||||
|
||||
|
||||
@@ -177,12 +177,15 @@ class TerminalEmulator final {
|
||||
void mousereport( const TerminalMouseEventType& type, const Vector2i& pos, const Uint32& flags,
|
||||
const Uint32& mod );
|
||||
|
||||
const bool& isDirty() const { return mDirty; }
|
||||
|
||||
private:
|
||||
DpyPtr mDpy;
|
||||
PtyPtr mPty;
|
||||
ProcPtr mProcess;
|
||||
|
||||
bool mColorsLoaded;
|
||||
bool mDirty{ true };
|
||||
int mExitCode;
|
||||
|
||||
enum { STARTING = 0, RUNNING, TERMINATED } mStatus;
|
||||
|
||||
Reference in New Issue
Block a user