Erwan
- Chinese patch by linshier
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
OBJS = objs/ActionElement.o objs/ActionLayer.o objs/ActionStack.o objs/AIMomirPlayer.o objs/AIPlayer.o objs/AIStats.o objs/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o objs/CardEffect.o objs/CardPrimitive.o objs/CardSelector.o objs/Counters.o objs/Credits.o objs/Damage.o objs/DamagerDamaged.o objs/DeckDataWrapper.o objs/DeckMetaData.o objs/DeckStats.o objs/DuelLayers.o objs/Effects.o objs/ExtraCost.o objs/GameApp.o objs/GameLauncher.o objs/GameObserver.o objs/GameOptions.o objs/GameState.o objs/GameStateAwards.o objs/GameStateDeckViewer.o objs/GameStateDuel.o objs/GameStateMenu.o objs/GameStateOptions.o objs/GameStateShop.o objs/GameStateStory.o objs/GameStateTransitions.o objs/GuiAvatars.o objs/GuiBackground.o objs/GuiCardsController.o objs/GuiCombat.o objs/GuiFrame.o objs/GuiHand.o objs/GuiLayers.o objs/GuiMana.o objs/GuiPhaseBar.o objs/GuiPlay.o objs/GuiStatic.o objs/Logger.o objs/ManaCost.o objs/ManaCostHybrid.o objs/MenuItem.o objs/MTGAbility.o objs/MTGCardInstance.o objs/MTGCard.o objs/MTGDeck.o objs/MTGDefinitions.o objs/MTGGamePhase.o objs/MTGGameZones.o objs/MTGPack.o objs/MTGRules.o objs/OptionItem.o objs/PhaseRing.o objs/Player.o objs/PlayerData.o objs/PlayGuiObjectController.o objs/PlayGuiObject.o objs/Pos.o objs/PriceList.o objs/ReplacementEffects.o objs/Rules.o objs/SimpleMenu.o objs/SimpleMenuItem.o objs/SimplePad.o objs/StoryFlow.o objs/Subtypes.o objs/TargetChooser.o objs/TargetsList.o objs/TextScroller.o objs/ThisDescriptor.o objs/Token.o objs/Translate.o objs/TranslateKeys.o objs/Trash.o objs/utils.o objs/WEvent.o objs/WResourceManager.o objs/WCachedResource.o objs/WDataSrc.o objs/WGui.o objs/WFilter.o objs/Tasks.o
|
||||
OBJS = objs/ActionElement.o objs/ActionLayer.o objs/ActionStack.o objs/AIMomirPlayer.o objs/AIPlayer.o objs/AIStats.o objs/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o objs/CardEffect.o objs/CardPrimitive.o objs/CardSelector.o objs/Counters.o objs/Credits.o objs/Damage.o objs/DamagerDamaged.o objs/DeckDataWrapper.o objs/DeckMetaData.o objs/DeckStats.o objs/DuelLayers.o objs/Effects.o objs/ExtraCost.o objs/GameApp.o objs/GameLauncher.o objs/GameObserver.o objs/GameOptions.o objs/GameState.o objs/GameStateAwards.o objs/GameStateDeckViewer.o objs/GameStateDuel.o objs/GameStateMenu.o objs/GameStateOptions.o objs/GameStateShop.o objs/GameStateStory.o objs/GameStateTransitions.o objs/GuiAvatars.o objs/GuiBackground.o objs/GuiCardsController.o objs/GuiCombat.o objs/GuiFrame.o objs/GuiHand.o objs/GuiLayers.o objs/GuiMana.o objs/GuiPhaseBar.o objs/GuiPlay.o objs/GuiStatic.o objs/Logger.o objs/ManaCost.o objs/ManaCostHybrid.o objs/MenuItem.o objs/MTGAbility.o objs/MTGCardInstance.o objs/MTGCard.o objs/MTGDeck.o objs/MTGDefinitions.o objs/MTGGamePhase.o objs/MTGGameZones.o objs/MTGPack.o objs/MTGRules.o objs/OptionItem.o objs/PhaseRing.o objs/Player.o objs/PlayerData.o objs/PlayGuiObjectController.o objs/PlayGuiObject.o objs/Pos.o objs/PriceList.o objs/ReplacementEffects.o objs/Rules.o objs/SimpleMenu.o objs/SimpleMenuItem.o objs/SimplePad.o objs/StoryFlow.o objs/Subtypes.o objs/TargetChooser.o objs/TargetsList.o objs/TextScroller.o objs/ThisDescriptor.o objs/Token.o objs/Translate.o objs/TranslateKeys.o objs/Trash.o objs/utils.o objs/WEvent.o objs/WResourceManager.o objs/WCachedResource.o objs/WDataSrc.o objs/WGui.o objs/WFilter.o objs/Tasks.o objs/WFont.o
|
||||
DEPS = $(patsubst objs/%.o, deps/%.d, $(OBJS))
|
||||
|
||||
RESULT = $(shell psp-config --psp-prefix 2> Makefile.cache)
|
||||
|
||||
BIN
projects/mtg/bin/Res/graphics/f3.asc
Normal file
BIN
projects/mtg/bin/Res/graphics/f3.asc
Normal file
Binary file not shown.
BIN
projects/mtg/bin/Res/graphics/f3.gbk
Normal file
BIN
projects/mtg/bin/Res/graphics/f3.gbk
Normal file
Binary file not shown.
BIN
projects/mtg/bin/Res/graphics/magic.asc
Normal file
BIN
projects/mtg/bin/Res/graphics/magic.asc
Normal file
Binary file not shown.
BIN
projects/mtg/bin/Res/graphics/magic.gbk
Normal file
BIN
projects/mtg/bin/Res/graphics/magic.gbk
Normal file
Binary file not shown.
BIN
projects/mtg/bin/Res/graphics/simon.asc
Normal file
BIN
projects/mtg/bin/Res/graphics/simon.asc
Normal file
Binary file not shown.
BIN
projects/mtg/bin/Res/graphics/simon.gbk
Normal file
BIN
projects/mtg/bin/Res/graphics/simon.gbk
Normal file
Binary file not shown.
BIN
projects/mtg/bin/Res/graphics/smallface.asc
Normal file
BIN
projects/mtg/bin/Res/graphics/smallface.asc
Normal file
Binary file not shown.
BIN
projects/mtg/bin/Res/graphics/smallface.gbk
Normal file
BIN
projects/mtg/bin/Res/graphics/smallface.gbk
Normal file
Binary file not shown.
10564
projects/mtg/bin/Res/lang/cn.txt
Normal file
10564
projects/mtg/bin/Res/lang/cn.txt
Normal file
File diff suppressed because it is too large
Load Diff
9481
projects/mtg/bin/Res/lang/cn_cards.txt
Normal file
9481
projects/mtg/bin/Res/lang/cn_cards.txt
Normal file
File diff suppressed because it is too large
Load Diff
109
projects/mtg/bin/Res/lang/cn_decks.txt
Normal file
109
projects/mtg/bin/Res/lang/cn_decks.txt
Normal file
@@ -0,0 +1,109 @@
|
||||
#Wagic 0.12.1 电脑套牌说明 简体中文语言文件 by linshier and Phantom
|
||||
|
||||
#翻译者须知:
|
||||
# - 中文标点采用全角格式
|
||||
# - 翻译词条左侧的英文大小写敏感
|
||||
# - 套牌说明部分词条按英文字母排序
|
||||
# - 本文件采用GB2312编码格式,使用非该字符集的汉字,游戏将无法显示
|
||||
|
||||
Air Sea Battle=准备面对仙灵和人鱼的恐怖吧。
|
||||
Alliance=在班特城堡,亚莎的祷者@发出战斗的号召。@请准备面对班特之光吧!
|
||||
Allied Warriors=作为一支山地,森林,@海洋,天空的联合军队@@"统一战线是我们的力量"
|
||||
Allies=虽然单个很弱,@但是一起,我们就不可阻挡。@@如果你还觉得将三个臭皮匠@顶不了一个诸葛亮,@那就再想想!
|
||||
Angelism=天使的大军将掠过你的防线,@而你的士兵只能束手就擒。
|
||||
AshenmoorCohort=我你听你问道:@死亡的感觉如何?@@很痛苦。@火烧一样。@@死亡让你……@……让你想回到这个世界。
|
||||
Bad Dreams=等你遇到它们的时候@你再想自己是否做过噩梦吧……
|
||||
Badlands=危险的敌人正等待着你。@不死生物,鬼怪和憎恨兽@将给你带来疯狂的进攻。
|
||||
Bad Moon=夜幕降临,噩梦袭来。@邪恶的幽灵将把你拖入黑暗的深渊!
|
||||
Balefire Blast=纯粹的狂热力量@可以将秩序和混乱联合在一起。
|
||||
Ball Lightning=在我看来@你除了可以当燃料@别的什么都不是!
|
||||
Barbarians=成为野蛮人确凿无疑,千真万确很难。@人们认为我们想做只是粗野地喊着@"我是野蛮人!你脸让我作呕!",@然后将他狠狠打倒。@@这是大错特错了!@在那人被我们痛扁前,@我们实际上能完整地把一句话说完。
|
||||
Bleeding Megrim=而它将告诉你@胜利的第二天@就像失败的第二天一样@空洞。
|
||||
Blind Faith=对我们正在迎战的这支军队而言@黑暗和光明不多不少
|
||||
Bloodhall Ooze=第114号样本笔记:@在使用活和腐烂的有机物培养后,@流浆的成长已经超出了我们预计。@事实上,当我看到它狂暴地用触角拍打@关住它的玻璃容器时,我不禁它@是否会成为实验室的安全隐患……@ (法师实验室废墟中发现的残页)
|
||||
Boar's Tusks=请准备遭遇一支有强大军队吧,@它们拥有着火与自然系的力量。
|
||||
Burning=欲点燃午夜的油灯,@最好提前准备。@莽撞的鬼怪@让你愤怒@伴随微弱的火焰@而你的生命将就此终结……
|
||||
Corruption=我们会毁掉你。@我们会破坏你。@我们会消灭你。@当你除了一具死亡和空洞的壳@再一无所剩时,仙女们@将在你的残骸上跳舞庆祝。
|
||||
Creaky Wood=死亡@一直是自然的一部分。@我们拥抱它来@增强自己的力量。
|
||||
Death=我们挥霍般撒下死亡的种子。@当战斗胜利时,@我们收获那些死尸。
|
||||
Deep Blue=你确定要召唤这只强大的生物@入场吗?可能你觉得它足够强大,@可以助你结束战斗。但是,@别怪我没警告过你注意回镖……
|
||||
Depletion=矿井的嚎叫,@梦生谬思的低语,@噬殁兽的吐息,@让无数法师发疯,@真实的底密尔公馆在等待你去发现。
|
||||
Destroy=我将摧毁你的土地,@你的军队,@最后是你。
|
||||
Disciplination=我的军队在纪律处分中未能幸存,@尽管是我极不情愿发起的。@于是,我看到你为我带来了增援。@真心感想你,你是个好人!
|
||||
Dragons=龙是力量和意志的狂乱。@龙是焰的艺术家,@将世界涂上火的色彩。
|
||||
Elfball=在源源不断的法术力支持下,@由妖精勇士组成的洪流将彻底击败你。@赶紧逃跑吧!你没有任何胜算!
|
||||
Elfolk=面对一支侏儒和树妖的联军。@你能同时承受树的强壮力量和@侏儒的繁殖能力吗?
|
||||
Elves=你也许认为这段林中旅行会很惬意……@但是谁说只有鬼怪会令人生厌呢?
|
||||
Enchanted Coatl=当心!魔女找到了一只新宠物!@她们正痴迷于让它不断变强@直到无人能挡。
|
||||
Enchanted=谨防任何斗士穿上盔甲或面具。@@装备精良,他们将战无不胜。
|
||||
Enchantresses=请敬畏魔女的力量吧!@当你一不小心,@她们将会接二连三地施放咒语@并且化身成为强大的战士。
|
||||
Eviscerator=如果你动,你会伤害你自己。@当然,如果你不动,我也会伤害你。
|
||||
Faeries=注意,这不是蝴蝶!@或者应把它看作危险的品种……
|
||||
Fairy Archmage=现在我们在这里@现在我们在那里@现在我们走了@现在我们回来了@@而你的守军出什么事了吗?
|
||||
Giants!=对巨人的攻击事实上很难落空,@你甚至用不着瞄准。@但是如何将巨人置入己方有效的@攻击范围确是一件难事。
|
||||
Goblin Spike=呼?瓦达尔亚-叶琳,法师?@不明白你及招来的电火!@等等,让我读读你的唇语:@要……要……啊……啊什么?@@(一个鬼怪战士最后的言语,@在它被焚化前的那一刻)
|
||||
Good Knight=该睡觉了。@@小心!骑士来了!@在他们的颂歌的激励下,@他们走上东征之路,@捍卫他们的荣誉。
|
||||
Heartmender=无论是谁@无论是什么@我们治愈它@无论是善还是恶@是理性还是狂乱@是生者还是死物@我们都将治愈它。
|
||||
Hot & Hasty=即使在你动之前,@我们的炙热将燃烧你!
|
||||
Howlings=愤怒的鬼怪@在元素的帮助下沿山而下@企图征服大地。
|
||||
Inquisitor=神器大军已经做好准备,@暗黑老虎钳和象牙塔会等待你,@它们计划完全阻挡你的脚步,@并将你折磨至死。
|
||||
Jihad=它们看起来不堪一击,@但是放手不管,@壮大起来,@你的军队将被它们击溃。
|
||||
Jungle=山岭,丛林和平原的@生物已经做好了复仇的准备。
|
||||
Justice=率领狂热的信徒击败法律,@每个罪犯应该接受正义怒火的制裁。
|
||||
Kinsb. Cavalier=骑士骑着他们的战马@骑士从天上而来@为了荣誉@团结在它们的城堡里
|
||||
Kithkin=在仕绅的率领下,@在纺思的团结下,@挑战只有一个,@那就是金牧地的王者,@而你就将要面对这支力量。
|
||||
Kobold Overlord=也许你觉得我们不堪一击@也许我们确实如此@但是我们有时会请到强大的雇佣兵!
|
||||
Lafiel=遭遇由十一皇女拉斐尔率领的亲卫队时,@千万不要被她们的美貌所蒙蔽,@否则你失去的@将不只是你的魂魄那么简单!
|
||||
Life & Death=生孕育着死。@死为新生的基础。@@生与死并不矛盾,@而是互为补充。@它们的作用联系,@将成为你力量的源泉。
|
||||
Magnivore=不要低估这……事儿……@因为它恰好是个幌子。@大意的话,它会成为@你一生最后的错误!
|
||||
Master of Ether=被我建造的物件所包围@我的力量将无限的增长。
|
||||
Mermadness=凭借无止境的战士和魔咒的支援,@海洋的骗子们正征服所有的王国。
|
||||
Might Sliver=注意!小心!@它们无处不在!空中地上@到处都是它们的影子@整个世界都被这些危险的小东西占据了……
|
||||
Mighty Murk=在森林里的境生物的领导下,@天空和海洋的生物将会攻击你的军队。@不要低估他们壮大的潜力。
|
||||
Millage=你可能觉得自己@有足够多的咒语,神器和生物。@但是在你意识到到它之前,@你的所有将在手里粉碎。
|
||||
Mindwracked=是什么呢,是什么呢……@我想告诉你一些东西。@或者你有些事情要告诉我?@啊,我怎么会忘掉呢?@它很重要!也许不重要?@@我到底在想什么?@这不过是我的妄想吗?@我到底是谁?你是谁?@啊,别在意。我会杀掉你的。@@你打断了我的思考。
|
||||
Nightmare=我做了一次又一次的恶梦,@然后获得了胜利。
|
||||
Noble Predators=我们是猎人。@你是猎物。@逃跑吧。@然后我们会抓住你。
|
||||
No Bushwhacker=攻击!治疗!再攻击!再治疗!@一遍又一遍。@多么怀念自己还在鬼怪部队里的日子啊!@现在我需要在战斗中完成两件事情!
|
||||
Panda Hive=当最后一个生命@死于可怕的枯萎,@黄蜂的嗡鸣扰动着@这沉闷的空气。
|
||||
Persistence=看吧,你的军队沦为了@疯怒和诅咒的牺牲品,@你毫无还击之力,@而我们能不断的攻击到你。
|
||||
Plane ofthe Apes=这是否是那块@从猿演变成人的大地,@你将得到答案。
|
||||
Plateau=在波洛斯高地,@天使,元素和鬼怪正在准备战斗。@警惕着战争的到来……
|
||||
Premade G/R=红黑套牌的规则比较简单,@可以方便上手。@我们强烈建议你@创建属于自己的套牌,@来充分享受游戏的乐趣!
|
||||
Rack them all=胜而再胜,@我转动轮子碾过你束缚的肢体。@没有什么你能做。@你不如立刻投降。
|
||||
Rats!=它们形态各异,@打过狗,杀过猫,@咬死过摇篮中的婴儿,@吃过桶里的奶酪,@舔过厨子勺里的汤羹,@尝过桶装的咸鱼,@男人的太阳帽有它们的巢穴,@妇人们的闲谈常被它们的@叽喳和尖叫打断。
|
||||
Red Cats=士兵的汗臭将凶猛的野兽@从山上吸引下来。
|
||||
Red Green Ally=我们或许不相似,@但我们拥有共同的目标。@当笛声响起时,@所有的对手都将颤抖。
|
||||
Relentless=团结存,分裂亡。
|
||||
Saproling Surge=大群蠕动的菌类@将击溃你的军队。
|
||||
Savannah=为了反抗非瑞克西亚的命运,@德洛马与杰拉尔德的联军@没有任何闲暇来争吵和对抗。
|
||||
Selesnya=你胆敢只身与盟会为敌吗?
|
||||
Shatter=你将看到自己的努力@被正义的怒火@全力击溃。
|
||||
Shocking M'taurs=一道炫目的闪光后,@战斗打响了,@接着就是一阵震耳欲聋的蹄声。
|
||||
SilverBlade=不要担心-@它不会造成多少伤害。@猎狗和鬼怪,猞猁和士兵@就已将你撕成粉碎,@即使在你注意到他们的存在之前。
|
||||
Skies of Emeria=所有的陆地行走者当心!@没有人可以徒步来到我们的王国,@所有以其他方式进入的人@都将被消灭。
|
||||
Slightly Sligh=莫葛很散漫,@同时也拥有强大的咒语!
|
||||
Snake Pit=赞美我们的曲线@挚爱我们的柔美@享受我们的拥抱@@想要一个香吻?@很快你就要睡着了……
|
||||
Soldiers=我们站成一排@一个挨着一个@宛如剑与盾的墙在前行@我们不会停止@我们不会屈服@而且永远不会退缩。
|
||||
Spectral Rack=我们将给你洗脑,@你将一无所知,@而我们将更加强大。
|
||||
Taiga=红绿联盟。@@你能经受它们的夹攻吗?
|
||||
Tarmac=让塔莫耶夫舔着的脚底,@赤身绑在在拷架上的滋味如何?
|
||||
Terror=它们呻吟着,躁动着,@全都站起来了,@它们不言不视,@这匪夷所思,@即使在梦中也是如此,@当你看到这些逝者重生的时候
|
||||
The Memorial=当你面对一支由异常强大的生物@组成的军队时,@你又能做什么呢?@@膜拜纪念碑给与它们@难以置信的力量。
|
||||
Thistlestings=遇见比洁英更神秘的部落。@你会允许他们迷惑你吗?
|
||||
Token Terror=小心!它们来自各个地方!@@使用非常手段征召的混合部队。
|
||||
Traveling Party=我们可能看起来像@其他的冒险家团体。@但你不会了解我们能得到多大的帮助,@如果我们真想得到的话。
|
||||
Treefolk=谁躲藏在这树里?@@长年以来,这些大树饱经元素的怒火。@你真以为自己有一点机会@能抓住它们的树皮吗?
|
||||
Tree Planter=即使你不去森林,@森林也会来找你。@今天我们种下的树苗,@将成为明日我们的盔甲。
|
||||
Tsabo=你可能准备好应对一支@从坟墓场里涌出的灵俑大军。@但是如果它们从海里爬出来呢?
|
||||
Twin Pricks=牛已经来了。@到喂食的时间了……
|
||||
Undead Lords=你能闻到腐肉和碎骨的香味吗?@是的话你应该万分欣喜,@因为你很快就要成为其中的一员了。
|
||||
VampireViscounts=啊,这咬下跳动鲜肉的触感!@啊,这畅饮生命烈酒的快感!@在这极乐中狂欢@难道是罪过不成?
|
||||
Vanguard'sChosen=瞧那前锋!@它的力量在不断膨胀,@再没有什么能阻止它!
|
||||
Viashino Warrior=用爪子,利剑和火焰@我们牢固的捍卫我们的信仰
|
||||
Vigilant Watch=一个士兵也许会疲倦,@但是小队却不会。@他们机警戒备,@时刻准备迎击到来的敌人。
|
||||
White Blades=遭遇一整支由士兵,骑士,@守卫组成的军队。@@你能阻挡它们吗,@或者你只能在一旁束手无策?
|
||||
Wraith's Feast=我的军队只会恐吓你,@而我对生的饥渴则会杀死你。
|
||||
Wrath=痛苦的快乐@这是否是终结@这美丽新世界
|
||||
Yavimaya=丛林和大海的猛兽正在集结,@准备战斗。
|
||||
Zuberi's Flock=为了正义与荣耀@展翅的战士们@越过裂隙@准备复仇
|
||||
@@ -551,21 +551,21 @@ public:
|
||||
MTGGameZone * dest = move->destinationZone();
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
for (int i=0; i < 2; i++){
|
||||
if (dest == g->players[i]->game->hand && tc->targetsZone(g->players[i]->game->inPlay)){
|
||||
return "Bounce";
|
||||
}else if (dest == g->players[i]->game->hand && tc->targetsZone(g->players[i]->game->graveyard)){
|
||||
return "Reclaim";
|
||||
}else if (dest == g->players[i]->game->graveyard && tc->targetsZone(g->players[i]->game->inPlay)){
|
||||
return "Sacrifice";
|
||||
}else if (dest == g->players[i]->game->library && tc->targetsZone(g->players[i]->game->graveyard)){
|
||||
return "Recycle";
|
||||
}else if (dest == g->players[i]->game->library){
|
||||
return "Put in Library";
|
||||
}else if (dest == g->players[i]->game->graveyard && tc->targetsZone(g->players[i]->game->hand)){
|
||||
return "Discard";
|
||||
}else if (dest == g->players[i]->game->exile){
|
||||
return "Exile";
|
||||
}else if (tc->targetsZone(g->players[i]->game->library)){
|
||||
if (dest == g->players[i]->game->hand && tc->targetsZone(g->players[i]->game->inPlay)){
|
||||
return "Bounce";
|
||||
}else if (dest == g->players[i]->game->hand && tc->targetsZone(g->players[i]->game->graveyard)){
|
||||
return "Reclaim";
|
||||
}else if (dest == g->players[i]->game->graveyard && tc->targetsZone(g->players[i]->game->inPlay)){
|
||||
return "Sacrifice";
|
||||
}else if (dest == g->players[i]->game->library && tc->targetsZone(g->players[i]->game->graveyard)){
|
||||
return "Recycle";
|
||||
}else if (dest == g->players[i]->game->library){
|
||||
return "Put in Library";
|
||||
}else if (dest == g->players[i]->game->graveyard && tc->targetsZone(g->players[i]->game->hand)){
|
||||
return "Discard";
|
||||
}else if (dest == g->players[i]->game->exile){
|
||||
return "Exile";
|
||||
}else if (tc->targetsZone(g->players[i]->game->library)){
|
||||
return "Fetch";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <JGE.h>
|
||||
#include <JLBFont.h>
|
||||
#include "../include/WFont.h"
|
||||
#include <time.h>
|
||||
#include "../include/Player.h"
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
int value;
|
||||
string text;
|
||||
CreditBonus(int _value, string _text);
|
||||
void Render(float x, float y, JLBFont * font);
|
||||
void Render(float x, float y, WFont * font);
|
||||
};
|
||||
|
||||
class Credits{
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
#include "GameObserver.h"
|
||||
|
||||
#include <JGui.h>
|
||||
#include <JLBFont.h>
|
||||
#include "../include/WFont.h"
|
||||
|
||||
|
||||
class MTGGamePhase: public ActionElement {
|
||||
protected:
|
||||
float animation;
|
||||
int currentState;
|
||||
JLBFont * mFont;
|
||||
WFont * mFont;
|
||||
public:
|
||||
MTGGamePhase(int id);
|
||||
virtual void Update(float dt);
|
||||
|
||||
@@ -162,7 +162,7 @@ private:
|
||||
list<HUDString *> events;
|
||||
float timestamp;
|
||||
float popdelay;
|
||||
JLBFont * f;
|
||||
WFont * f;
|
||||
float maxWidth;
|
||||
int addEvent(string s);
|
||||
public:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _MENU_ITEM_H
|
||||
#define _MENU_ITEM_H
|
||||
|
||||
#include <JLBFont.h>
|
||||
#include "../include/WFont.h"
|
||||
#include <JGui.h>
|
||||
#include <hge/hgeparticle.h>
|
||||
#include <string>
|
||||
@@ -16,7 +16,7 @@ class MenuItem: public JGuiObject
|
||||
{
|
||||
private:
|
||||
bool mHasFocus;
|
||||
JLBFont *mFont;
|
||||
WFont *mFont;
|
||||
string mText;
|
||||
int mX;
|
||||
int mY;
|
||||
@@ -31,7 +31,7 @@ class MenuItem: public JGuiObject
|
||||
|
||||
|
||||
public:
|
||||
MenuItem(int id, JLBFont *font, string text, int x, int y, JQuad * _off, JQuad * _on, const char * particle, JQuad * particleQuad, bool hasFocus = false);
|
||||
MenuItem(int id, WFont *font, string text, int x, int y, JQuad * _off, JQuad * _on, const char * particle, JQuad * particleQuad, bool hasFocus = false);
|
||||
~MenuItem();
|
||||
virtual void Render();
|
||||
virtual void Update(float dt);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define _SHOP_ITEM_H
|
||||
|
||||
#include <JGui.h>
|
||||
#include <JLBFont.h>
|
||||
#include "../include/WFont.h"
|
||||
#include "SimpleMenu.h"
|
||||
#include "MTGDeck.h"
|
||||
#include "../include/PriceList.h"
|
||||
@@ -22,7 +22,7 @@ class ShopItem:public JGuiObject{
|
||||
friend class ShopItems;
|
||||
bool mHasFocus;
|
||||
bool mRelease;
|
||||
JLBFont *mFont;
|
||||
WFont *mFont;
|
||||
string mText;
|
||||
float xy[8];
|
||||
JQuad * quad;
|
||||
@@ -38,8 +38,8 @@ class ShopItem:public JGuiObject{
|
||||
int quantity;
|
||||
MTGCard * card;
|
||||
int price;
|
||||
ShopItem(int id, JLBFont * font, int _cardid, float _xy[], bool hasFocus, MTGAllCards * collection, int _price, DeckDataWrapper * ddw);
|
||||
ShopItem(int id, JLBFont * font, char* text, JQuad * _quad, JQuad * _thumb,float _xy[], bool hasFocus, int _price);
|
||||
ShopItem(int id, WFont * font, int _cardid, float _xy[], bool hasFocus, MTGAllCards * collection, int _price, DeckDataWrapper * ddw);
|
||||
ShopItem(int id, WFont * font, char* text, JQuad * _quad, JQuad * _thumb,float _xy[], bool hasFocus, int _price);
|
||||
~ShopItem();
|
||||
int updateCount(DeckDataWrapper * ddw);
|
||||
|
||||
@@ -59,7 +59,7 @@ class ShopItems:public JGuiController,public JGuiListener{
|
||||
PlayerData * playerdata;
|
||||
PriceList * pricelist;
|
||||
int mX, mY, mHeight;
|
||||
JLBFont* mFont;
|
||||
WFont* mFont;
|
||||
JTexture * mBgAATex;
|
||||
JQuad * mBgAA;
|
||||
MTGAllCards * collection;
|
||||
@@ -76,7 +76,7 @@ class ShopItems:public JGuiController,public JGuiListener{
|
||||
|
||||
public:
|
||||
bool showCardList;
|
||||
ShopItems(int id, JGuiListener* listener, JLBFont* font, int x, int y, MTGAllCards * _collection, int _setIds[]);
|
||||
ShopItems(int id, JGuiListener* listener, WFont* font, int x, int y, MTGAllCards * _collection, int _setIds[]);
|
||||
~ShopItems();
|
||||
void Render();
|
||||
virtual void Update(float dt);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <JGui.h>
|
||||
#include <JLBFont.h>
|
||||
#include "../include/WFont.h"
|
||||
#include "hge/hgeparticle.h"
|
||||
|
||||
class SimpleMenu:public JGuiController{
|
||||
@@ -29,7 +29,7 @@ class SimpleMenu:public JGuiController{
|
||||
|
||||
static JQuad *spadeR, *spadeL, *jewel, *side;
|
||||
static JTexture *spadeRTex, *spadeLTex, *jewelTex, *sideTex;
|
||||
static JLBFont* titleFont;
|
||||
static WFont* titleFont;
|
||||
static hgeParticleSystem* stars;
|
||||
// This works only because of no multithreading
|
||||
static PIXEL_TYPE jewelGraphics[9];
|
||||
|
||||
@@ -20,6 +20,7 @@ class Translator{
|
||||
public:
|
||||
map<string,string> values;
|
||||
map<string,string> tempValues;
|
||||
map<string,string> deckValues;
|
||||
#if defined DEBUG_TRANSLATE
|
||||
map<string,int> missingValues;
|
||||
map<string,int> dontCareValues;
|
||||
@@ -30,6 +31,7 @@ public:
|
||||
~Translator();
|
||||
int Add(string from, string to);
|
||||
void initCards();
|
||||
void initDecks();
|
||||
void init();
|
||||
static Translator * GetInstance();
|
||||
static void EndInstance();
|
||||
@@ -37,4 +39,5 @@ public:
|
||||
|
||||
string _(string toTranslate);
|
||||
|
||||
extern bool neofont;
|
||||
#endif
|
||||
|
||||
109
projects/mtg/include/WFont.h
Normal file
109
projects/mtg/include/WFont.h
Normal file
@@ -0,0 +1,109 @@
|
||||
#ifndef WFONT_H_
|
||||
#define WFONT_H_
|
||||
|
||||
#include <JLBFont.h>
|
||||
#include <JRenderer.h>
|
||||
#include <JSprite.h>
|
||||
#include "config.h"
|
||||
|
||||
class WFont
|
||||
{
|
||||
public:
|
||||
unsigned char id;
|
||||
// Rendering text to screen.
|
||||
virtual void DrawString(const char *s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0) = 0;
|
||||
virtual void DrawString(std::string s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0) = 0;
|
||||
// Set font color.
|
||||
virtual void SetColor(PIXEL_TYPE color) = 0;
|
||||
// Get font color.
|
||||
virtual PIXEL_TYPE GetColor() const = 0;
|
||||
// Set scale for rendering.
|
||||
virtual void SetScale(float scale) = 0;
|
||||
// Get rendering scale.
|
||||
virtual float GetScale() const = 0;
|
||||
// Get height of font.
|
||||
virtual float GetHeight() const = 0;
|
||||
// Get width of rendering string on screen.
|
||||
virtual float GetStringWidth(const char *s) const = 0;
|
||||
// Set font tracking.
|
||||
virtual void SetTracking(float tracking) = 0;
|
||||
// Set Base for the character set to use.
|
||||
virtual void SetBase(int base) = 0;
|
||||
virtual ~WFont() {};
|
||||
};
|
||||
|
||||
class WLBFont : public WFont
|
||||
{
|
||||
public:
|
||||
WLBFont(const char *fontname, int lineheight, bool useVideoRAM=false) {
|
||||
it = NEW JLBFont(fontname,lineheight,useVideoRAM);
|
||||
};
|
||||
~WLBFont() {SAFE_DELETE(it);};
|
||||
|
||||
void DrawString(const char *s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0) {it->DrawString(s,x,y,align,leftOffset,width);};
|
||||
void DrawString(std::string s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0) {it->DrawString(s,x,y,align,leftOffset,width);};
|
||||
void SetColor(PIXEL_TYPE color) {it->SetColor(color);};
|
||||
PIXEL_TYPE GetColor() const {return it->GetColor();};
|
||||
void SetScale(float scale) {it->SetScale(scale);};
|
||||
float GetScale() const {return it->GetScale();};
|
||||
float GetHeight() const {return it->GetHeight();};
|
||||
float GetStringWidth(const char *s) const {return it->GetStringWidth(s);};
|
||||
void SetTracking(float tracking) {it->SetTracking(tracking);};
|
||||
void SetBase(int base) {it->SetBase(base);};
|
||||
|
||||
private:
|
||||
JLBFont * it;
|
||||
};
|
||||
|
||||
//Why do we need this ? could it move somewhere else ?
|
||||
#if defined (LINUX)
|
||||
#define BYTE u8
|
||||
#define DWORD u32
|
||||
#endif
|
||||
|
||||
class WFBFont : public WFont
|
||||
{
|
||||
public:
|
||||
WFBFont(const char *fontname, int lineheight, bool useVideoRAM=false);
|
||||
~WFBFont();
|
||||
|
||||
void DrawString(const char *s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0);
|
||||
void DrawString(std::string s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0);
|
||||
void SetColor(PIXEL_TYPE color);
|
||||
PIXEL_TYPE GetColor() const {return mColor0;};
|
||||
void SetScale(float scale);
|
||||
float GetScale() const;
|
||||
float GetHeight() const;
|
||||
float GetStringWidth(const char *s) const;
|
||||
void SetTracking(float tracking) {};
|
||||
void SetBase(int base) {};
|
||||
|
||||
private:
|
||||
static JRenderer * mRenderer;
|
||||
|
||||
BYTE* mEngFont;
|
||||
BYTE* mChnFont;
|
||||
|
||||
PIXEL_TYPE mColor0;
|
||||
PIXEL_TYPE mColor;
|
||||
int mFontSize;
|
||||
float mScale;
|
||||
int mBytesPerChar;
|
||||
int mBytesPerRow;
|
||||
|
||||
int mCacheImageWidth;
|
||||
int mCacheImageHeight;
|
||||
int mCol;
|
||||
int mRow;
|
||||
int mCacheSize;
|
||||
JTexture * mTexture;
|
||||
JQuad ** mSprites;
|
||||
int *mGBCode;
|
||||
int mCurr;
|
||||
|
||||
DWORD* mCharBuffer;
|
||||
|
||||
int PreCacheChar(const BYTE *ch);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "MTGDeck.h"
|
||||
#include "MTGCard.h"
|
||||
#include "WCachedResource.h"
|
||||
#include "WFont.h"
|
||||
|
||||
#define HUGE_CACHE_LIMIT 20000000 // Size of the cache for Windows and Linux
|
||||
#define SAMPLES_CACHE_SIZE 1500000 // Size in bytes of the cached samples
|
||||
@@ -175,9 +176,16 @@ public:
|
||||
JTexture* GetTexture(const string &textureName);
|
||||
JTexture* GetTexture(int id);
|
||||
|
||||
int reloadJLBFonts();
|
||||
int reloadWFonts();
|
||||
int reloadWLBFonts();
|
||||
//Wrapped from JResourceManger. TODO: Privatize
|
||||
JLBFont * LoadJLBFont(const string &fontName, int height);
|
||||
WFont * LoadWLBFont(const string &fontName, int height);
|
||||
WFont * LoadWFBFont(const string &fontName, int height);
|
||||
WFont * GetWFont(const string &fontName);
|
||||
WFont * GetWFont(int id);
|
||||
WFont * GetWLBFont(int id);
|
||||
void RemoveWFonts();
|
||||
void RemoveWLBFonts();
|
||||
|
||||
//Wrapped from JSoundSystem. TODO: Privatize.
|
||||
JMusic * ssLoadMusic(const char *fileName);
|
||||
@@ -204,6 +212,10 @@ private:
|
||||
//Statistics of record.
|
||||
unsigned int lastTime;
|
||||
int lastError;
|
||||
vector<WFont *> mWFontList;
|
||||
map<string, int> mWFontMap;
|
||||
vector<WLBFont *> mWLBFontList;
|
||||
map<string, int> mWLBFontMap;
|
||||
};
|
||||
|
||||
extern WResourceManager resources;
|
||||
|
||||
@@ -152,7 +152,7 @@ void AIStats::Render(){
|
||||
if (player == g->players[1]) x0 = 280;
|
||||
JRenderer::GetInstance()->FillRoundRect(x0,10,200,180,5,ARGB(50,0,0,0));
|
||||
|
||||
JLBFont * f = resources.GetJLBFont("simon");
|
||||
WFont * f = resources.GetWFont("simon");
|
||||
int i = 0;
|
||||
char buffer[512];
|
||||
list<AIStat *>::iterator it;
|
||||
|
||||
@@ -27,7 +27,7 @@ void NextGamePhase::Render(){
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
int nextPhase = (g->getCurrentGamePhase() + 1) % Constants::MTG_PHASE_CLEANUP;
|
||||
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
char buffer[200];
|
||||
@@ -51,7 +51,7 @@ ostream& NextGamePhase::toString(ostream& out) const
|
||||
}
|
||||
|
||||
void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont->DrawString(_(action).c_str(), x + 30 , y, JGETEXT_LEFT);
|
||||
@@ -273,7 +273,7 @@ int PutInGraveyard::resolve(){
|
||||
}
|
||||
|
||||
void PutInGraveyard::Render(){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
if (!removeFromGame){
|
||||
@@ -310,7 +310,7 @@ int DrawAction::resolve(){
|
||||
}
|
||||
|
||||
void DrawAction::Render(){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
char buffer[200];
|
||||
@@ -736,7 +736,7 @@ void ActionStack::Render(){
|
||||
if (current->state==NOT_RESOLVED) height += current->mHeight;
|
||||
}
|
||||
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
@@ -792,7 +792,7 @@ void ActionStack::Render(){
|
||||
if (current->display) height += current->mHeight;
|
||||
}
|
||||
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ void CardGui::Update(float dt)
|
||||
|
||||
void CardGui::Render()
|
||||
{
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
@@ -194,7 +194,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
||||
renderer->RenderQuad(q, x, pos.actY, pos.actT, scale, scale);
|
||||
}
|
||||
// Write the title
|
||||
JLBFont * font = resources.GetJLBFont("magic");
|
||||
WFont * font = resources.GetWFont("magic");
|
||||
float backup_scale = font->GetScale();
|
||||
font->SetColor(ARGB((int)pos.actA, 0, 0, 0));
|
||||
font->SetScale(0.8 * pos.actZ);
|
||||
@@ -213,8 +213,9 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
||||
font->SetScale(0.8 * pos.actZ);
|
||||
const std::vector<string> txt = card->data->formattedText();
|
||||
unsigned i = 0;
|
||||
unsigned h = neofont ? 14 : 11;
|
||||
for (std::vector<string>::const_iterator it = txt.begin(); it != txt.end(); ++it, ++i)
|
||||
font->DrawString(it->c_str(), x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (-BigHeight/2 + 80 + 11 * i)*pos.actZ);
|
||||
font->DrawString(it->c_str(), x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (-BigHeight/2 + 80 + h * i)*pos.actZ);
|
||||
}
|
||||
|
||||
// Write the strength
|
||||
@@ -285,7 +286,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
||||
for (int i = card->data->types.size() - 1; i > 0; --i)
|
||||
{
|
||||
s += _(Subtypes::subtypesList->find(card->data->types[i]));
|
||||
s += " - ";
|
||||
s += _(" - ");
|
||||
}
|
||||
if(card->data->types.size())
|
||||
s += _(Subtypes::subtypesList->find(card->data->types[0]));
|
||||
@@ -382,7 +383,7 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos){
|
||||
void CardGui::renderCountersBig(const Pos& pos){
|
||||
// Write Named Counters
|
||||
if (card->counters) {
|
||||
JLBFont * font = resources.GetJLBFont("magic");
|
||||
WFont * font = resources.GetWFont("magic");
|
||||
font->SetColor(ARGB((int)pos.actA, 0, 0, 0));
|
||||
font->SetScale(0.8 * pos.actZ);
|
||||
std::vector<string> txt = card->formattedText();
|
||||
|
||||
@@ -65,7 +65,7 @@ const vector<string>& CardPrimitive::formattedText()
|
||||
s[found] = '/';
|
||||
found = s.find_first_of("{}", found + 1);
|
||||
}
|
||||
std::string::size_type len = 30;
|
||||
std::string::size_type len = neofont ? 24 :30;
|
||||
while (s.length() > 0)
|
||||
{
|
||||
std::string::size_type cut = s.find_first_of("., \t)", 0);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
|
||||
void CreditBonus::Render(float x, float y, JLBFont * font){
|
||||
void CreditBonus::Render(float x, float y, WFont * font){
|
||||
char buffer[512];
|
||||
sprintf(buffer, "%s: %i", text.c_str(), value);
|
||||
font->DrawString(buffer,x,y);
|
||||
@@ -170,9 +170,9 @@ void Credits::compute(Player * _p1, Player * _p2, GameApp * _app){
|
||||
void Credits::Render(){
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
JLBFont * f = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
JLBFont * f2 = resources.GetJLBFont(Constants::MENU_FONT);
|
||||
JLBFont * f3 = resources.GetJLBFont(Constants::MAGIC_FONT);
|
||||
WFont * f = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * f2 = resources.GetWFont(Constants::MENU_FONT);
|
||||
WFont * f3 = resources.GetWFont(Constants::MAGIC_FONT);
|
||||
f->SetScale(1);
|
||||
f->SetColor(ARGB(255,255,255,255));
|
||||
f2->SetScale(1);
|
||||
|
||||
@@ -77,7 +77,7 @@ int Damage::resolve(){
|
||||
}
|
||||
|
||||
void Damage::Render(){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
char buffer[200];
|
||||
|
||||
@@ -51,7 +51,7 @@ void DamagerDamaged::clearDamage()
|
||||
void DamagerDamaged::Render(CombatStep mode)
|
||||
{
|
||||
TransientCardView::Render();
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
|
||||
switch (mode)
|
||||
|
||||
@@ -73,7 +73,7 @@ int SacrificeCost::doPay(){
|
||||
|
||||
void SacrificeCost::Render(){
|
||||
//TODO : real stuff
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
char buffer[200];
|
||||
@@ -163,7 +163,7 @@ int CounterCost::doPay(){
|
||||
}
|
||||
|
||||
void CounterCost::Render(){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
char buffer[200];
|
||||
|
||||
@@ -146,11 +146,16 @@ void GameApp::Create()
|
||||
jq->SetHotSpot(16,16);
|
||||
|
||||
LOG("--Loading fonts");
|
||||
resources.LoadJLBFont("simon",11);
|
||||
resources.GetJLBFont("simon")->SetTracking(-1);
|
||||
resources.LoadJLBFont("f3",16);
|
||||
resources.LoadJLBFont("magic",16);
|
||||
resources.LoadJLBFont("smallface", 7);
|
||||
resources.LoadWFBFont("simon",12);
|
||||
resources.LoadWFBFont("f3",16);
|
||||
resources.LoadWFBFont("magic",16);
|
||||
resources.LoadWFBFont("smallface",12);
|
||||
|
||||
resources.LoadWLBFont("simon",11);
|
||||
resources.GetWFont("simon")->SetTracking(-1);
|
||||
resources.LoadWLBFont("f3",16);
|
||||
resources.LoadWLBFont("magic",16);
|
||||
resources.LoadWLBFont("smallface", 7);
|
||||
|
||||
|
||||
LOG("--Loading various textures");
|
||||
@@ -340,7 +345,7 @@ void GameApp::Render()
|
||||
{
|
||||
if (systemError.size()){
|
||||
fprintf(stderr, "%s", systemError.c_str());
|
||||
JLBFont * mFont= resources.GetJLBFont("simon");
|
||||
WFont * mFont= resources.GetWFont("simon");
|
||||
if (mFont) mFont->DrawString(systemError.c_str(),1,1);
|
||||
return;
|
||||
}
|
||||
@@ -360,7 +365,7 @@ void GameApp::Render()
|
||||
float fps = mEngine->GetFPS();
|
||||
totalFPS += fps;
|
||||
nbUpdates+=1;
|
||||
JLBFont * mFont= resources.GetJLBFont("simon");
|
||||
WFont * mFont= resources.GetWFont("simon");
|
||||
char buf[512];
|
||||
sprintf(buf, "avg:%.02f - %.02f fps",totalFPS/nbUpdates, fps);
|
||||
if (mFont) {
|
||||
@@ -438,4 +443,4 @@ void GameApp::playMusic(string filename, bool loop) {
|
||||
music = resources.ssLoadMusic(filename.c_str());
|
||||
if (music) JSoundSystem::GetInstance()->PlayMusic(music, loop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,13 @@ int GameState::fillDeckMenu(SimpleMenu * _menu, string path, string smallDeckPre
|
||||
sprintf(deckDesc, "%s",meta->name.c_str());
|
||||
}
|
||||
deckDesc[16] = 0;
|
||||
_menu->Add(nbDecks,deckDesc,meta->desc);
|
||||
//translate decks desc
|
||||
Translator * t = Translator::GetInstance();
|
||||
map<string,string>::iterator it = t->deckValues.find(meta->name);
|
||||
if (it != t->deckValues.end())
|
||||
_menu->Add(nbDecks,deckDesc,it->second);
|
||||
else
|
||||
_menu->Add(nbDecks,deckDesc,meta->desc);
|
||||
}
|
||||
}
|
||||
return nbDecks;
|
||||
|
||||
@@ -427,7 +427,7 @@ void GameStateDeckViewer::Update(float dt)
|
||||
|
||||
|
||||
void GameStateDeckViewer::renderOnScreenBasicInfo(){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
char buffer[256];
|
||||
int myD = (displayed_deck == myDeck);
|
||||
|
||||
@@ -450,7 +450,7 @@ void GameStateDeckViewer::renderOnScreenBasicInfo(){
|
||||
|
||||
|
||||
void GameStateDeckViewer::renderSlideBar(){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
|
||||
int total = displayed_deck->Size();
|
||||
float filler = 15;
|
||||
@@ -522,7 +522,7 @@ void GameStateDeckViewer::renderDeckBackground(){
|
||||
|
||||
void GameStateDeckViewer::renderOnScreenMenu(){
|
||||
|
||||
JLBFont * font = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * font = resources.GetWFont(Constants::MAIN_FONT);
|
||||
font->SetColor(ARGB(255,255,255,255));
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
float pspIconsSize = 0.5;
|
||||
@@ -1184,7 +1184,7 @@ int GameStateDeckViewer::countCardsByType(const char * _type) {
|
||||
}
|
||||
|
||||
void GameStateDeckViewer::renderCard(int id, float rotation){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
MTGCard * card = cardIndex[id];
|
||||
|
||||
float max_scale = 0.96f;
|
||||
@@ -1255,7 +1255,7 @@ void GameStateDeckViewer::renderCard(int id, float rotation){
|
||||
float qtX = x + 40*scale;
|
||||
char buffer[4096];
|
||||
sprintf(buffer, "x%i", displayed_deck->count(card));
|
||||
JLBFont * font = mFont;
|
||||
WFont * font = mFont;
|
||||
font->SetColor(ARGB(fontAlpha/2,0,0,0));
|
||||
JRenderer::GetInstance()->FillRect(qtX, qtY,font->GetStringWidth(buffer) + 6,16,ARGB(fontAlpha/2,0,0,0));
|
||||
font->DrawString(buffer, qtX + 4, qtY + 4);
|
||||
@@ -1272,7 +1272,7 @@ void GameStateDeckViewer::renderCard (int id){
|
||||
|
||||
void GameStateDeckViewer::Render() {
|
||||
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
r->ClearScreen(ARGB(0,0,0,0));
|
||||
|
||||
@@ -392,7 +392,7 @@ void GameStateDuel::Update(float dt)
|
||||
|
||||
void GameStateDuel::Render()
|
||||
{
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
r->ClearScreen(ARGB(0,0,0,0));
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "../include/DeckStats.h"
|
||||
#include "../include/PlayerData.h"
|
||||
#include "../include/utils.h"
|
||||
#include "../include/WFont.h"
|
||||
|
||||
static const char* GAME_VERSION = "WTH?! 0.12.1 - by wololo";
|
||||
|
||||
@@ -364,7 +365,7 @@ void GameStateMenu::ensureMGuiController(){
|
||||
if (!mGuiController) {
|
||||
mGuiController = NEW JGuiController(100, this);
|
||||
if (mGuiController) {
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MENU_FONT);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
mGuiController->Add(NEW MenuItem(MENUITEM_PLAY, mFont, "Play", 80, 50 + SCREEN_HEIGHT/2, mIcons[8], mIcons[9],"particle1.psi",resources.GetQuad("particles"), true));
|
||||
mGuiController->Add(NEW MenuItem(MENUITEM_DECKEDITOR, mFont, "Deck Editor", 160, 50 + SCREEN_HEIGHT/2, mIcons[2], mIcons[3],"particle2.psi",resources.GetQuad("particles")));
|
||||
@@ -542,7 +543,7 @@ void GameStateMenu::Render()
|
||||
return;
|
||||
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MENU_FONT);
|
||||
if ((currentState & MENU_STATE_MAJOR) == MENU_STATE_MAJOR_LANG){
|
||||
}else if ((currentState & MENU_STATE_MAJOR) == MENU_STATE_MAJOR_LOADING_CARDS){
|
||||
if(!splashTex){
|
||||
@@ -575,7 +576,7 @@ void GameStateMenu::Render()
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
mFont->DrawString(text,SCREEN_WIDTH/2,SCREEN_HEIGHT - 50,JGETEXT_CENTER);
|
||||
}else{
|
||||
mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
PIXEL_TYPE colors[] =
|
||||
{
|
||||
|
||||
@@ -609,7 +610,7 @@ void GameStateMenu::Render()
|
||||
if(options.newAward())
|
||||
alp = (int)(sin(timeIndex) * 255);
|
||||
float olds = mFont->GetScale();
|
||||
mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
jq->SetColor(ARGB(abs(alp),255,255,255));
|
||||
mFont->SetColor(ARGB(abs(alp),0,0,0));
|
||||
string s = _("Trophy Room");;
|
||||
@@ -617,7 +618,7 @@ void GameStateMenu::Render()
|
||||
mFont->SetScale(50.0f/mFont->GetStringWidth(s.c_str()));
|
||||
renderer->RenderQuad(jq, SCREEN_WIDTH-64, 2);
|
||||
mFont->DrawString(s,SCREEN_WIDTH-10,9,JGETEXT_RIGHT);
|
||||
mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
||||
mFont = resources.GetWFont(Constants::MENU_FONT);
|
||||
mFont->SetScale(olds);
|
||||
}
|
||||
}
|
||||
@@ -629,7 +630,7 @@ void GameStateMenu::Render()
|
||||
|
||||
void GameStateMenu::ButtonPressed(int controllerId, int controlId)
|
||||
{
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MENU_FONT);
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
char buf[4096];
|
||||
sprintf(buf, "cnotrollerId: %i", controllerId);
|
||||
|
||||
@@ -176,8 +176,9 @@ void GameStateOptions::Render()
|
||||
"Art: Ilya B, Julio, Jeck, J, Lakeesha",
|
||||
"Check themeinfo.txt for the full credits of each theme!",
|
||||
"",
|
||||
"Dev Team: Abrasax, Daddy32, Dr.Solomat, J, Jeck",
|
||||
"Leungclj, Salmelo, Superhiro, Psyringe, Wololo, Yeshua",
|
||||
"Dev Team: Abrasax, almosthumane, Daddy32, Dr.Solomat"
|
||||
"J, Jeck, Leungclj, linshier, Salmelo, Superhiro",
|
||||
"Psyringe, Wololo, Yeshua",
|
||||
"",
|
||||
"Music by Celestial Aeon Project, http://www.jamendo.com",
|
||||
"",
|
||||
@@ -202,7 +203,7 @@ void GameStateOptions::Render()
|
||||
"Please support this project with donations at http://wololo.net/wagic",
|
||||
};
|
||||
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAGIC_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAGIC_FONT);
|
||||
mFont->SetColor(ARGB(255,200,200,200));
|
||||
mFont->SetScale(1.0);
|
||||
float startpos = 272 - timer;
|
||||
|
||||
@@ -171,7 +171,7 @@ string GameStateShop::descPurchase(int controlId, bool tiny){
|
||||
return buffer;
|
||||
}
|
||||
void GameStateShop::beginPurchase(int controlId){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MENU_FONT);
|
||||
mFont->SetScale(DEFAULT_MENU_FONT_SCALE);
|
||||
SAFE_DELETE(menu);
|
||||
if(mInventory[controlId] <= 0){
|
||||
@@ -556,7 +556,7 @@ void GameStateShop::deleteDisplay(){
|
||||
void GameStateShop::Render()
|
||||
{
|
||||
//Erase
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
r->ClearScreen(ARGB(0,0,0,0));
|
||||
if(mStage == STAGE_FADE_IN)
|
||||
|
||||
@@ -286,7 +286,7 @@ void GuiCombat::Render()
|
||||
{
|
||||
go->opponent()->mAvatar->SetHotSpot(18, 25);
|
||||
enemy_avatar.Render(go->opponent()->mAvatar);
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetColor(ARGB(255, 255, 64, 0));
|
||||
{
|
||||
char buf[10]; sprintf(buf, "%i", damage);
|
||||
@@ -302,7 +302,7 @@ void GuiCombat::Render()
|
||||
renderer->DrawLine(0, SCREEN_HEIGHT / 2 + 10, SCREEN_WIDTH, SCREEN_HEIGHT / 2 + 10, ARGB(255, 255, 64, 0));
|
||||
if (FIRST_STRIKE == step)
|
||||
{
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetColor(ARGB(255, 64, 255, 64));
|
||||
mFont->DrawString("First strike damage", 370, 2);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ void GuiHandSelf::Render()
|
||||
{
|
||||
//Empty hand
|
||||
if (state == Open && cards.size() == 0){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetColor(ARGB(255,255,0,0));
|
||||
if (OptionHandDirection::HORIZONTAL == options[Options::HANDDIRECTION].number){
|
||||
back->SetColor(ARGB(255,255,0,0));
|
||||
|
||||
@@ -213,7 +213,7 @@ GuiMana::~GuiMana(){
|
||||
void GuiMana::RenderStatic(){
|
||||
int values[Constants::MTG_NB_COLORS];
|
||||
int totalColors = 0;
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
for (int i = 0; i < Constants::MTG_NB_COLORS; ++i)
|
||||
values[i] = 0;
|
||||
|
||||
@@ -93,7 +93,7 @@ void GuiPhaseBar::Render()
|
||||
}
|
||||
|
||||
//print phase name
|
||||
JLBFont * font = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * font = resources.GetWFont(Constants::MAIN_FONT);
|
||||
string currentP = _("your turn");
|
||||
string interrupt = "";
|
||||
if (g->currentPlayer == g->players[1]){
|
||||
@@ -105,13 +105,13 @@ void GuiPhaseBar::Render()
|
||||
}
|
||||
if (g->currentlyActing() != g->currentPlayer){
|
||||
if (g->currentPlayer == g->players[0]) {
|
||||
interrupt = " - "+_("opponent plays");
|
||||
interrupt = _(" - ")+_("opponent plays");
|
||||
}else{
|
||||
interrupt = " - "+_("you play");
|
||||
interrupt = _(" - ")+_("you play");
|
||||
}
|
||||
}
|
||||
|
||||
char buf[64]; sprintf(buf, "(%s%s) %s", currentP.c_str(),interrupt.c_str(),_(PhaseRing::phaseName(phase->id)).c_str());
|
||||
char buf[64]; sprintf(buf, _("(%s%s) %s").c_str(), currentP.c_str(),interrupt.c_str(),_(PhaseRing::phaseName(phase->id)).c_str());
|
||||
font->DrawString(buf, SCREEN_WIDTH-5, 2,JGETEXT_RIGHT);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ void GuiAvatar::Render()
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
int life = player->life;
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
//Avatar
|
||||
int lifeDiff = life - currentLife;
|
||||
@@ -128,7 +128,7 @@ void GuiGameZone::Render(){
|
||||
JRenderer::GetInstance()->FillRect(actX,actY,quad->mWidth * scale * actZ,quad->mHeight *scale * actZ, ARGB(abs(128 - wave),255,255,255));
|
||||
|
||||
//Number of cards
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
char buffer[11];
|
||||
int mAlpha = (int)(actA);
|
||||
|
||||
@@ -229,6 +229,7 @@ int MTGAllCards::load(const char * config_file, const char * set_name,int autolo
|
||||
if (!std::getline(setFile, s)) return total_cards;
|
||||
if (!s.size()) continue;
|
||||
|
||||
if (s[s.size()-1] == '\r') s.erase(s.size()-1); // Handle DOS files
|
||||
switch (conf_read_mode) {
|
||||
case MTGAllCards::READ_ANYTHING:
|
||||
if (s[0] == '['){
|
||||
@@ -261,7 +262,6 @@ int MTGAllCards::load(const char * config_file, const char * set_name,int autolo
|
||||
tempCard = NULL;
|
||||
tempPrimitive = NULL;
|
||||
} else {
|
||||
if (s[s.size()-1] == '\r') s.erase(s.size()-1); // Handle DOS files
|
||||
processConfLine(s, tempCard, tempPrimitive);
|
||||
}
|
||||
continue;
|
||||
@@ -898,8 +898,8 @@ int MTGSetInfo::totalCards(){
|
||||
|
||||
string MTGSetInfo::getName(){
|
||||
if(name.size())
|
||||
return _(name); //Pretty name is translated.
|
||||
return id; //Ugly name is not.
|
||||
return name; //Pretty name is translated when rendering.
|
||||
return id; //Ugly name as well.
|
||||
}
|
||||
string MTGSetInfo::getBlock(){
|
||||
if(block < 0 || block >= (int) setlist.blocks.size())
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
MTGGamePhase::MTGGamePhase(int id):ActionElement(id){
|
||||
animation = 0;
|
||||
currentState = -1;
|
||||
mFont= resources.GetJLBFont("simon");
|
||||
mFont= resources.GetWFont("simon");
|
||||
mFont->SetBase(0); // using 2nd font
|
||||
}
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ void MTGMomirRule::Update(float dt){
|
||||
|
||||
void MTGMomirRule::Render(){
|
||||
if (!textAlpha) return;
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::MENU_FONT);
|
||||
mFont->SetScale(2 - (float)textAlpha/130);
|
||||
mFont->SetColor(ARGB(textAlpha,255,255,255));
|
||||
mFont->DrawString(text.c_str(),SCREEN_WIDTH/2,SCREEN_HEIGHT/2,JGETEXT_CENTER);
|
||||
@@ -446,7 +446,7 @@ void HUDDisplay::Render(){
|
||||
HUDDisplay::HUDDisplay(int _id):MTGAbility(_id, NULL){
|
||||
timestamp = 0;
|
||||
popdelay = 2;
|
||||
f = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
f = resources.GetWFont(Constants::MAIN_FONT);
|
||||
maxWidth = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "../include/GameOptions.h"
|
||||
#include "../include/Translate.h"
|
||||
|
||||
MenuItem::MenuItem(int id, JLBFont *font, string text, int x, int y, JQuad * _off, JQuad * _on, const char * particle, JQuad * particleTex, bool hasFocus): JGuiObject(id), mFont(font), mX(x), mY(y)
|
||||
MenuItem::MenuItem(int id, WFont *font, string text, int x, int y, JQuad * _off, JQuad * _on, const char * particle, JQuad * particleTex, bool hasFocus): JGuiObject(id), mFont(font), mX(x), mY(y)
|
||||
{
|
||||
mText = _(text);
|
||||
updatedSinceLastRender = 1;
|
||||
|
||||
@@ -17,7 +17,7 @@ OptionItem::OptionItem( int _id, string _displayValue): WGuiItem(_displayValue)
|
||||
|
||||
//OptionInteger
|
||||
void OptionInteger::Render(){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
|
||||
@@ -67,7 +67,7 @@ void OptionSelect::Entering(JButton key){
|
||||
}
|
||||
|
||||
void OptionSelect::Render(){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
@@ -164,7 +164,7 @@ void OptionProfile::populate(){
|
||||
|
||||
void OptionProfile::Render(){
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetScale(1);
|
||||
int spacing = 2+(int)mFont->GetHeight();
|
||||
|
||||
@@ -403,7 +403,7 @@ void OptionTheme::Render(){
|
||||
renderer->RenderQuad(q,x, y,0,scale,scale);
|
||||
}
|
||||
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT_HEADER));
|
||||
mFont->DrawString(buf, x + 2, y + 2);
|
||||
if(bChecked && author.size()){
|
||||
@@ -438,7 +438,7 @@ OptionKey::OptionKey(GameStateOptions* g, LocalKeySym from, JButton to) : WGuiIt
|
||||
|
||||
void OptionKey::Update(float dt) { if (btnMenu) btnMenu->Update(dt); }
|
||||
void OptionKey::Render() {
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
|
||||
@@ -498,7 +498,7 @@ bool OptionKey::isModal() { return grabbed || btnMenu; }
|
||||
void OptionKey::Overlay()
|
||||
{
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetColor(ARGB(255, 0, 0, 0));
|
||||
if (grabbed) {
|
||||
static const int x = 30, y = 45;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
float ShopItems::_y4[] = {169,188,250,182,182,168,220,208,198,259,245};
|
||||
|
||||
|
||||
ShopItem::ShopItem(int id, JLBFont *font, char* text, JQuad * _quad,JQuad * _thumb, float _xy[], bool hasFocus, int _price): JGuiObject(id), mFont(font), mText(text), quad(_quad), thumb(_thumb), price(_price)
|
||||
ShopItem::ShopItem(int id, WFont *font, char* text, JQuad * _quad,JQuad * _thumb, float _xy[], bool hasFocus, int _price): JGuiObject(id), mFont(font), mText(text), quad(_quad), thumb(_thumb), price(_price)
|
||||
{
|
||||
for (int i = 0; i < 8; ++i){
|
||||
xy[i] = _xy[i];
|
||||
@@ -52,7 +52,7 @@ ShopItem::ShopItem(int id, JLBFont *font, char* text, JQuad * _quad,JQuad * _thu
|
||||
Entering();
|
||||
}
|
||||
|
||||
ShopItem::ShopItem(int id, JLBFont *font, int _cardid, float _xy[], bool hasFocus, MTGAllCards * collection, int _price, DeckDataWrapper * ddw): JGuiObject(id), mFont(font), price(_price){
|
||||
ShopItem::ShopItem(int id, WFont *font, int _cardid, float _xy[], bool hasFocus, MTGAllCards * collection, int _price, DeckDataWrapper * ddw): JGuiObject(id), mFont(font), price(_price){
|
||||
for (int i = 0; i < 8; ++i){
|
||||
xy[i] = _xy[i];
|
||||
}
|
||||
@@ -227,7 +227,7 @@ bool ShopItem::ButtonPressed()
|
||||
}
|
||||
|
||||
|
||||
ShopItems::ShopItems(int id, JGuiListener* listener, JLBFont* font, int x, int y, MTGAllCards * _collection, int _setIds[]): JGuiController(id, listener), mX(x), mY(y), mFont(font), collection(_collection){
|
||||
ShopItems::ShopItems(int id, JGuiListener* listener, WFont* font, int x, int y, MTGAllCards * _collection, int _setIds[]): JGuiController(id, listener), mX(x), mY(y), mFont(font), collection(_collection){
|
||||
mHeight = 0;
|
||||
showPriceDialog = -1;
|
||||
dialog = NULL;
|
||||
|
||||
@@ -18,7 +18,7 @@ JTexture* SimpleMenu::spadeRTex = NULL;
|
||||
JTexture* SimpleMenu::spadeLTex = NULL;
|
||||
JTexture* SimpleMenu::jewelTex = NULL;
|
||||
JTexture* SimpleMenu::sideTex = NULL;
|
||||
JLBFont* SimpleMenu::titleFont = NULL;
|
||||
WFont* SimpleMenu::titleFont = NULL;
|
||||
hgeParticleSystem* SimpleMenu::stars = NULL;
|
||||
unsigned int SimpleMenu::refCount = 0;
|
||||
// Here comes the magic of jewel graphics
|
||||
@@ -86,8 +86,8 @@ void SimpleMenu::drawVertPole(int x, int y, int height) {
|
||||
}
|
||||
|
||||
void SimpleMenu::Render() {
|
||||
JLBFont * titleFont = resources.GetJLBFont("smallface");
|
||||
JLBFont * mFont = resources.GetJLBFont(fontId);
|
||||
WFont * titleFont = resources.GetWFont("smallface");
|
||||
WFont * mFont = resources.GetWFont(fontId);
|
||||
if (0 == mWidth) {
|
||||
float sY = mY + VMARGIN;
|
||||
for (int i = startId; i < startId + mCount; ++i) {
|
||||
@@ -129,7 +129,7 @@ void SimpleMenu::Render() {
|
||||
if (i > mCount-1) break;
|
||||
if ((static_cast<SimpleMenuItem*>(mObjects[i]))->mY - LINE_HEIGHT * startId < mY + height - LINE_HEIGHT + 7) {
|
||||
if (static_cast<SimpleMenuItem*>(mObjects[i])->hasFocus()){
|
||||
resources.GetJLBFont(Constants::MAIN_FONT)->DrawString(static_cast<SimpleMenuItem*>(mObjects[i])->desc.c_str(),mX+mWidth+10,mY+15);
|
||||
resources.GetWFont(Constants::MAIN_FONT)->DrawString(static_cast<SimpleMenuItem*>(mObjects[i])->desc.c_str(),mX+mWidth+10,mY+15);
|
||||
mFont->SetColor(ARGB(255,255,255,0));
|
||||
} else
|
||||
mFont->SetColor(ARGB(150,255,255,255));
|
||||
|
||||
@@ -19,7 +19,7 @@ SimpleMenuItem::SimpleMenuItem(SimpleMenu* _parent, int id, int fontId, string t
|
||||
|
||||
void SimpleMenuItem::RenderWithOffset(float yOffset)
|
||||
{
|
||||
JLBFont * mFont = resources.GetJLBFont(fontId);
|
||||
WFont * mFont = resources.GetWFont(fontId);
|
||||
//mFont->SetColor(ARGB(255,255,255,255));
|
||||
mFont->DrawString(mText.c_str(), mX, mY + yOffset, JGETEXT_CENTER);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ void SimpleMenuItem::Relocate(int x, int y)
|
||||
|
||||
int SimpleMenuItem::GetWidth()
|
||||
{
|
||||
JLBFont * mFont = resources.GetJLBFont(fontId);
|
||||
WFont * mFont = resources.GetWFont(fontId);
|
||||
mFont->SetScale(1.0);
|
||||
return mFont->GetStringWidth(mText.c_str());
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ string SimplePad::Finish() {
|
||||
|
||||
void SimplePad::Render(){
|
||||
//This could use some cleaning up to make margins more explicit
|
||||
JLBFont * mFont = resources.GetJLBFont("f3");
|
||||
WFont * mFont = resources.GetWFont("f3");
|
||||
|
||||
int offX = 0, offY = 0;
|
||||
int kH = mFont->GetHeight();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "../include/Credits.h"
|
||||
#include "../include/PlayerData.h"
|
||||
#include "../include/MTGDeck.h"
|
||||
#include <JLBFont.h>
|
||||
#include "../include/WFont.h"
|
||||
#include <JGE.h>
|
||||
#include <JFileSystem.h>
|
||||
|
||||
@@ -40,14 +40,14 @@ StoryText::StoryText(string text, float _mX, float _mY, string _align, int _font
|
||||
}
|
||||
}
|
||||
void StoryText::Render() {
|
||||
JLBFont * mFont = resources.GetJLBFont(font);
|
||||
WFont * mFont = resources.GetWFont(font);
|
||||
mFont->SetColor(ARGB(200,255,255,255));
|
||||
mFont->SetScale(1.0);
|
||||
mFont->DrawString(text.c_str(), mX, mY, align);
|
||||
}
|
||||
|
||||
float StoryText::getHeight() {
|
||||
JLBFont * mFont = resources.GetJLBFont(font);
|
||||
WFont * mFont = resources.GetWFont(font);
|
||||
return mFont->GetHeight();
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ StoryPage::StoryPage(StoryFlow * mParent):mParent(mParent){
|
||||
|
||||
void StoryChoice::Render()
|
||||
{
|
||||
JLBFont * mFont = resources.GetJLBFont(font);
|
||||
WFont * mFont = resources.GetWFont(font);
|
||||
mFont->SetColor(ARGB(200,255,255,255));
|
||||
if (mHasFocus) mFont->SetColor(ARGB(255,255,255,0));
|
||||
mFont->SetScale(mScale);
|
||||
@@ -204,7 +204,7 @@ void StoryChoice::Render()
|
||||
}
|
||||
|
||||
float StoryChoice::getHeight() {
|
||||
JLBFont * mFont = resources.GetJLBFont(font);
|
||||
WFont * mFont = resources.GetWFont(font);
|
||||
return mFont->GetHeight() * mScale;
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ bool StoryFlow::parse(string path)
|
||||
if (!fileSystem->OpenFile(path.c_str())) return false;
|
||||
|
||||
int size = fileSystem->GetFileSize();
|
||||
char *xmlBuffer = new char[size];
|
||||
char *xmlBuffer = NEW char[size];
|
||||
fileSystem->ReadFile(xmlBuffer, size);
|
||||
|
||||
TiXmlDocument doc;
|
||||
|
||||
@@ -202,31 +202,31 @@ Task* Task::createFromStr(string params, bool rand) {
|
||||
|
||||
switch (exploded[0][0]) {
|
||||
case TASK_WIN_AGAINST:
|
||||
result = new TaskWinAgainst();
|
||||
result = NEW TaskWinAgainst();
|
||||
break;
|
||||
case TASK_SLAUGHTER:
|
||||
result = new TaskSlaughter();
|
||||
result = NEW TaskSlaughter();
|
||||
break;
|
||||
case TASK_DELAY:
|
||||
result = new TaskDelay();
|
||||
result = NEW TaskDelay();
|
||||
break;
|
||||
case TASK_IMMORTAL:
|
||||
result = new TaskImmortal();
|
||||
result = NEW TaskImmortal();
|
||||
break;
|
||||
case TASK_MASSIVE_BURIAL:
|
||||
result = new TaskMassiveBurial();
|
||||
result = NEW TaskMassiveBurial();
|
||||
break;
|
||||
case TASK_WISDOM:
|
||||
result = new TaskWisdom();
|
||||
result = NEW TaskWisdom();
|
||||
break;
|
||||
case TASK_PACIFISM:
|
||||
result = new TaskPacifism();
|
||||
result = NEW TaskPacifism();
|
||||
break;
|
||||
default:
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
OutputDebugString("\nTasks.cpp::createFromStr: Undefined class type\n");
|
||||
#endif
|
||||
result = new TaskWinAgainst();
|
||||
result = NEW TaskWinAgainst();
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
@@ -430,9 +430,9 @@ void TaskList::Update(float dt) {
|
||||
void TaskList::Render() {
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
//Setup fonts.
|
||||
JLBFont * f = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
JLBFont * f2 = resources.GetJLBFont(Constants::MAGIC_FONT);
|
||||
JLBFont * f3 = resources.GetJLBFont(Constants::MENU_FONT); //OPTION_FONT
|
||||
WFont * f = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * f2 = resources.GetWFont(Constants::MAGIC_FONT);
|
||||
WFont * f3 = resources.GetWFont(Constants::MENU_FONT); //OPTION_FONT
|
||||
f2->SetColor(ARGB(255, 205, 237, 240));
|
||||
f3->SetColor(ARGB(255, 219, 206, 151));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../include/TextScroller.h"
|
||||
#include "../include/WResourceManager.h"
|
||||
#include "../include/utils.h"
|
||||
#include <JLBFont.h>
|
||||
#include "../include/WFont.h"
|
||||
|
||||
TextScroller::TextScroller(int fontId, float x, float y, float width, float speed):JGuiObject(0),fontId(fontId){
|
||||
mWidth = width;
|
||||
@@ -35,7 +35,7 @@ void TextScroller::Update(float dt){
|
||||
if(!strings.size())
|
||||
return;
|
||||
start+=mSpeed*dt;
|
||||
JLBFont * mFont = resources.GetJLBFont(fontId);
|
||||
WFont * mFont = resources.GetWFont(fontId);
|
||||
if (start > mFont->GetStringWidth(mText.c_str())){
|
||||
start = -mWidth;
|
||||
if (mRandom){
|
||||
@@ -50,7 +50,7 @@ void TextScroller::Update(float dt){
|
||||
}
|
||||
|
||||
void TextScroller::Render(){
|
||||
JLBFont * mFont = resources.GetJLBFont(fontId);
|
||||
WFont * mFont = resources.GetWFont(fontId);
|
||||
mFont->DrawString(mText.c_str(),mX,mY,JGETEXT_LEFT,start,mWidth);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ Translator::~Translator(){
|
||||
}
|
||||
Translator::Translator(){
|
||||
initDone = false;
|
||||
neofont = false;
|
||||
//init();
|
||||
}
|
||||
|
||||
@@ -68,6 +69,10 @@ void Translator::load(string filename, map<string,string> * dictionary) {
|
||||
while(std::getline(file,s)){
|
||||
if (!s.size()) continue;
|
||||
if (s[s.size()-1] == '\r') s.erase(s.size()-1); //Handle DOS files
|
||||
//Translate '@' to '\n'
|
||||
char * sp = (char *)s.c_str();
|
||||
for (int i = 0; sp[i]; i++)
|
||||
if (sp[i] == '@') sp[i] = '\n';
|
||||
size_t found = s.find('=');
|
||||
if (found == string::npos) continue;
|
||||
string s1 = s.substr(0,found);
|
||||
@@ -103,6 +108,33 @@ void Translator::initCards(){
|
||||
load(cards_dict,&tempValues);
|
||||
}
|
||||
|
||||
void Translator::initDecks(){
|
||||
string lang = options[Options::LANG].str;
|
||||
if (!lang.size()) return;
|
||||
string decks_dict = "Res/lang/" + lang + "_decks.txt";
|
||||
|
||||
// Load file
|
||||
std::ifstream file(decks_dict.c_str());
|
||||
if(file){
|
||||
string s;
|
||||
initDone = true;
|
||||
while(std::getline(file,s)){
|
||||
if (!s.size()) continue;
|
||||
if (s[s.size()-1] == '\r') s.erase(s.size()-1); //Handle DOS files
|
||||
// Translate '@' to '\n'
|
||||
char * sp = (char *)s.c_str();
|
||||
for (int i = 0; sp[i]; i++)
|
||||
if (sp[i] == '@') sp[i] = '\n';
|
||||
size_t found = s.find('=');
|
||||
if (found == string::npos) continue;
|
||||
string s1 = s.substr(0,found);
|
||||
string s2 = s.substr(found+1);
|
||||
deckValues[s1] = s2;
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void Translator::init() {
|
||||
#if defined DEBUG_TRANSLATE
|
||||
checkMisses = 0;
|
||||
@@ -112,11 +144,17 @@ void Translator::init() {
|
||||
string name = "Res/lang/" + lang + ".txt";
|
||||
|
||||
if (fileExists(name.c_str())){
|
||||
// fixup for Chinese language support.
|
||||
if (lang.compare("cn") == 0)
|
||||
neofont = true;
|
||||
else
|
||||
neofont = false;
|
||||
initDone = true;
|
||||
load(name,&values);
|
||||
}
|
||||
|
||||
initCards();
|
||||
initDecks();
|
||||
|
||||
}
|
||||
|
||||
@@ -125,3 +163,4 @@ string _(string toTranslate){
|
||||
return t->translate(toTranslate);
|
||||
}
|
||||
|
||||
bool neofont;
|
||||
|
||||
@@ -20,7 +20,7 @@ const KeyRep& translateKey(LocalKeySym key) {
|
||||
char* str = XKeysymToString(key);
|
||||
if (!str)
|
||||
{
|
||||
str = new char[11];
|
||||
str = NEW char[11];
|
||||
sprintf(str, "%lu", key);
|
||||
}
|
||||
const KeyRep k = make_pair(str, static_cast<JQuad*>(NULL));
|
||||
@@ -64,7 +64,7 @@ const KeyRep& translateKey(LocalKeySym key) {
|
||||
|
||||
KeyRep k;
|
||||
if (0 == s.length()) {
|
||||
char*str = new char[11];
|
||||
char*str = NEW char[11];
|
||||
sprintf(str, "%d", key);
|
||||
k = make_pair(str, static_cast<JQuad*>(NULL));
|
||||
}
|
||||
@@ -98,7 +98,7 @@ const KeyRep& translateKey(LocalKeySym key) {
|
||||
}
|
||||
else
|
||||
{
|
||||
char* str = new char[11];
|
||||
char* str = NEW char[11];
|
||||
sprintf(str, "%d", key);
|
||||
fattable[key] = make_pair(str, static_cast<JQuad*>(static_cast<JQuad*>(NULL)));
|
||||
}
|
||||
@@ -177,7 +177,7 @@ const KeyRep& translateKey(JButton key) {
|
||||
}
|
||||
else
|
||||
{
|
||||
char* str = new char[11];
|
||||
char* str = NEW char[11];
|
||||
sprintf(str, "%d", key);
|
||||
slimtable[key] = make_pair(str, static_cast<JQuad*>(static_cast<JQuad*>(NULL)));
|
||||
}
|
||||
|
||||
450
projects/mtg/src/WFont.cpp
Normal file
450
projects/mtg/src/WFont.cpp
Normal file
@@ -0,0 +1,450 @@
|
||||
#include "../include/config.h"
|
||||
#include "../include/WFont.h"
|
||||
#include "../include/WResourceManager.h"
|
||||
#include "JFileSystem.h"
|
||||
|
||||
#define ISGBK(c) ((c) > 0x80 || (c) < 0x20 || (c) == '-')
|
||||
|
||||
static PIXEL_TYPE gencolor(int id, PIXEL_TYPE color)
|
||||
{
|
||||
unsigned int a, r, g, b, r0, g0, b0;
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
a = (color >> 24) & 0xFF;
|
||||
r = (color >> 16) & 0xFF;
|
||||
g = (color >> 8) & 0xFF;
|
||||
b = (color >> 0) & 0xFF;
|
||||
#else // PSP
|
||||
# if defined (ABGR8888)
|
||||
a = (color >> 24) & 0xFF;
|
||||
b = (color >> 16) & 0xFF;
|
||||
g = (color >> 8) & 0xFF;
|
||||
r = (color >> 0) & 0xFF;
|
||||
# elif defined (ABGR5551)
|
||||
a = ((color >> 15) & 0x01) << 7;
|
||||
b = ((color >> 10) & 0x1F) << 3;
|
||||
g = ((color >> 5) & 0x1F) << 3;
|
||||
r = ((color >> 0) & 0x1F) << 3;
|
||||
# elif defined (ABGR4444)
|
||||
a = ((color >> 12) & 0x0F) << 4;
|
||||
b = ((color >> 8) & 0x0F) << 4;
|
||||
g = ((color >> 4) & 0x0F) << 4;
|
||||
r = ((color >> 0) & 0x0F) << 4;
|
||||
# endif
|
||||
#endif
|
||||
r0 = g0 = b0 = 255;
|
||||
|
||||
switch (id) {
|
||||
case 0: // simon 245, 228, 156
|
||||
r0 = 245; g0 = 228; b0 = 156;
|
||||
break;
|
||||
case 1: // f3 255, 252, 175
|
||||
r0 = 255; g0 = 252; b0 = 175;
|
||||
break;
|
||||
case 2: // magic 219, 255, 151
|
||||
r0 = 219; g0 = 255; b0 = 151;
|
||||
break;
|
||||
case 3: // smallface 255, 255, 255
|
||||
r0 = 255; g0 = 255; b0 = 255;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
r = r * r0 / 255;
|
||||
g = g * g0 / 255;
|
||||
b = b * b0 / 255;
|
||||
|
||||
return ARGB(a,r,g,b);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
JRenderer * WFBFont::mRenderer = NULL;
|
||||
|
||||
WFBFont::WFBFont(const char *fontname, int lineheight, bool useVideoRAM)
|
||||
{
|
||||
mRenderer = JRenderer::GetInstance();
|
||||
|
||||
mCharBuffer = NULL;
|
||||
mSprites = NULL;
|
||||
mGBCode = NULL;
|
||||
mCurr = 0;
|
||||
|
||||
char chnFileName[32], engFileName[32];
|
||||
sprintf(chnFileName, "%s.gbk", fontname);
|
||||
sprintf(engFileName, "%s.asc", fontname);
|
||||
JFileSystem *fileSys = JFileSystem::GetInstance();
|
||||
int size = 0;
|
||||
|
||||
if (!fileSys->OpenFile(chnFileName))
|
||||
return;
|
||||
size = fileSys->GetFileSize();
|
||||
mChnFont = NEW BYTE[size];
|
||||
fileSys->ReadFile(mChnFont, size);
|
||||
fileSys->CloseFile();
|
||||
|
||||
if (!fileSys->OpenFile(engFileName))
|
||||
return;
|
||||
size = fileSys->GetFileSize();
|
||||
mEngFont = NEW BYTE[size];
|
||||
fileSys->ReadFile(mEngFont, size);
|
||||
fileSys->CloseFile();
|
||||
|
||||
mColor0 = ARGB(255, 255, 255, 255);
|
||||
mColor = mColor0;
|
||||
mFontSize = lineheight;
|
||||
mScale = 1.0f;
|
||||
|
||||
// using 4-bit(half-byte) to store 1 pixel
|
||||
mBytesPerRow = mFontSize / 2;
|
||||
mBytesPerChar = mBytesPerRow*mFontSize;
|
||||
|
||||
mCacheImageWidth = 256;
|
||||
mCacheImageHeight = 256;
|
||||
mCol = mCacheImageWidth / mFontSize;
|
||||
mRow = mCacheImageHeight / mFontSize;
|
||||
mCacheSize = mCol * mRow;
|
||||
|
||||
mSprites = NEW JQuad*[mCacheSize];
|
||||
mGBCode = NEW int[mCacheSize];
|
||||
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
mCharBuffer = NEW DWORD[mFontSize*mFontSize];
|
||||
#endif
|
||||
|
||||
mTexture = mRenderer->CreateTexture(mCacheImageWidth, mCacheImageHeight, true);
|
||||
|
||||
int index = 0;
|
||||
for (int y = 0; y < mRow; y++) {
|
||||
for (int x = 0; x<mCol; x++) {
|
||||
mGBCode[index] = -1;
|
||||
mSprites[index] = NEW JQuad(mTexture, x*mFontSize, y*mFontSize, mFontSize, mFontSize);
|
||||
mSprites[index]->SetHotSpot(mFontSize / 2, mFontSize / 2);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WFBFont::~WFBFont()
|
||||
{
|
||||
SAFE_DELETE(mEngFont);
|
||||
SAFE_DELETE(mChnFont);
|
||||
SAFE_DELETE(mTexture);
|
||||
|
||||
if (mSprites) {
|
||||
for (int i = 0; i < mCacheSize; i++) {
|
||||
if (mSprites[i])
|
||||
delete mSprites[i];
|
||||
}
|
||||
delete [] mSprites;
|
||||
}
|
||||
|
||||
if (mGBCode)
|
||||
delete [] mGBCode;
|
||||
|
||||
if (mCharBuffer)
|
||||
delete [] mCharBuffer;
|
||||
}
|
||||
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
#else
|
||||
static void SwizzlePlot(u8* out, PIXEL_TYPE color, int i, int j, unsigned int width)
|
||||
{
|
||||
unsigned int rowblocks = (width >> 4);
|
||||
|
||||
unsigned int blockx = (i >> 4);
|
||||
unsigned int blocky = (j >> 3);
|
||||
|
||||
unsigned int x = (i - (blockx << 4));
|
||||
unsigned int y = (j - (blocky << 3));
|
||||
unsigned int block_index = blockx + ((blocky) * rowblocks);
|
||||
unsigned int block_address = block_index << 7;
|
||||
|
||||
u8* p = out + (block_address + x + (y << 4));
|
||||
PIXEL_TYPE* dest = (PIXEL_TYPE *)p;
|
||||
*dest = color;
|
||||
}
|
||||
#endif
|
||||
|
||||
int WFBFont::PreCacheChar(const BYTE *ch)
|
||||
{
|
||||
int code;
|
||||
bool isChinese = true;
|
||||
BYTE* src;
|
||||
int size, offset;
|
||||
u8 gray;
|
||||
|
||||
if (*ch > 0xA0 && *(ch + 1) > 0xA0)
|
||||
// get offset to the proper character bits (GB2312 encoding)
|
||||
code = (((DWORD)(*ch - 0xA1)) * 0x5E + ((DWORD)(*(ch + 1) - 0xA1)));
|
||||
else if (*ch > 0x80) {
|
||||
// get offset to the character space's bits (GBK encoding)
|
||||
code = 0;
|
||||
}
|
||||
else {
|
||||
code = ((DWORD)*ch)|0x10000;
|
||||
isChinese = false;
|
||||
}
|
||||
|
||||
if (mGBCode[mCurr] != -1) {
|
||||
for (int i = 0; i < mCacheSize; i++) {
|
||||
if (mGBCode[i] == code)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
int index = mCurr++;
|
||||
if (mCurr >= mCacheSize)
|
||||
mCurr = 0;
|
||||
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
memset(mCharBuffer, 0, sizeof(DWORD) * mFontSize * mFontSize);
|
||||
#else
|
||||
u8* pTexture = (u8*) mTexture->mBits;
|
||||
int x;
|
||||
int y = (int)mSprites[index]->mY;
|
||||
#endif
|
||||
|
||||
if (isChinese) {
|
||||
size = mFontSize;
|
||||
src = mChnFont + code * mBytesPerChar;
|
||||
offset = 0;
|
||||
}
|
||||
else {
|
||||
size = mFontSize / 2;
|
||||
src = mEngFont + (code - 0x10000) * (mFontSize * size / 2);
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
// set up the font texture buffer
|
||||
for (int i = 0; i < mFontSize; i++) {
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
x = 0;
|
||||
#else
|
||||
x = (int)mSprites[index]->mX;
|
||||
#endif
|
||||
int j = 0;
|
||||
#if 1
|
||||
for (; j < offset; j++) {
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
mCharBuffer[y * mFontSize + x] = ARGB(0, 0, 0, 0);
|
||||
#else
|
||||
SwizzlePlot(pTexture, ARGB(0, 0, 0, 0), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE);
|
||||
#endif
|
||||
x++;
|
||||
}
|
||||
#endif
|
||||
for (; j < offset + size; j++) {
|
||||
// as 4-bit(half-byte) stores 1 pixel
|
||||
// get out the proper data according to the even or odd quality of the counter
|
||||
gray = src[(i * size + j - offset) / 2];
|
||||
gray = ((j - offset) & 1) ? (gray & 0xF0) : ((gray & 0x0F) << 4);
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
mCharBuffer[y * mFontSize + x] = ARGB(gray, 255, 255, 255);
|
||||
#else
|
||||
SwizzlePlot(pTexture, ARGB(gray, 255, 255, 255), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE);
|
||||
#endif
|
||||
x++;
|
||||
}
|
||||
for (; j < mFontSize; j++) {
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
mCharBuffer[y * mFontSize + x] = ARGB(0, 0, 0, 0);
|
||||
#else
|
||||
SwizzlePlot(pTexture, ARGB(0, 0, 0, 0), x * PIXEL_SIZE, y, mTexture->mTexWidth * PIXEL_SIZE);
|
||||
#endif
|
||||
x++;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
|
||||
mGBCode[index] = code;
|
||||
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
x = (int)mSprites[index]->mX;
|
||||
y = (int)mSprites[index]->mY;
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, mFontSize, mFontSize, GL_RGBA, GL_UNSIGNED_BYTE, mCharBuffer);
|
||||
#else
|
||||
sceKernelDcacheWritebackAll();
|
||||
#endif
|
||||
return index;
|
||||
}
|
||||
|
||||
void WFBFont::DrawString(const char *s, float x, float y, int align, float leftOffset, float width)
|
||||
{
|
||||
unsigned char c = *(unsigned short *)s & 0xFF;
|
||||
if (ISGBK(c) || (s[1] == ':' && s[2] == ' ')) {}
|
||||
else {
|
||||
WFont * mFont = resources.GetWLBFont(id);
|
||||
mFont->SetScale(GetScale());
|
||||
mFont->SetColor(GetColor());
|
||||
mFont->DrawString(s, x, y, align, leftOffset, width);
|
||||
return;
|
||||
}
|
||||
|
||||
BYTE* str = (BYTE*)s;
|
||||
|
||||
// (0, 0) refers to the center of the word, so fix it to the upper-left corner
|
||||
x += (mFontSize * mScale) / 2;
|
||||
y += (mFontSize * mScale) / 2;
|
||||
switch (align) {
|
||||
case JGETEXT_RIGHT:
|
||||
x -= GetStringWidth(s);
|
||||
break;
|
||||
case JGETEXT_CENTER:
|
||||
x -= GetStringWidth(s) / 2;
|
||||
break;
|
||||
case JGETEXT_LEFT:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
mRenderer->BindTexture(mTexture);
|
||||
|
||||
BYTE* src = str;
|
||||
float xx = x;
|
||||
float yy = y;
|
||||
int index;
|
||||
|
||||
bool isChinese=true;
|
||||
|
||||
while (*src != 0) {
|
||||
if (yy > SCREEN_HEIGHT_F) // don't render or count outside the buttom of viewport
|
||||
return;
|
||||
else if (yy + mFontSize < 0.0f) { // don't render when outside the top of viewport, but counted
|
||||
if (*src < ' ') { // control characters
|
||||
if (*src == 0x0a) { // NEWLINE
|
||||
xx = x;
|
||||
yy += (mFontSize*mScale);
|
||||
}
|
||||
src += 1;
|
||||
}
|
||||
else {
|
||||
if (*src > 0x80) // Chinese characters (GBK encoding)
|
||||
src += 2;
|
||||
else
|
||||
src += 1;
|
||||
|
||||
xx += (mFontSize*mScale);
|
||||
|
||||
if (xx >= 480) {
|
||||
xx = x;
|
||||
yy += (mFontSize*mScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (*src < ' ') { // control characters
|
||||
if (*src == 0x0a) { // NEWLINE
|
||||
xx = x;
|
||||
yy += (mFontSize * mScale);
|
||||
}
|
||||
src += 1;
|
||||
}
|
||||
else {
|
||||
if (*src > 0x80) { // Chinese characters (GBK encoding)
|
||||
index = PreCacheChar(src);
|
||||
src += 2;
|
||||
isChinese = true;
|
||||
}
|
||||
else {
|
||||
index = PreCacheChar(src);
|
||||
src += 1;
|
||||
isChinese = false;
|
||||
}
|
||||
|
||||
// fix for leftoffset and witdth's setting
|
||||
float xPos, yPos, charWidth, charHeight;
|
||||
mSprites[index]->GetTextureRect(&xPos, &yPos, &charWidth, &charHeight);
|
||||
float xPos0 = xPos;
|
||||
float charWidth0 = charWidth;
|
||||
float delta = (isChinese) ? (charWidth * mScale) : (charWidth * mScale / 2);
|
||||
if (leftOffset) {
|
||||
if (leftOffset < 0){
|
||||
xx -= leftOffset;
|
||||
leftOffset = 0;
|
||||
}
|
||||
else if (leftOffset - delta > 0) {
|
||||
leftOffset -= delta;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
xPos += leftOffset / mScale;
|
||||
delta -= leftOffset;
|
||||
leftOffset = 0;
|
||||
charWidth = delta / mScale;
|
||||
}
|
||||
}
|
||||
else if (width){
|
||||
if (xx > x + width)
|
||||
return;
|
||||
if (xx + delta > x + width) {
|
||||
delta = x + width - xx;
|
||||
charWidth = delta / mScale;
|
||||
}
|
||||
}
|
||||
mSprites[index]->SetTextureRect(xPos, yPos, charWidth, charHeight);
|
||||
mSprites[index]->SetColor(mColor);
|
||||
mRenderer->RenderQuad(mSprites[index], xx, yy, 0, mScale, mScale);
|
||||
mSprites[index]->SetTextureRect(xPos0, yPos, charWidth0, charHeight);
|
||||
|
||||
xx += delta;
|
||||
if (xx >= 480) {
|
||||
xx = x;
|
||||
yy += (mFontSize * mScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WFBFont::DrawString(std::string s, float x, float y, int align, float leftOffset, float width)
|
||||
{
|
||||
DrawString(s.c_str(),x,y,align,leftOffset,width);
|
||||
}
|
||||
|
||||
void WFBFont::SetColor(PIXEL_TYPE color)
|
||||
{
|
||||
mColor0 = color;
|
||||
mColor = gencolor(id, color);
|
||||
}
|
||||
|
||||
float WFBFont::GetStringWidth(const char *s) const
|
||||
{
|
||||
unsigned char c = *(unsigned short *)s & 0xFF;
|
||||
|
||||
if (ISGBK(c)) {
|
||||
BYTE* src = (BYTE*)s;
|
||||
float xx = 0;
|
||||
bool isChinese=true;
|
||||
|
||||
while (*src != 0) {
|
||||
if (*src > 0x80) { // Chinese
|
||||
src += 2;
|
||||
isChinese = true;
|
||||
}
|
||||
else { // Non-Chinese
|
||||
src += 1;
|
||||
isChinese = false;
|
||||
}
|
||||
if (isChinese)
|
||||
xx += (mFontSize * mScale);
|
||||
else
|
||||
xx += (mFontSize * mScale) / 2;
|
||||
}
|
||||
return xx;
|
||||
}
|
||||
else {
|
||||
WFont * mFont = resources.GetWLBFont(id);
|
||||
mFont->SetScale(GetScale());
|
||||
return mFont->GetStringWidth(s);
|
||||
}
|
||||
}
|
||||
|
||||
void WFBFont::SetScale(float scale)
|
||||
{
|
||||
mScale = scale;
|
||||
}
|
||||
|
||||
float WFBFont::GetScale() const {return mScale;}
|
||||
float WFBFont::GetHeight() const {return (mFontSize * mScale);}
|
||||
|
||||
@@ -65,11 +65,11 @@ void WGuiItem::Entering(JButton key){
|
||||
mFocus = true;
|
||||
}
|
||||
float WGuiItem::minWidth(){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
return mFont->GetStringWidth(_(displayValue).c_str())+4;
|
||||
}
|
||||
float WGuiItem::minHeight(){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
return mFont->GetHeight();
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ bool WGuiItem::Leaving(JButton key){
|
||||
|
||||
void WGuiItem::Render(){
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
DWORD oldcolor = mFont->GetColor();
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
float fH = (height-mFont->GetHeight())/2;
|
||||
@@ -162,7 +162,7 @@ PIXEL_TYPE WDecoStyled::getColor(int type){
|
||||
|
||||
//WGuiHeader
|
||||
void WGuiHeader::Render(){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
@@ -263,7 +263,7 @@ void WGuiList::Render(){
|
||||
|
||||
//List is empty.
|
||||
if (!items.size() && failMsg != ""){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT_FAIL));
|
||||
mFont->DrawString(_(failMsg).c_str(),x+width/2, y, JGETEXT_RIGHT);
|
||||
return;
|
||||
@@ -401,7 +401,7 @@ string WDecoEnum::lookupVal(int value){
|
||||
|
||||
void WDecoEnum::Render()
|
||||
{
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
mFont->DrawString(_(getDisplay()).c_str(), getX() + 2, getY() + 3);
|
||||
@@ -968,7 +968,7 @@ void WGuiTabMenu::Add(WGuiBase * it){
|
||||
}
|
||||
|
||||
void WGuiTabMenu::Render(){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
|
||||
if (!items.size())
|
||||
@@ -1000,7 +1000,7 @@ void WGuiTabMenu::save(){
|
||||
//WGuiAward
|
||||
void WGuiAward::Overlay(){
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetScale(.8);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
|
||||
@@ -1051,7 +1051,7 @@ void WGuiAward::Render(){
|
||||
return;
|
||||
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetScale(1);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
|
||||
@@ -1293,7 +1293,7 @@ void WGuiListRow::Render(){
|
||||
|
||||
//List is empty.
|
||||
if (!items.size() && failMsg != ""){
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT_FAIL));
|
||||
mFont->DrawString(_(failMsg).c_str(),x+width/2, y, JGETEXT_RIGHT);
|
||||
return;
|
||||
@@ -1937,7 +1937,7 @@ void WGuiKeyBinder::Render() {
|
||||
WGuiList::Render();
|
||||
if (confirmMenu) {
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont->SetColor(ARGB(255, 255, 0, 0));
|
||||
renderer->FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(230, 255, 240, 240));
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#include "../include/WFont.h"
|
||||
extern bool neofont;
|
||||
|
||||
int idCounter = OTHERS_OFFSET;
|
||||
|
||||
@@ -35,7 +37,7 @@ bool WResourceManager::RemoveOldest(){
|
||||
//WResourceManager
|
||||
void WResourceManager::DebugRender(){
|
||||
JRenderer* renderer = JRenderer::GetInstance();
|
||||
JLBFont * font = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
WFont * font = resources.GetWFont(Constants::MAIN_FONT);
|
||||
font->SetColor(ARGB(255,255,255,255));
|
||||
|
||||
if(!font || !renderer)
|
||||
@@ -166,9 +168,13 @@ WResourceManager::WResourceManager(){
|
||||
mQuadList.reserve(0);
|
||||
mQuadMap.clear();
|
||||
|
||||
mFontList.clear();
|
||||
mFontList.reserve(4);
|
||||
mFontMap.clear();
|
||||
mWFontList.clear();
|
||||
mWFontList.reserve(4);
|
||||
mWFontMap.clear();
|
||||
|
||||
mWLBFontList.clear();
|
||||
mWLBFontList.reserve(4);
|
||||
mWLBFontMap.clear();
|
||||
|
||||
psiWCache.Resize(PSI_CACHE_SIZE,20);
|
||||
sampleWCache.Resize(SAMPLES_CACHE_SIZE,MAX_CACHED_SAMPLES);
|
||||
@@ -181,6 +187,8 @@ WResourceManager::WResourceManager(){
|
||||
WResourceManager::~WResourceManager(){
|
||||
LOG("==Destroying WResourceManager==");
|
||||
RemoveAll();
|
||||
RemoveWFonts();
|
||||
RemoveWLBFonts();
|
||||
|
||||
for(vector<WManagedQuad*>::iterator it=managedQuads.begin();it!=managedQuads.end();it++){
|
||||
WManagedQuad* wm = *it;
|
||||
@@ -782,40 +790,127 @@ int WResourceManager::fileOK(string filename, bool relative){
|
||||
return result;
|
||||
}
|
||||
|
||||
int WResourceManager::reloadJLBFonts(){
|
||||
int WResourceManager::reloadWLBFonts(){
|
||||
vector<string> fontNames;
|
||||
vector<float> fontSizes;
|
||||
fontNames.resize(mFontList.size());
|
||||
fontSizes.resize(mFontList.size());
|
||||
for ( map<string, int>::iterator itr = mFontMap.begin(); itr != mFontMap.end(); ++itr){
|
||||
fontNames[itr->second] = itr->first;
|
||||
fontSizes[itr->second] = mFontList[itr->second]->GetHeight();
|
||||
}
|
||||
|
||||
RemoveJLBFonts();
|
||||
|
||||
for(size_t i = 0; i < fontNames.size(); ++i){
|
||||
LoadJLBFont(fontNames[i],fontSizes[i]);
|
||||
fontNames.resize(mWLBFontList.size());
|
||||
fontSizes.resize(mWLBFontList.size());
|
||||
for ( map<string, int>::iterator itr = mWLBFontMap.begin(); itr != mWLBFontMap.end(); ++itr){
|
||||
fontNames[itr->second] = itr->first;
|
||||
fontSizes[itr->second] = mWLBFontList[itr->second]->GetHeight();
|
||||
}
|
||||
RemoveWLBFonts();
|
||||
for(size_t i = 0; i < fontNames.size(); ++i){
|
||||
LoadWLBFont(fontNames[i],fontSizes[i]);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int WResourceManager::reloadWFonts(){
|
||||
//TODO: LoadWFont().
|
||||
#if 0
|
||||
vector<string> fontNames;
|
||||
vector<float> fontSizes;
|
||||
|
||||
fontNames.resize(mWFontList.size());
|
||||
fontSizes.resize(mWFontList.size());
|
||||
for ( map<string, int>::iterator itr = mWFontMap.begin(); itr != mWFontMap.end(); ++itr){
|
||||
fontNames[itr->second] = itr->first;
|
||||
fontSizes[itr->second] = mWFontList[itr->second]->GetHeight();
|
||||
}
|
||||
RemoveWFonts();
|
||||
for(size_t i = 0; i < fontNames.size(); ++i){
|
||||
LoadWFont(fontNames[i],fontSizes[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
JLBFont * WResourceManager::LoadJLBFont(const string &fontName, int height){
|
||||
map<string, int>::iterator itr = mFontMap.find(fontName);
|
||||
WFont * WResourceManager::LoadWLBFont(const string &fontName, int height) {
|
||||
map<string, int>::iterator itr = mWLBFontMap.find(fontName);
|
||||
|
||||
if (itr != mFontMap.end()) return mFontList[itr->second];
|
||||
if (itr != mWLBFontMap.end()) return mWLBFontList[itr->second];
|
||||
|
||||
string mFontName = fontName + ".png";
|
||||
string path = graphicsFile(mFontName);
|
||||
if (path.size() > 4 ) path = path.substr(0, path.size() - 4); //some stupid manipulation because of the way JLBFont works in JGE
|
||||
int id = mFontList.size();
|
||||
mFontList.push_back(NEW JLBFont(path.c_str(), height, true));
|
||||
mFontMap[fontName] = id;
|
||||
string path = graphicsFile(mFontName);
|
||||
if (path.size() > 4 ) path = path.substr(0, path.size() - 4); //some stupid manipulation because of the way Font works in JGE
|
||||
int id = mWLBFontList.size();
|
||||
mWLBFontList.push_back(NEW WLBFont(path.c_str(), height, true));
|
||||
mWLBFontMap[fontName] = id;
|
||||
mWLBFontList[id]->id = id;
|
||||
|
||||
return mFontList[id];
|
||||
return mWLBFontList[id];
|
||||
}
|
||||
|
||||
WFont * WResourceManager::LoadWFBFont(const string &fontName, int height) {
|
||||
map<string, int>::iterator itr = mWFontMap.find(fontName);
|
||||
if (itr != mWFontMap.end()) return mWFontList[itr->second];
|
||||
|
||||
string mFontName = fontName + ".gbk";
|
||||
string path = graphicsFile(mFontName);
|
||||
if (path.size() > 4 ) path = path.substr(0, path.size() - 4); //some stupid manipulation because of the way WFont works in JGE
|
||||
|
||||
int id = mWFontList.size();
|
||||
mWFontList.push_back(NEW WFBFont(path.c_str(), height, true));
|
||||
mWFontMap[fontName] = id;
|
||||
mWFontList[id]->id = id;
|
||||
|
||||
return mWFontList[id];
|
||||
}
|
||||
|
||||
WFont * WResourceManager::GetWFont(const string &fontName) {
|
||||
map<string, int>::iterator itr;
|
||||
|
||||
if (neofont) {
|
||||
itr = mWFontMap.find(fontName);
|
||||
if (itr != mWFontMap.end())
|
||||
return mWFontList[itr->second];
|
||||
else
|
||||
return NULL;
|
||||
} else {
|
||||
itr = mWLBFontMap.find(fontName);
|
||||
if (itr != mWLBFontMap.end())
|
||||
return mWLBFontList[itr->second];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
WFont * WResourceManager::GetWFont(int id) {
|
||||
if (neofont) {
|
||||
return mWFontList[id];
|
||||
} else {
|
||||
if (id >=0 && id < (int)mWLBFontList.size())
|
||||
return mWLBFontList[id];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
WFont * WResourceManager::GetWLBFont(int id) {
|
||||
if (id >=0 && id < (int)mWLBFontList.size())
|
||||
return mWLBFontList[id];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void WResourceManager::RemoveWLBFonts() {
|
||||
for (vector<WLBFont *>::iterator font = mWLBFontList.begin(); font != mWLBFontList.end(); ++font)
|
||||
delete *font;
|
||||
mWLBFontList.clear();
|
||||
mWLBFontMap.clear();
|
||||
}
|
||||
|
||||
void WResourceManager::RemoveWFonts() {
|
||||
for (vector<WFont *>::iterator font = mWFontList.begin(); font != mWFontList.end(); ++font)
|
||||
delete *font;
|
||||
mWFontList.clear();
|
||||
mWFontMap.clear();
|
||||
}
|
||||
|
||||
void WResourceManager::autoResize(){
|
||||
#if defined WIN32 || defined LINUX
|
||||
@@ -840,7 +935,8 @@ JMusic * WResourceManager::ssLoadMusic(const char *fileName){
|
||||
|
||||
void WResourceManager::Refresh(){
|
||||
//Really easy cache relinking.
|
||||
reloadJLBFonts();
|
||||
reloadWFonts();
|
||||
reloadWLBFonts();
|
||||
sampleWCache.Refresh();
|
||||
textureWCache.Refresh();
|
||||
psiWCache.Refresh();
|
||||
|
||||
@@ -832,6 +832,10 @@
|
||||
RelativePath=".\src\WFilter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\WFont.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\WGui.cpp"
|
||||
>
|
||||
@@ -1229,6 +1233,10 @@
|
||||
RelativePath=".\include\WFilter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\WFont.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\WGui.h"
|
||||
>
|
||||
|
||||
12
projects/mtg/tools/neofont/Makefile
Normal file
12
projects/mtg/tools/neofont/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
INCDIR = -I/usr/include/freetype2
|
||||
LIBS = -lfreetype
|
||||
|
||||
CFLAGS += $(INCDIR)
|
||||
|
||||
all : neofont
|
||||
|
||||
neofont : neofont.o
|
||||
$(CC) -o neofont $(LIBS) $<
|
||||
|
||||
clean :
|
||||
@rm -f neofont *.o *.asc *.gbk
|
||||
2
projects/mtg/tools/neofont/README
Normal file
2
projects/mtg/tools/neofont/README
Normal file
@@ -0,0 +1,2 @@
|
||||
fallback.ttf from http://android.git.kernel.org/?p=platform/frameworks/base.git;a=tree;f=data/fonts;hb=HEAD
|
||||
gkai00mp.ttf from http://cle.linux.org.tw/fonts/Arphic/
|
||||
BIN
projects/mtg/tools/neofont/fallback.ttf
Normal file
BIN
projects/mtg/tools/neofont/fallback.ttf
Normal file
Binary file not shown.
BIN
projects/mtg/tools/neofont/gkai00mp.ttf
Normal file
BIN
projects/mtg/tools/neofont/gkai00mp.ttf
Normal file
Binary file not shown.
290
projects/mtg/tools/neofont/neofont.c
Normal file
290
projects/mtg/tools/neofont/neofont.c
Normal file
@@ -0,0 +1,290 @@
|
||||
// font generator for WFBFont by linshier
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
FT_Library m_library;
|
||||
iconv_t ic;
|
||||
|
||||
// gb2312 to unicode
|
||||
unsigned short to_unicode(char * szStr)
|
||||
{
|
||||
static wchar_t target[3];
|
||||
#if 0
|
||||
if((MultiByteToWideChar(CP_ACP, 0, szStr, 2, target, 3)) != 0)
|
||||
return (unsigned short)target[0];
|
||||
#else
|
||||
char *inp = szStr;
|
||||
char *outp = (char *)target;
|
||||
unsigned char *op = (char *)target;
|
||||
int inlen = strlen(szStr), outlen = 6;
|
||||
if (iconv(ic,(char **)&inp, &inlen, (char **)&outp, &outlen) != -1)
|
||||
return (unsigned short)target[0];
|
||||
else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int render_cn12(const char * szFilename, const char * szOutputname)
|
||||
{
|
||||
unsigned char zslot[12 * 12 / 2];
|
||||
FT_Face face;
|
||||
FILE * fp;
|
||||
unsigned char i, j, y;
|
||||
int ctr = 0;
|
||||
|
||||
if (FT_New_Face(m_library, szFilename, 0, &face) != 0)
|
||||
return -1;
|
||||
|
||||
if (FT_Set_Char_Size(face, 0, 12 * 64, 72, 0) != 0 || (fp = fopen(szOutputname,"w")) == NULL) {
|
||||
FT_Done_Face(face);
|
||||
return -1;
|
||||
}
|
||||
#if 0
|
||||
// GBK encoding
|
||||
for (i = 0x81; i < 0xFF; i ++) {
|
||||
for (j = 0x40; j < 0xFF; j ++) {
|
||||
#else
|
||||
// GB2312 encoding
|
||||
for (i = 0xA1; i < 0xF8; i ++) {
|
||||
for (j = 0xA1; j < 0xFF; j ++) {
|
||||
#endif
|
||||
unsigned char s[3] = {(unsigned char)i, (unsigned char)j, 0};
|
||||
unsigned short code = to_unicode((char *)s);
|
||||
memset(zslot, 0, 12 * 12 / 2);
|
||||
if (code && FT_Load_Char(face, code, FT_LOAD_RENDER) == 0) {
|
||||
if (face->glyph->bitmap.buffer != NULL && face->glyph->bitmap_top > 0) {
|
||||
unsigned char left = face->glyph->bitmap_left > 0 ? face->glyph->bitmap_left : 0;
|
||||
for (y = 0; y < face->glyph->bitmap.rows && y < 12 && y - face->glyph->bitmap_top < 2; y++) {
|
||||
unsigned char h = 12 - 2 - face->glyph->bitmap_top + y;
|
||||
unsigned char l = left + face->glyph->bitmap.pitch > 12 ?
|
||||
12 - left : face->glyph->bitmap.pitch;
|
||||
unsigned char u = 0;
|
||||
if (face->glyph->bitmap_top < 12 - 2) {
|
||||
for (u = 0; u < l; u++)
|
||||
zslot[(h * 12 + left + u) / 2]
|
||||
|= (face->glyph->bitmap.buffer[y * face->glyph->bitmap.pitch + u]
|
||||
& 0xF0) >> 4 * (1 - (left + u) & 1);
|
||||
}
|
||||
else {
|
||||
for (u = 0; u < l; u++)
|
||||
zslot[(y * 12 + left + u) / 2]
|
||||
|= (face->glyph->bitmap.buffer[y * face->glyph->bitmap.pitch + u]
|
||||
& 0xF0) >> 4 * (1 - (left + u) & 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i == 0xA1 && j == 0xA1) memset(zslot, 0, 12 * 12 / 2);
|
||||
fwrite(zslot, sizeof(unsigned char), 12 * 12 / 2, fp);
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
FT_Done_Face(face);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int render_cn16(const char * szFilename, const char * szOutputname)
|
||||
{
|
||||
unsigned char zslot[16 * 16 / 2];
|
||||
FT_Face face;
|
||||
FILE * fp;
|
||||
unsigned char i, j, y;
|
||||
int ctr = 0;
|
||||
|
||||
if (FT_New_Face(m_library, szFilename, 0, &face) != 0)
|
||||
return -1;
|
||||
|
||||
if (FT_Set_Char_Size(face, 0, 16 * 64, 72, 0) != 0 || (fp = fopen(szOutputname,"w")) == NULL) {
|
||||
FT_Done_Face(face);
|
||||
return -1;
|
||||
}
|
||||
#if 0
|
||||
// GBK encoding
|
||||
for (i = 0x81; i < 0xFF; i ++) {
|
||||
for (j = 0x40; j < 0xFF; j ++) {
|
||||
#else
|
||||
// GB2312 encoding
|
||||
for (i = 0xA1; i < 0xF8; i ++) {
|
||||
for (j = 0xA1; j < 0xFF; j ++) {
|
||||
#endif
|
||||
unsigned char s[3] = {(unsigned char)i, (unsigned char)j, 0};
|
||||
unsigned short code = to_unicode((char *)s);
|
||||
memset(zslot, 0, 16 * 16 / 2);
|
||||
if (code && FT_Load_Char(face, code, FT_LOAD_RENDER) == 0) {
|
||||
if (face->glyph->bitmap.buffer != NULL && face->glyph->bitmap_top > 0) {
|
||||
unsigned char left = face->glyph->bitmap_left > 0 ? face->glyph->bitmap_left : 0;
|
||||
for (y = 0; y < face->glyph->bitmap.rows && y < 16 && y - face->glyph->bitmap_top < 2; y++) {
|
||||
unsigned char h = 16 - 2 - face->glyph->bitmap_top + y;
|
||||
unsigned char l = left + face->glyph->bitmap.pitch > 16 ?
|
||||
16 - left : face->glyph->bitmap.pitch;
|
||||
unsigned char u = 0;
|
||||
if (face->glyph->bitmap_top < 16 - 2) {
|
||||
for (u = 0; u < l; u++)
|
||||
zslot[(h * 16 + left + u) / 2]
|
||||
|= (face->glyph->bitmap.buffer[y * face->glyph->bitmap.pitch + u]
|
||||
& 0xF0) >> 4 * (1 - (left + u) & 1);
|
||||
}
|
||||
else {
|
||||
for (u = 0; u < l; u++)
|
||||
zslot[(y * 16 + left + u) / 2]
|
||||
|= (face->glyph->bitmap.buffer[y * face->glyph->bitmap.pitch + u]
|
||||
& 0xF0) >> 4 * (1 - (left + u) & 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i == 0xA1 && j == 0xA1) memset(zslot, 0, 16 * 16 / 2);
|
||||
fwrite(zslot, sizeof(unsigned char), 16 * 16 / 2, fp);
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
#if 0
|
||||
if ((fp = fopen("fallback.gbk.3","w")) == NULL) {
|
||||
FT_Done_Face(face);
|
||||
return -1;
|
||||
}
|
||||
for (i = 0x81; i < 0xA1; i ++) {
|
||||
for (j = 0x40; j < 0xFF; j ++) {
|
||||
unsigned char s[3] = {(unsigned char)i, (unsigned char)j, 0};
|
||||
unsigned short code = to_unicode((char *)s);
|
||||
memset(zslot, 0, 16 * 16 / 4);
|
||||
if (code && FT_Load_Char(face, code, FT_LOAD_RENDER) == 0) {
|
||||
if (face->glyph->bitmap.buffer != NULL && face->glyph->bitmap_top > 0) {
|
||||
unsigned char left = face->glyph->bitmap_left > 0 ? face->glyph->bitmap_left : 0;
|
||||
for (y = 0; y < face->glyph->bitmap.rows && y < 16 && y - face->glyph->bitmap_top < 2; y++) {
|
||||
unsigned char h = 16 - 2 - face->glyph->bitmap_top + y;
|
||||
unsigned char l = left + face->glyph->bitmap.pitch > 16 ?
|
||||
16 - left : face->glyph->bitmap.pitch;
|
||||
unsigned char u = 0;
|
||||
if (face->glyph->bitmap_top < 16 - 2) {
|
||||
for (u = 0; u < l; u++)
|
||||
zslot[(h * 16 + left + u) / 4]
|
||||
|= (face->glyph->bitmap.buffer[y * face->glyph->bitmap.pitch + u]
|
||||
& 0xC0) >> 2 * (3 - (left + u) & 3);
|
||||
}
|
||||
else {
|
||||
for (u = 0; u < l; u++)
|
||||
zslot[(y * 16 + left + u) / 4]
|
||||
|= (face->glyph->bitmap.buffer[y * face->glyph->bitmap.pitch + u]
|
||||
& 0xC0) >> 2 * (3 - (left + u) & 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fwrite(zslot, sizeof(unsigned char), 16 * 16 / 4, fp);
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
#endif
|
||||
FT_Done_Face(face);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int render_en12(const char * szFilename, const char * szOutputname)
|
||||
{
|
||||
unsigned char zslot[12 * 6 / 2];
|
||||
FT_Face face;
|
||||
FILE * fp;
|
||||
unsigned char i, j, y;
|
||||
int ctr = 0;
|
||||
|
||||
if (FT_New_Face(m_library, szFilename, 0, &face) != 0)
|
||||
return -1;
|
||||
|
||||
if (FT_Set_Char_Size(face, 0, 10 * 64, 72, 0) != 0 || (fp = fopen(szOutputname,"w")) == NULL) {
|
||||
FT_Done_Face(face);
|
||||
return -1;
|
||||
}
|
||||
for (i = 0x00; i < 0x7F; i ++) {
|
||||
unsigned short code = i;
|
||||
memset(zslot, 0, 12 * 6 / 2);
|
||||
if (code > 0x20 && FT_Load_Char(face, code, FT_LOAD_RENDER) == 0) {
|
||||
if (face->glyph->bitmap.buffer != NULL && face->glyph->bitmap_top > 0) {
|
||||
for (y = 0; y < face->glyph->bitmap.rows && y < 12 && y - face->glyph->bitmap_top < 2; y++) {
|
||||
unsigned char h = 12 - 2 - face->glyph->bitmap_top + y;
|
||||
unsigned char u = 0;
|
||||
unsigned char left = face->glyph->bitmap.pitch > 6 ? 1 : 0;
|
||||
for (u = 0; u < left + face->glyph->bitmap.pitch; u++)
|
||||
zslot[(h * 6 + u) / 2]
|
||||
|= (face->glyph->bitmap.buffer[y * face->glyph->bitmap.pitch + left + u]
|
||||
& 0xF0) >> 4 * (1 - u & 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
fwrite(zslot, sizeof(unsigned char), 12 * 6 / 2, fp);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
FT_Done_Face(face);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int render_en16(const char * szFilename, const char * szOutputname)
|
||||
{
|
||||
unsigned char zslot[16 * 8 / 2];
|
||||
FT_Face face;
|
||||
FILE * fp;
|
||||
unsigned char i, j, y;
|
||||
int ctr = 0;
|
||||
|
||||
if (FT_New_Face(m_library, szFilename, 0, &face) != 0)
|
||||
return -1;
|
||||
|
||||
if (FT_Set_Char_Size(face, 0, 12 * 64, 72, 0) != 0 || (fp = fopen(szOutputname,"w")) == NULL) {
|
||||
FT_Done_Face(face);
|
||||
return -1;
|
||||
}
|
||||
for (i = 0x00; i < 0x7F; i ++) {
|
||||
unsigned short code = i;
|
||||
memset(zslot, 0, 16 * 8 / 2);
|
||||
if (code > 0x20 && FT_Load_Char(face, code, FT_LOAD_RENDER) == 0) {
|
||||
if (face->glyph->bitmap.buffer != NULL && face->glyph->bitmap_top > 0) {
|
||||
for (y = 0; y < face->glyph->bitmap.rows && y < 16 && y - face->glyph->bitmap_top < 2; y++) {
|
||||
unsigned char h = 16 - 2 - face->glyph->bitmap_top + y;
|
||||
unsigned char u = 0;
|
||||
unsigned char left = face->glyph->bitmap.pitch > 8 ? 1 : 0;
|
||||
for (u = 0; u < left + face->glyph->bitmap.pitch; u++)
|
||||
zslot[(h * 8 + u) / 2]
|
||||
|= (face->glyph->bitmap.buffer[y * face->glyph->bitmap.pitch + left + u]
|
||||
& 0xF0) >> 4 * (1 - u & 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
fwrite(zslot, sizeof(unsigned char), 16 * 8 / 2, fp);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
FT_Done_Face(face);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
if (FT_Init_FreeType(&m_library) != 0) {
|
||||
printf("Error initializing freetype library!\n");
|
||||
return 1;
|
||||
}
|
||||
ic = iconv_open("unicode", "gb2312");
|
||||
if (ic == 0) printf("Error initializing iconv!\n");
|
||||
|
||||
render_cn12("fallback.ttf", "simon.gbk");
|
||||
render_en12("fallback.ttf", "simon.asc");
|
||||
render_cn16("fallback.ttf", "f3.gbk");
|
||||
render_en16("fallback.ttf", "f3.asc");
|
||||
render_cn16("gkai00mp.ttf", "magic.gbk");
|
||||
render_en16("gkai00mp.ttf", "magic.asc");
|
||||
render_cn12("gkai00mp.ttf", "smallface.gbk");
|
||||
render_en12("gkai00mp.ttf", "smallface.asc");
|
||||
|
||||
iconv_close(ic);
|
||||
FT_Done_FreeType(m_library);
|
||||
printf("done\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user