mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-07-23 03:02:50 +03:00
Some minor changes.
This commit is contained in:
@@ -52,39 +52,148 @@ std::vector<cShape*> cShapeGroupManager::GetShapesByPattern( const std::string&
|
||||
cShape * tShape = NULL;
|
||||
std::string realext = "";
|
||||
eeInt c = 0;
|
||||
eeInt t = 0;
|
||||
eeInt i;
|
||||
|
||||
if ( extension.size() )
|
||||
realext = "." + extension;
|
||||
|
||||
do {
|
||||
if ( c < 100 )
|
||||
search = StrFormated( "%s%02d%s", name.c_str(), c, realext.c_str() );
|
||||
else if ( c < 1000 )
|
||||
search = StrFormated( "%s%03d%s", name.c_str(), c, realext.c_str() );
|
||||
else if ( c < 10000 )
|
||||
search = StrFormated( "%s%04d%s", name.c_str(), c, realext.c_str() );
|
||||
else
|
||||
found = false;
|
||||
// Test if name starts with 0 - 1
|
||||
for ( i = 0; i < 2; i++ ) {
|
||||
search = StrFormated( "%s%d%s", name.c_str(), i, realext.c_str() );
|
||||
|
||||
if ( NULL == SearchInShapeGroup )
|
||||
tShape = GetShapeByName( search );
|
||||
else
|
||||
tShape = SearchInShapeGroup->GetByName( search );
|
||||
|
||||
if ( NULL != tShape ) {
|
||||
t = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// in case that name doesn't start with 0 - 1, we test with 00 - 01
|
||||
if ( 0 == t ) {
|
||||
for ( i = 0; i < 2; i++ ) {
|
||||
search = StrFormated( "%s%02d%s", name.c_str(), i, realext.c_str() );
|
||||
|
||||
if ( found ) {
|
||||
if ( NULL == SearchInShapeGroup )
|
||||
tShape = GetShapeByName( search );
|
||||
else
|
||||
tShape = SearchInShapeGroup->GetByName( search );
|
||||
|
||||
if ( NULL != tShape ) {
|
||||
Shapes.push_back( tShape );
|
||||
t = 2;
|
||||
|
||||
found = true;
|
||||
} else {
|
||||
if ( 0 == c ) // if didn't found "00", will search at least for "01"
|
||||
found = true;
|
||||
else
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
c++;
|
||||
} while ( found );
|
||||
// in case that name doesn't start with 0 - 1, we test with 000 - 001
|
||||
if ( 0 == t ) {
|
||||
for ( i = 0; i < 2; i++ ) {
|
||||
search = StrFormated( "%s%03d%s", name.c_str(), i, realext.c_str() );
|
||||
|
||||
if ( NULL == SearchInShapeGroup )
|
||||
tShape = GetShapeByName( search );
|
||||
else
|
||||
tShape = SearchInShapeGroup->GetByName( search );
|
||||
|
||||
if ( NULL != tShape ) {
|
||||
t = 3;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( 0 == t ) {
|
||||
for ( i = 0; i < 2; i++ ) {
|
||||
search = StrFormated( "%s%04d%s", name.c_str(), i, realext.c_str() );
|
||||
|
||||
if ( NULL == SearchInShapeGroup )
|
||||
tShape = GetShapeByName( search );
|
||||
else
|
||||
tShape = SearchInShapeGroup->GetByName( search );
|
||||
|
||||
if ( NULL != tShape ) {
|
||||
t = 4;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( 0 == t ) {
|
||||
for ( i = 0; i < 2; i++ ) {
|
||||
search = StrFormated( "%s%05d%s", name.c_str(), i, realext.c_str() );
|
||||
|
||||
if ( NULL == SearchInShapeGroup )
|
||||
tShape = GetShapeByName( search );
|
||||
else
|
||||
tShape = SearchInShapeGroup->GetByName( search );
|
||||
|
||||
if ( NULL != tShape ) {
|
||||
t = 5;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( 0 == t ) {
|
||||
for ( i = 0; i < 2; i++ ) {
|
||||
search = StrFormated( "%s%06d%s", name.c_str(), i, realext.c_str() );
|
||||
|
||||
if ( NULL == SearchInShapeGroup )
|
||||
tShape = GetShapeByName( search );
|
||||
else
|
||||
tShape = SearchInShapeGroup->GetByName( search );
|
||||
|
||||
if ( NULL != tShape ) {
|
||||
t = 6;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( 0 != t ) {
|
||||
do {
|
||||
switch ( t ) {
|
||||
case 1: search = StrFormated( "%s%d%s", name.c_str(), c, realext.c_str() ); break;
|
||||
case 2: search = StrFormated( "%s%02d%s", name.c_str(), c, realext.c_str() ); break;
|
||||
case 3: search = StrFormated( "%s%03d%s", name.c_str(), c, realext.c_str() ); break;
|
||||
case 4: search = StrFormated( "%s%04d%s", name.c_str(), c, realext.c_str() ); break;
|
||||
case 5: search = StrFormated( "%s%05d%s", name.c_str(), c, realext.c_str() ); break;
|
||||
case 6: search = StrFormated( "%s%06d%s", name.c_str(), c, realext.c_str() ); break;
|
||||
default: found = false;
|
||||
}
|
||||
|
||||
if ( found ) {
|
||||
if ( NULL == SearchInShapeGroup )
|
||||
tShape = GetShapeByName( search );
|
||||
else
|
||||
tShape = SearchInShapeGroup->GetByName( search );
|
||||
|
||||
if ( NULL != tShape ) {
|
||||
Shapes.push_back( tShape );
|
||||
|
||||
found = true;
|
||||
} else {
|
||||
if ( 0 == c ) // if didn't found "00", will search at least for "01"
|
||||
found = true;
|
||||
else
|
||||
found = false;
|
||||
}
|
||||
}
|
||||
|
||||
c++;
|
||||
} while ( found );
|
||||
}
|
||||
|
||||
return Shapes;
|
||||
}
|
||||
|
||||
@@ -357,14 +357,14 @@ class EE_API cSprite {
|
||||
EE_PRE_BLEND_FUNC mBlend;
|
||||
EE_RENDERTYPE mEffect;
|
||||
|
||||
SpriteCallback mCb;
|
||||
|
||||
eeUint mCurrentFrame;
|
||||
eeFloat mfCurrentFrame;
|
||||
eeUint mCurrentSubFrame;
|
||||
eeUint mSubFrames;
|
||||
eeUint mAnimTo;
|
||||
|
||||
SpriteCallback mCb;
|
||||
|
||||
class cFrame {
|
||||
public:
|
||||
std::vector<cShape *> Spr;
|
||||
|
||||
@@ -63,6 +63,14 @@ void cEETest::Init() {
|
||||
run = ( mWindow->Created() && PAK.IsOpen() );
|
||||
|
||||
if ( run ) {
|
||||
std::cout << "Size of cTexture: " << sizeof(cTexture) << std::endl;
|
||||
std::cout << "Size of cShape: " << sizeof(Graphics::cShape) << std::endl;
|
||||
std::cout << "Size of cSprite: " << sizeof(cSprite) << std::endl;
|
||||
std::cout << "Size of cUIControl: " << sizeof(cUIControl) << std::endl;
|
||||
std::cout << "Size of cUIControlAnim: " << sizeof(cUIControlAnim) << std::endl;
|
||||
std::cout << "Size of cUITextBox: " << sizeof(cUITextBox) << std::endl;
|
||||
std::cout << "Size of cUIComplexControl: " << sizeof(cUIComplexControl) << std::endl;
|
||||
|
||||
SetScreen( 0 );
|
||||
|
||||
mWindow->Caption( "EE++ Test Application" );
|
||||
|
||||
@@ -182,10 +182,12 @@ Uint32 cUIWinMenu::OnMessage( const cUIMessage * Msg ) {
|
||||
tpop->Show();
|
||||
}
|
||||
} else {
|
||||
mCurrentMenu = tpop;
|
||||
if ( Msg->Flags() & EE_BUTTON_LMASK ) {
|
||||
mCurrentMenu = tpop;
|
||||
|
||||
tbut->Select();
|
||||
tpop->Show();
|
||||
tbut->Select();
|
||||
tpop->Show();
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -110,7 +110,7 @@ void cClipboardSDL::SetText( const std::string& Text ) {
|
||||
XSetSelectionOwner( display, XA_PRIMARY, window, CurrentTime );
|
||||
}
|
||||
#elif EE_PLATFORM == EE_PLATFORM_WIN
|
||||
|
||||
/** @TODO Implement */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "cclipboardal.hpp"
|
||||
#include "cwindowal.hpp"
|
||||
|
||||
#include "../../base.hpp"
|
||||
#ifdef EE_BACKEND_ALLEGRO_ACTIVE
|
||||
|
||||
namespace EE { namespace Window { namespace Backend { namespace Al {
|
||||
@@ -20,10 +20,47 @@ void cClipboardAl::SetText( const std::string& Text ) {
|
||||
}
|
||||
|
||||
std::string cClipboardAl::GetText() {
|
||||
return std::string();
|
||||
return GetWideText().ToUtf8();
|
||||
}
|
||||
|
||||
String cClipboardAl::GetWideText() {
|
||||
#if defined( EE_X11_PLATFORM )
|
||||
/** Not sure if activate this, sometimes freeze the application because of the notification delay. */
|
||||
/**
|
||||
cWindowAl * win = reinterpret_cast<cWindowAl*> ( mWindow );
|
||||
eeWindowHandler mDisplay = win->GetWindowHandler();
|
||||
X11Window mWin = win->GetX11Window();
|
||||
|
||||
Atom clipboard = XInternAtom(mDisplay, "CLIPBOARD", True);
|
||||
X11Window owner = XGetSelectionOwner(mDisplay, clipboard);
|
||||
|
||||
if (owner != None) {
|
||||
// Request the selection as XA_STRING
|
||||
XConvertSelection(mDisplay, clipboard, XA_STRING, clipboard, mWin, CurrentTime);
|
||||
XFlush (mDisplay);
|
||||
XEvent e;
|
||||
|
||||
// Wait until the selection owner sends us a SelectionNotify event, confirming it has sent us the selection
|
||||
while (!XCheckTypedWindowEvent(mDisplay, mWin, SelectionNotify, &e));
|
||||
|
||||
if (e.xselection.property != None) {
|
||||
Atom type;
|
||||
int format;
|
||||
unsigned long dummy, bytes, length;
|
||||
unsigned char *data;
|
||||
|
||||
XGetWindowProperty( mDisplay, mWin, clipboard, 0, 0, False, AnyPropertyType,&type, &format, &length, &bytes, &data);
|
||||
|
||||
if (bytes) {
|
||||
XGetWindowProperty(mDisplay, mWin, clipboard, 0, bytes, False, AnyPropertyType, &type, &format, &length, &dummy, &data);
|
||||
}
|
||||
|
||||
return String::FromUtf8((const char*)data);
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
return String();
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ void cWindowAl::CreatePlatform() {
|
||||
|
||||
#if defined( EE_X11_PLATFORM )
|
||||
SetCurrent();
|
||||
mPlatform = eeNew( Platform::cX11Impl, ( this, GetWindowHandler(), ((ALLEGRO_DISPLAY_XGLX *)mDisplay)->window, ((ALLEGRO_DISPLAY_XGLX *)mDisplay)->window, al_display_lock, al_display_unlock ) );
|
||||
mPlatform = eeNew( Platform::cX11Impl, ( this, GetWindowHandler(), GetX11Window(), GetX11Window(), al_display_lock, al_display_unlock ) );
|
||||
#elif EE_PLATFORM == EE_PLATFORM_WIN
|
||||
mPlatform = eeNew( Platform::cWinImpl, ( this, GetWindowHandler() ) );
|
||||
#elif EE_PLATFORM == EE_PLATFORM_MACOSX
|
||||
@@ -239,6 +239,12 @@ void cWindowAl::CreatePlatform() {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined( EE_X11_PLATFORM )
|
||||
X11Window cWindowAl::GetX11Window() {
|
||||
return ((ALLEGRO_DISPLAY_XGLX *)mDisplay)->window;
|
||||
}
|
||||
#endif
|
||||
|
||||
void cWindowAl::ToggleFullscreen() {
|
||||
bool WasMaximized = mWindow.Maximized;
|
||||
|
||||
|
||||
@@ -40,6 +40,10 @@ class EE_API cWindowAl : public cWindow {
|
||||
|
||||
eeWindowHandler GetWindowHandler();
|
||||
|
||||
#if defined( EE_X11_PLATFORM )
|
||||
X11Window GetX11Window();
|
||||
#endif
|
||||
|
||||
void SetDefaultContext();
|
||||
|
||||
ALLEGRO_DISPLAY * GetDisplay() const;
|
||||
|
||||
@@ -34,6 +34,7 @@ using namespace EE::Graphics;
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xcursor/Xcursor.h>
|
||||
#include <X11/cursorfont.h>
|
||||
#include <X11/Xatom.h>
|
||||
typedef Atom eeScrapType;
|
||||
typedef Window X11Window;
|
||||
typedef Display * eeWindowHandler;
|
||||
|
||||
@@ -91,7 +91,7 @@ void cInputTextBuffer::PromptToLeftFirstNoChar() {
|
||||
}
|
||||
|
||||
void cInputTextBuffer::PromptToRightFirstNoChar() {
|
||||
Uint32 s = mText.size();
|
||||
Int32 s = static_cast<Int32> ( mText.size() );
|
||||
|
||||
if ( 0 == s )
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user