IconVader: cleanup.
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2009, François Revol, <[email protected]>.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
@@ -11,6 +10,7 @@
|
|||||||
|
|
||||||
#include "PoseView.h"
|
#include "PoseView.h"
|
||||||
|
|
||||||
|
|
||||||
static void Error(BView *view, status_t status, bool unlock=false)
|
static void Error(BView *view, status_t status, bool unlock=false)
|
||||||
{
|
{
|
||||||
BAlert *alert;
|
BAlert *alert;
|
||||||
@@ -22,9 +22,6 @@ static void Error(BView *view, status_t status, bool unlock=false)
|
|||||||
alert->Go();
|
alert->Go();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Tracker add-on entry
|
|
||||||
*/
|
|
||||||
extern "C" void
|
extern "C" void
|
||||||
process_refs(entry_ref dir, BMessage* refs, void* /*reserved*/)
|
process_refs(entry_ref dir, BMessage* refs, void* /*reserved*/)
|
||||||
{
|
{
|
||||||
@@ -38,7 +35,7 @@ process_refs(entry_ref dir, BMessage* refs, void* /*reserved*/)
|
|||||||
BString windowTitleBackup;
|
BString windowTitleBackup;
|
||||||
|
|
||||||
refs->PrintToStream();
|
refs->PrintToStream();
|
||||||
|
|
||||||
status = refs->FindMessenger("TrackerViewToken", &msgr);
|
status = refs->FindMessenger("TrackerViewToken", &msgr);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
Error(view, status);
|
Error(view, status);
|
||||||
@@ -70,23 +67,17 @@ process_refs(entry_ref dir, BMessage* refs, void* /*reserved*/)
|
|||||||
view->SetSelectionRectEnabled(false);
|
view->SetSelectionRectEnabled(false);
|
||||||
view->SetPoseEditing(false);
|
view->SetPoseEditing(false);
|
||||||
poseViewModeBackup = view->ViewMode();
|
poseViewModeBackup = view->ViewMode();
|
||||||
|
|
||||||
|
|
||||||
view->SetViewMode(kIconMode);
|
view->SetViewMode(kIconMode);
|
||||||
|
|
||||||
view->ShowBarberPole();
|
view->ShowBarberPole();
|
||||||
|
|
||||||
|
|
||||||
view->UnlockLooper();
|
view->UnlockLooper();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
alert = new BAlert("Error", "IconVader:\nClick on the icons to get points."
|
alert = new BAlert("Error", "IconVader:\nClick on the icons to get points."
|
||||||
"\nAvoid symlinks!", "OK");
|
"\nAvoid symlinks!", "OK");
|
||||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||||
alert->Go();
|
alert->Go();
|
||||||
|
|
||||||
|
|
||||||
int32 score = 0;
|
int32 score = 0;
|
||||||
int32 count = 300;
|
int32 count = 300;
|
||||||
while (count--) {
|
while (count--) {
|
||||||
@@ -107,18 +98,10 @@ process_refs(entry_ref dir, BMessage* refs, void* /*reserved*/)
|
|||||||
score-=10;
|
score-=10;
|
||||||
pose->Select(false);
|
pose->Select(false);
|
||||||
}
|
}
|
||||||
#ifdef __HAIKU__
|
|
||||||
BPoint location = pose->Location(view);
|
BPoint location = pose->Location(view);
|
||||||
#else
|
|
||||||
BPoint location = pose->Location();
|
|
||||||
#endif
|
|
||||||
location.x += ((rand() % 20) - 10);
|
location.x += ((rand() % 20) - 10);
|
||||||
location.y += ((rand() % 20) - 10);
|
location.y += ((rand() % 20) - 10);
|
||||||
#ifdef __HAIKU__
|
|
||||||
pose->SetLocation(location, view);
|
pose->SetLocation(location, view);
|
||||||
#else
|
|
||||||
pose->SetLocation(location);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
view->CheckPoseVisibility();
|
view->CheckPoseVisibility();
|
||||||
@@ -128,7 +111,7 @@ process_refs(entry_ref dir, BMessage* refs, void* /*reserved*/)
|
|||||||
BString str("Score: ");
|
BString str("Score: ");
|
||||||
str << score;
|
str << score;
|
||||||
view->Window()->SetTitle(str.String());
|
view->Window()->SetTitle(str.String());
|
||||||
|
|
||||||
view->UnlockLooper();
|
view->UnlockLooper();
|
||||||
snooze(100000);
|
snooze(100000);
|
||||||
}
|
}
|
||||||
@@ -139,7 +122,6 @@ process_refs(entry_ref dir, BMessage* refs, void* /*reserved*/)
|
|||||||
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
|
||||||
alert->Go();
|
alert->Go();
|
||||||
|
|
||||||
|
|
||||||
status = B_ERROR;
|
status = B_ERROR;
|
||||||
if (!msgr.LockTarget()) {
|
if (!msgr.LockTarget()) {
|
||||||
Error(view, status);
|
Error(view, status);
|
||||||
@@ -159,15 +141,13 @@ process_refs(entry_ref dir, BMessage* refs, void* /*reserved*/)
|
|||||||
view->RestoreColumnState(poseViewColumnBackup);
|
view->RestoreColumnState(poseViewColumnBackup);
|
||||||
|
|
||||||
view->Window()->SetTitle(windowTitleBackup.String());
|
view->Window()->SetTitle(windowTitleBackup.String());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
BMessage('_RRC') {
|
BMessage('_RRC') {
|
||||||
TrackerViewToken = BMessenger(port=32004, team=591, target=direct:0x131)
|
TrackerViewToken = BMessenger(port=32004, team=591, target=direct:0x131)
|
||||||
} */
|
} */
|
||||||
|
|
||||||
|
|
||||||
//be_roster->Launch("application/x-vnd.haiku-filetypes", refs);
|
|
||||||
|
|
||||||
view->UnlockLooper();
|
view->UnlockLooper();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,3 @@
|
|||||||
/*
|
|
||||||
* FileType.rdef
|
|
||||||
*/
|
|
||||||
|
|
||||||
// The FileType add-on has no app signature as it is no standalone application
|
|
||||||
//resource app_signature "application/x-vnd.Haiku-FileType";
|
|
||||||
//resource app_flags B_MULTIPLE_LAUNCH;
|
|
||||||
|
|
||||||
resource file_types message {
|
resource file_types message {
|
||||||
"types" = "application/x-vnd.Be-directory"
|
"types" = "application/x-vnd.Be-directory"
|
||||||
};
|
};
|
||||||
@@ -22,11 +14,9 @@ resource app_version {
|
|||||||
internal = 1,
|
internal = 1,
|
||||||
|
|
||||||
short_info = "IconVader",
|
short_info = "IconVader",
|
||||||
long_info = "IconVader, Copyright 2009 Haiku Inc."
|
long_info = "IconVader, a Tracker game"
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
|
||||||
|
|
||||||
resource vector_icon {
|
resource vector_icon {
|
||||||
$"6E6369660C0500040169020006023CADF43D104EBF02CA3EA2224BF02046648D"
|
$"6E6369660C0500040169020006023CADF43D104EBF02CA3EA2224BF02046648D"
|
||||||
$"00FFDB97FFFCAF29020006023A6496BA3F153EBCDD3EEA91492CB5C09D5100FF"
|
$"00FFDB97FFFCAF29020006023A6496BA3F153EBCDD3EEA91492CB5C09D5100FF"
|
||||||
@@ -50,62 +40,3 @@ resource vector_icon {
|
|||||||
$"040103000A060106000A0001041001178400040A050104000A00010710011784"
|
$"040103000A060106000A0001041001178400040A050104000A00010710011784"
|
||||||
$"00040A070108000A09010A000A08010900"
|
$"00040A070108000A09010A000A08010900"
|
||||||
};
|
};
|
||||||
|
|
||||||
#else // HAIKU_TARGET_PLATFORM_HAIKU
|
|
||||||
|
|
||||||
resource large_icon array {
|
|
||||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF02020008FFFFFFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF041B17110802FFFFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF041B3F3F1B150800FFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFFFF00FFFFFFFFFFFF021B3F3F1B150A00FFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFF003F00FFFFFFFFFF04151B1B17110800FFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFF003FFD00FFFFFFFFFF02081515150A0800FFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFF003FFDFDFD00FFFFFF00F9000A0A080A00FFFFFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFF003FFDFDFDFD00FFFF003FF97D000000007D0000FFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFF003FFDFDFDFDFDFD00FF00F93F3F7D7D7D7D7D7DF900FFFFFFFFFFFF"
|
|
||||||
$"FFFFFF003FFDFDFDFD62FDFD00FF00F9F9F93F3FF9F9F9F97D00FFFFFFFFFFFF"
|
|
||||||
$"FFFF003FFEFDFDFD62FDFDFDFA0000F9F9F9F9F93F3FF97D7D00FFFFFFFFFFFF"
|
|
||||||
$"FF003FFEFEFDFD89FDFDFDFDFA0000F9F9F9F9F9F9F97D7D7D00FFFFFFFFFFFF"
|
|
||||||
$"003FFEFEFEFDB0FD62FD62FDFAFA00F9F9F9F9F9F9F97D7D7D00FFFFFFFFFFFF"
|
|
||||||
$"FF003FFEFEB0FD89FD62FD62FAFA00F9F9F9F9F9F9F97D7D7D00FFFFFFFFFFFF"
|
|
||||||
$"FF003FFEB0FDB0FDB0FD62FAFAFAFA00F9F90000F9F97D7D7D00FFFFFFFFFFFF"
|
|
||||||
$"FFFF003FFEB0FDB0FDB0FDFAFA62FA000000606000007D7D7D00FFFFFFFFFFFF"
|
|
||||||
$"FFFF003FFEFDFDFD89FD62FD62FAFAFA00606060606000007D00FFFFFFFFFFFF"
|
|
||||||
$"FFFFFF003FFDFDB0FD89FD62FAFAFA0060606060606060600000FFFFFFFFFFFF"
|
|
||||||
$"FFFFFF003FFDFDFDB0FD89FAFAFA00606060606060606060606000FFFFFFFFFF"
|
|
||||||
$"FFFFFFFF003FFDB0FDB0FDFDFA006060606060606060606060D5000EFFFFFFFF"
|
|
||||||
$"FFFFFFFF003FFDFDB0FDFDFD003F60606060606060606060D5D5000EFFFFFFFF"
|
|
||||||
$"FFFFFFFFFF003FFDFDFDFDFD00AC3F3F60606060606060D5D5D5000E0E0EFFFF"
|
|
||||||
$"FFFFFFFFFF003FFDFDFDFDFD00ACACAC3F3F60606060D5D5D5D5000E0E0E0E0E"
|
|
||||||
$"FFFFFFFFFFFF003FFDFDFD0000ACACACACAC3F3F60D5D5D5D5D5000E0E0E0E0E"
|
|
||||||
$"FFFFFFFFFFFF003FFDFD000E00ACACACACACACACD5D5D5D5D5D5000E0E0E0EFF"
|
|
||||||
$"FFFFFFFFFFFFFF00FD000E0E00ACACACACACACACD5D5D5D5D5D5000E0E0EFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFF000E0E0E00ACACACACACACACD5D5D5D5D5000E0E0EFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFFFFFFFFFF00ACACACACACACACD5D5D5D5000E0E0EFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFF0000ACACACACACD5D5D5000E0E0EFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000ACACACD5D5000E0E0EFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000ACD5000E0E0EFFFFFFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000E0E0EFFFFFFFFFFFFFFFF"
|
|
||||||
};
|
|
||||||
|
|
||||||
resource mini_icon array {
|
|
||||||
$"FFFFFFFFFFFFFFFF020200FFFFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFF04151E1500FFFFFFFF"
|
|
||||||
$"FFFFFFFFFFFFFF021D1E1C00FFFFFFFF"
|
|
||||||
$"FFFFFFFF00FFFF00151B1600FFFFFFFF"
|
|
||||||
$"FFFFFF003F0000FA0000000000FFFFFF"
|
|
||||||
$"FFFF003FFD0000F9F9FAFAFAFA00FFFF"
|
|
||||||
$"FF003FFEFDFD00F9F9F9F97D7D00FFFF"
|
|
||||||
$"003F62FE89FD00F9F9F900007D00FFFF"
|
|
||||||
$"FF003FB0FD89FA00F90060600000FFFF"
|
|
||||||
$"FF003FFEB0FD620000606060606000FF"
|
|
||||||
$"FFFF003FFD89FA003F3F606060D500FF"
|
|
||||||
$"FFFF003FFDFDFA00ACAC3F3FD5D5000E"
|
|
||||||
$"FFFFFF003FFD0000ACACACACD5D5000E"
|
|
||||||
$"FFFFFF003F000E00ACACACACD5D5000E"
|
|
||||||
$"FFFFFFFF000E0E0E0000ACACD5000E0E"
|
|
||||||
$"FFFFFFFFFFFFFFFFFFFF0000000E0EFF"
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // HAIKU_TARGET_PLATFORM_HAIKU
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,11 @@
|
|||||||
SubDir HAIKU_TOP src add-ons tracker iconvader ;
|
SubDir HAIKU_TOP src add-ons tracker iconvader ;
|
||||||
|
|
||||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
UseHeaders [ FDirName $(HAIKU_TOP) src kits tracker ] : true ;
|
||||||
|
UsePrivateHeaders tracker ;
|
||||||
if $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
|
UsePrivateHeaders shared ;
|
||||||
UseHeaders [ FDirName $(HAIKU_TOP) src kits tracker ] : true ;
|
|
||||||
UsePrivateHeaders tracker ;
|
|
||||||
UsePrivateHeaders shared ;
|
|
||||||
} else {
|
|
||||||
# private, for testing...
|
|
||||||
SubDirC++Flags -I/work/zeta/src/cebit/os/zeta/system/lib/tracker ;
|
|
||||||
SubDirC++Flags -I/work/zeta/src/cebit/headers_p/tracker ;
|
|
||||||
SubDirC++Flags -I/work/zeta/src/cebit/headers_p ;
|
|
||||||
}
|
|
||||||
|
|
||||||
# TODO: does not seem to work:
|
|
||||||
AddResources IconVader : IconVader.rdef ;
|
|
||||||
|
|
||||||
Addon IconVader :
|
Addon IconVader :
|
||||||
IconVader.cpp
|
IconVader.cpp
|
||||||
|
|
||||||
: be tracker [ TargetLibstdc++ ]
|
: be tracker [ TargetLibstdc++ ]
|
||||||
;
|
;
|
||||||
|
AddResources IconVader : IconVader.rdef ;
|
||||||
|
|||||||
Reference in New Issue
Block a user