• R/O
  • SSH
  • HTTPS

daikon: 提交


Commit MetaInfo

修訂38 (tree)
時間2009-02-27 14:11:42
作者karasimiso

Log Message

#15210 KeyActionをプールする

Change Summary

差異

--- trunk/daikon/src/KeyAction.cpp (revision 37)
+++ trunk/daikon/src/KeyAction.cpp (revision 38)
@@ -27,27 +27,32 @@
2727 #include "KeyAction.h"
2828 #include "KeyEntry.h"
2929 #include "Scene/SceneMediator.h"
30+#include "GC.h"
3031
31-KeyAction::KeyAction(ActionFO* target, ActionCommand* pressed, ActionCommand* released)
32+KeyAction* KeyAction::create(ActionFO* target, ActionCommand* pressed, ActionCommand* released)
3233 {
3334 if ( released == NULL ) {
3435 throw ("KeyAction::KeyAction(ActionFO*, ActionCommand*, ActionCommand*): NULL pointer is set.\n");
3536 }
36- setTarget(target);
37- setCommandPressed(pressed);
38- setCommandReleased(released);
37+ KeyAction* ka = GC<KeyAction>::getInstance();
38+ ka->setTarget(target);
39+ ka->setCommandPressed(pressed);
40+ ka->setCommandReleased(released);
41+ return ka;
3942 }
4043
41-KeyAction::KeyAction(ActionFO* target, KeyEntry* keyEntry)
44+KeyAction* KeyAction::create(ActionFO* target, KeyEntry* keyEntry)
4245 {
4346 if ( keyEntry->commandReleased == NULL ) {
4447 throw ("KeyAction::KeyAction(ActionFO*, KeyEntry*): NULL pointer is set.\n");
4548 }
46- setTarget(target);
47- setCommandPressed(keyEntry->commandPressed);
48- setCommandReleased(keyEntry->commandReleased);
49- setKeyName(keyEntry->keyName);
50- setKeySym(keyEntry->keySym);
49+ KeyAction* ka = GC<KeyAction>::getInstance();
50+ ka->setTarget(target);
51+ ka->setCommandPressed(keyEntry->commandPressed);
52+ ka->setCommandReleased(keyEntry->commandReleased);
53+ ka->setKeyName(keyEntry->keyName);
54+ ka->setKeySym(keyEntry->keySym);
55+ return ka;
5156 }
5257
5358 void KeyAction::setTarget(ActionFO* target)
@@ -84,7 +89,7 @@
8489 {
8590 commandPressed->destroy();
8691 commandReleased->destroy();
87- delete this;
92+ GC<KeyAction>::destroy(this);
8893 }
8994
9095 void KeyAction::destroy(SceneMediator* mediator)
@@ -101,7 +106,7 @@
101106
102107 KeyAction* KeyAction::clone()
103108 {
104- KeyAction* keyAction = new KeyAction(target, commandPressed->clone(), commandReleased->clone());
109+ KeyAction* keyAction = KeyAction::create(target, commandPressed->clone(), commandReleased->clone());
105110 keyAction->setKeyName(getKeyName());
106111 keyAction->setKeySym(getKeySym());
107112 return keyAction;
--- trunk/daikon/src/ActionFO.cpp (revision 37)
+++ trunk/daikon/src/ActionFO.cpp (revision 38)
@@ -280,7 +280,7 @@
280280
281281 void ActionFO::addKeyAction(KeyEntry* keyEntry)
282282 {
283- keyAction.push_back( new KeyAction(this, keyEntry) );
283+ keyAction.push_back( KeyAction::create(this, keyEntry) );
284284 }
285285
286286 void ActionFO::setDamageAmount(int amount)
--- trunk/daikon/src/KeyAction.h (revision 37)
+++ trunk/daikon/src/KeyAction.h (revision 38)
@@ -41,13 +41,13 @@
4141 ActionCommand* commandReleased;
4242 ActionFO* target;
4343 public:
44- KeyAction(ActionFO* target, ActionCommand* pressed, ActionCommand* released);
45- KeyAction(ActionFO* target, KeyEntry* keyEntry);
4644 void setTarget(ActionFO* target);
4745 void setCommandPressed(ActionCommand* command);
4846 void setCommandReleased(ActionCommand* command);
4947 virtual bool keyPressed(SceneMediator* mediator);
5048 virtual bool keyReleased(SceneMediator* mediator);
49+ static KeyAction* create(ActionFO* target, ActionCommand* pressed, ActionCommand* released);
50+ static KeyAction* create(ActionFO* target, KeyEntry* keyEntry);
5151 void destroy();
5252 void destroy(SceneMediator* mediator);
5353 KeyAction* clone();
--- trunk/daikon/ChangeLog (revision 37)
+++ trunk/daikon/ChangeLog (revision 38)
@@ -1,3 +1,9 @@
1+* Mon Feb 23 2009 karasimiso <karasimiso@users.sourceforge.jp> 1.1
2+- 内部フォーマットを調整して画像描画を高速化
3+- <発射>タグを通した循環参照によって一般保護例外が発生するバグの修正
4+- <テキスト>タグの実装
5+- KeyActionのオブジェクト管理をGCに任せる
6+
17 * Mon Feb 2 2009 karasimiso <karasimiso@users.sourceforge.jp> 1.0.2
28 - <進路維持>タグの不具合を修正
39
Show on old repository browser