Day.png);">
Apprendre


Vous êtes
nouveau sur
Oniromancie?

Visite guidée
du site


Découvrir
RPG Maker

RM 95
RM 2000/2003
RM XP
RM VX/VX Ace
RM MV/MZ

Apprendre
RPG Maker

Tutoriels
Guides
Making-of

Dans le
Forum

Section Entraide

News: Plein d'images cools créées par (...) / Sorties: Star Trek: Glorious Wolf - (...) / Jeux: Final Fantasy 2.0 / Sorties: Dread Mac Farlane - episode 2 / Sorties: Star Trek: Glorious Wolf / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

276 connectés actuellement

29107334 visiteurs
depuis l'ouverture

15031 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

Lumen

ConsoleFun

Leo-Games

Tous nos partenaires

Devenir
partenaire



Old RM Style v1.12

Ajoute plusieurs fonctionnalités de RPG Maker 2000/2003 pour que votre jeu ait un aspect rétro.

Script pour RPG Maker VX Ace
Ecrit par Joke (site de l'auteur)
Publié par BilouMaster Joke (lui envoyer un message privé)
Signaler un script cassé

❤ 2

Auteur : Joke
Logiciel : RPG Maker VX Ace
Nombre de scripts : 1
Source : https://github.com/RMEx/orms

Old RM Style est un script permettant de modifier l'apparence de votre jeu pour simuler l'affichage graphique de RPG Maker 2000 et 2003.

image
Le menu avec une font bitmap.



Fonctionnalités
- Permet d'ajouter une font en pixel et d'autres fonctionnalités
- Permet de simuler la résolution d'écran de RPG Maker 2000/2003 en passant au 640*320 (x2)
- Permet d'utiliser les formats de fichiers de RPG Maker 2000/2003 (Windowskins, charsets, monstres, panoramas, images)
- Permet d'avoir l'affichage des choix dans la boîte de dialogue

Installation
A placer au-dessus de Main, mais en-dessous des autres scripts custom. Aussi valable si vous avez installé le script Fullscreen++ de Zeus81.
Si vous utilisez la police d'écriture custom, vous devez placer les fichiers Font.png et Font_color.png dans le dossier System de votre jeu.

Utilisation
Vous pouvez configurer les fonctionnalités souhaitées dans le script. Si vous choisissez d'utiliser une police d'écriture custom et souhaitez pas personnaliser, vous pouvez utiliser Fony (voir la page GitHub, en anglais) ou FontForge.

Le script
Version 1.1.4 (version recommandée)
Corrige une erreur sur Windows 10 lors du passage en plein écran.

Ce script est prévu pour être compatible avec le Luna Engine, RME et Fullscreen ++.

Portion de code : Tout sélectionner

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
# -*- coding: utf-8 -*-
#==============================================================================
# ** OLD_RM_STYLE  V. 1.1.2
#------------------------------------------------------------------------------
# By Joke @biloumaster <joke@biloucorp.com>
# GitHub: https://github.com/RMEx/OLD_RM_STYLE
#------------------------------------------------------------------------------
# Faites un jeu RM2000/2003 sur VXAce !
# (ou le jeu oldschool dont vous rêviez depuis longtemps)
# Consultez la Configuration ci-dessous pour personnaliser votre jeu.
# Allez sur GitHub pour en apprendre plus sur les font bitmap et les fonctionnalités !
#==============================================================================
 
#==============================================================================
# ** CONFIGURATION
#==============================================================================
 
unless Module.const_defined?(:ORMS_CONFIG)
 
  module ORMS_CONFIG  
 
    # POLICE D'ECRITURE :
      BITMAP_FONT           = true  # Si true, utilise les images "Font.png" et "Font_color.png" du dossier System comme police d'écriture.
    
    # BITMAP_FONT_FEATURE_OPTIONS:
      FONT_WIDTH            = 6     # Largeur d'un caractère dans l'image
      FONT_HEIGHT           = 14    # Hauteur d'un caractère dans l'image
      DOUBLE_FONT_SIZE      = true  # Double la taille de la font si true
      LINE_HEIGHT           = 32    # Ajuste la hauteur de la ligne dans la boîte de dialogue (par défaut, VXAce: 24 et 2K(3): 32)
      PADDING               = 16    # Marge dans les fenêtres (par défaut, VXAce: 12 et 2K(3): 16)
      SHADOW                = true  # Dessine l'ombre en utilisant la dernière couleur du fichier "Font_color.png"
      REWRITE_ALL_TEXTS     = true  # r22CRIT Bitmap.draw_text au lieu de Window_Base.draw_text
 
    # BOITE DE DIALOGUE :
      OPAQUE_BOX            = false # Sit true, la boîte de dialogue a un fond opaque
      STOP_CURSOR_BLINKING  = true  # Si true, empêche le rectangle de sélection dans un choix de clignoter
      OLDSCHOOL_CHOICE_LIST = true  # Si true, utilise le système de choix par défaut de RM2K(3) (les choix sont toujours dans la boîte de dialogue principale)
    
    # ECRAN :
      OLD_RESOLUTION        = false # Affiche une résolution de 640*480 (simule la résolution de RM2k(3) à 320*240 ; la résolution par défaut de VXAce est de 544*416)
      TOGGLE_FULLSCREEN     = :F4   # Touche pour activer/désactiver le plein écran (:F3..:F11)
      TOGGLE_WINDOW_MODE    = :F5   # Touche pour activer/désactiver la mini fenêtre
                                    #   S'applique aux touches du script Fullscreen++ si vous l'utilisez.
                                    #   Le script Fullscreen++ doit être placé au-dessus de ce script !
                                    #
                                    # => Mettez 0 si vous ne souhaitez pas utiliser cette option.
 
      PIXELATE_SCREEN       = false # If you want fat pixels everywhere!
                                    #   Cette fonctionnalité est un peu gourmande. Elle tente de s'optimiser 
                                    #   avec une méthode personnalisée pour sauter les frames. Cette fonctionnalité active un FPS maison.
                                    #   Appuyez sur F2 pour afficher le FPS réel avec prise en compte du saut de frame.
 
      PIXELATION_SHORTCUT   = :F6   # La touche pour activer/désactiver la pixellisation en jeu (:F3..:F11).
                                    #   N'oubliez pas de mentionner cette option au joueur !
                                    #   Vous pouvez utiliser "Orms.set(:pixelate_screen, false)" en jeu à la place.
                                    #
                                    # => Mettez 0 si vous ne souhaitez pas utiliser cette fonctionnalité.
 
    # RESSOURCES :
      USE_OLD_RM_BACKDROP   = false # Les battlebacks de 320*240 sont automatiquement agrandis par 2
      USE_OLD_RM_MONSTER    = false # Les battlers sont automatiquement agrandis par 2
      USE_OLD_RM_PANORAMA   = false # Les parallaxes sont automatiquement agrandies par 2
      USE_OLD_RM_PICTURE    = false # Les images sont automatiquement agrandies par 2
      USE_OLD_RM_TITLE      = false # Le Title en 320*240 est automatiquement agrandi par 2
      USE_OLD_RM_CHARSET    = false # Les charsets sont automatiquement agrandis par 2
      BACKDROP_ALIGN_TOP    = false # Aligne les battlebacks en haut à gauche au lieu du centre (pour les backdrops de RM2k/3)
      KILL_CHARSET_SHIFT_Y  = false # Considère que tous les fichiers charsets ont un ! devant leur nom
      OLD_CHARSET_DIRECTION = false # Dans VXAce, les directions sont "BAS, GAUCHE, DROITE, HAUT"
                                    #   Dans RM2k(3), c'est "HAUT, DROITE, BAS, GAUCHE"
                                    #   En mettant true, vous pouvez utiliser les charsets de RM2k/3 directement !
 
    # DESTRUCTION DES FONCTIONNALITES DES NOUVEAUX RM :
      DEACTIVATE_DASH       = false # Si true, empêche le joueur de courir quand la touche Shift est pressée
    
  end
 
end
 
#==============================================================================
# ** Méthodes additionnelles pour les utilisateurs (à utiliser en appel de script)
#------------------------------------------------------------------------------
# - Orms.set(feature, state)  # Change une fonctionnalité ORMS quand vous voulez en jeu
#                               (exemple : Orms.set(:bitmap_font, false))
# - Orms.deactivate           # Désactive toutes les fonctionnalités ORMS
# - Orms.activate             # Active toutes les fonctionnalités ORMS
# - Orms.active?              # Vérifie si ORMS est utilisé/actif
# - Orms.active?(feature)     # Vérifie si une fonctionnalité spécifique est active
#                               (exemple : Orms.active?(:pixelate_screen))
#==============================================================================
 
module Orms
  extend self
  #--------------------------------------------------------------------------
  # * Changer n'importe quelle fonctionnalité du script ORMS en jeu
  #--------------------------------------------------------------------------
  def set(feature, state)
    feature = feature.to_s.upcase.to_sym
    ORMS_CONFIG.const_set(feature, state)
    if Graphics.respond_to?(:orms_screen) && [feature, state] == [:PIXELATE_SCREEN, false]
      Graphics.orms_screen.dispose unless Graphics.orms_screen.nil?
    end
    if SceneManager.scene.is_a?(Scene_Map) || SceneManager.scene.is_a?(Scene_Battle)
      if [:BITMAP_FONT, :LINE_HEIGHT, :PADDING].include?(feature)
        SceneManager.scene.create_all_windows
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Désactiver toutes les fonctionnalités
  #--------------------------------------------------------------------------
  def deactivate
    @active = false
    if Graphics.respond_to?(:orms_screen) && Graphics.orms_screen
      Graphics.orms_screen.dispose
    end
    if SceneManager.scene.is_a?(Scene_Map) || SceneManager.scene.is_a?(Scene_Battle)
      SceneManager.scene.create_all_windows
    end
  end
  #--------------------------------------------------------------------------
  # * Activer toutes les fonctionnalités
  #--------------------------------------------------------------------------
  def activate
    @active = true
  end
  #--------------------------------------------------------------------------
  # * Vérifier si ORMS et/ou une fonctionnalité sont actifs
  #--------------------------------------------------------------------------
  def active?(feature = true)
    @active = true if @active.nil?
    if feature.is_a?(Symbol)
      feature = feature.upcase
      feature = ORMS_CONFIG.const_get(feature)
    end
    @active && feature
  end
end
 
#==============================================================================
# ** BITMAP_FONT cache et USE_OLD_RM_*
#------------------------------------------------------------------------------
#  BITMAP_FONT: Utilise des images comme polices d'écriture
#  USE_OLD_RM_*: Voir ORMS_CONFIG > RESSOURCES_FEATURES dans Configuration
#==============================================================================
 
#==============================================================================
# ** Cache
#------------------------------------------------------------------------------
# Ce module charge les graphismes, crée les objets bitmap et les mémorise.
# Il peut doubler la taille des bitmap spécifiés dans ORMS_CONFIG au chargement
# et il génère et mémorise BITMAP_FONT
#==============================================================================
 
module Cache
  #--------------------------------------------------------------------------
  # * Singleton
  #--------------------------------------------------------------------------
  class << self
    #--------------------------------------------------------------------------
    # * Genère la Font Bitmap
    #--------------------------------------------------------------------------
    def generate_bitmap_font
      mask  = Bitmap.new("Graphics/System/Font")
      color_set = Bitmap.new("Graphics/System/Font_color")
      bmp_font = Bitmap.new(mask.width, mask.height * 32)
      # draw shadow
      if ORMS_CONFIG::SHADOW
        shadow_color = color_set.get_pixel(127, 63)
        shadow = Bitmap.new(mask.width, mask.height)
        shadow.height.times do |y|
          shadow.width.times do |x|
            if mask.get_pixel(x, y).red == 255
              shadow.set_pixel(x, y, shadow_color)
            end
          end
        end
        32.times do |i|
          bmp_font.blt(1, i * mask.height + 1, shadow, mask.rect)
        end
      end
      # draw font
      mask.height.times do |y|
        mask.width.times do |x|
          if mask.get_pixel(x, y).red == 255
            32.times do |i|
              xc = i % 8 * 16 + x % ORMS_CONFIG::FONT_WIDTH
              yc = i / 8 * 16 + y
              bmp_font.set_pixel(x, y + i * mask.height, color_set.get_pixel(xc, yc))
            end
          end
        end
      end
      bmp_font
    end
    #--------------------------------------------------------------------------
    # * Obtient la Font Bitmap
    #--------------------------------------------------------------------------
    def bitmap_font
      if @cache[:bitmap_font] && @cache[:bitmap_font].disposed?
        @cache[:bitmap_font] = generate_bitmap_font
      end
      @cache[:bitmap_font] ||= generate_bitmap_font
    end
    #--------------------------------------------------------------------------
    # * Charge le Bitmap
    #--------------------------------------------------------------------------
    alias_method :orms_load_bitmap, :load_bitmap
    def load_bitmap(*args)
      case args[0]
      when "Graphics/Battlebacks1/", "Graphics/Battlebacks2/"
        return load_2k_bitmap(*args) if ORMS_CONFIG::USE_OLD_RM_BACKDROP
      when "Graphics/Battlers/"
        return load_2k_bitmap(*args) if ORMS_CONFIG::USE_OLD_RM_MONSTER
      when "Graphics/Characters/"
        return load_2k_bitmap(*args) if ORMS_CONFIG::USE_OLD_RM_CHARSET
      when "Graphics/Parallaxes/"
        return load_2k_bitmap(*args) if ORMS_CONFIG::USE_OLD_RM_PANORAMA
      when "Graphics/Pictures/"
        return load_2k_bitmap(*args) if ORMS_CONFIG::USE_OLD_RM_PICTURE
      when "Graphics/Titles1/", "Graphics/Titles2/"
        return load_2k_bitmap(*args) if ORMS_CONFIG::USE_OLD_RM_TITLE
      end
      orms_load_bitmap(*args)
    end
    #--------------------------------------------------------------------------
    # * Charge le Bitmap à multiplier par 2
    #--------------------------------------------------------------------------
    def load_2k_bitmap(folder_name, filename, hue = 0)
      return load_bitmap(folder_name, filename, hue) unless Orms.active?
      @cache ||= {}
      if filename.empty?
        empty_bitmap
      elsif hue == 0
        normal_2k_bitmap(folder_name + filename)
      else
        hue_changed_2k_bitmap(folder_name + filename, hue)
      end
    end
    #--------------------------------------------------------------------------
    # * Créer/Obtenir le Bitmap normal multiplié par 2
    #--------------------------------------------------------------------------
    def normal_2k_bitmap(path)
      unless include?(path)
        bmp = Bitmap.new(path)
        @cache[path] = Bitmap.new(bmp.width*2, bmp.height*2)
        @cache[path].stretch_blt(@cache[path].rect, bmp, bmp.rect)
        bmp.dispose
      end
      @cache[path]
    end
    #--------------------------------------------------------------------------
    # * Create/Get Hue-Changed Bitmap resized by two
    #--------------------------------------------------------------------------
    def hue_changed_2k_bitmap(path, hue)
      key = [path, hue]
      unless include?(key)
        bmp = Bitmap.new(path)
        bmp.hue_change(hue)
        @cache[key] = Bitmap.new(bmp.width*2, bmp.height*2)
        @cache[key].stretch_blt(@cache[key].rect, bmp, bmp.rect)
        bmp.dispose
      end
      @cache[key]
    end
  end
end
 
if ORMS_CONFIG::BACKDROP_ALIGN_TOP
  #==============================================================================
  # ** Spriteset_Battle
  #==============================================================================
 
  class Spriteset_Battle
    #--------------------------------------------------------------------------
    # * Déplacer le Sprite au centre de l'écran
    #--------------------------------------------------------------------------
    def center_sprite(sprite)
      sprite.ox = sprite.bitmap.width / 2
      sprite.x = Graphics.width / 2
    end
  end
end
 
#==============================================================================
# ** BITMAP_FONT
#------------------------------------------------------------------------------
#  Utilise la font bitmap pour écrire des textes
#==============================================================================
 
#==============================================================================
# ** ORMS_Bitmap_Font
#------------------------------------------------------------------------------
# Ce module écrit des textes en se servant de Cache.bitmap_font.
# Il étend les capacités de WindowBase si REWRITE_ALL_TEXTS vaut FALSE
# Il étend les capacités de la class Bitmap si REWRITE_ALL_TEXTS vaut TRUE
#==============================================================================
 
module ORMS_Bitmap_Font
  #--------------------------------------------------------------------------
  # * Singleton
  #--------------------------------------------------------------------------
  class << self
    #--------------------------------------------------------------------------
    # * Included
    #--------------------------------------------------------------------------
    def included(base)
      base.class_eval do
        #--------------------------------------------------------------------------
        # * Obtenir la taille du texte
        #--------------------------------------------------------------------------
        def text_size(str)
          return orms_text_size(str) unless Orms.active?(:bitmap_font)
          s = ORMS_CONFIG::DOUBLE_FONT_SIZE ? 2 : 1
          w = ORMS_CONFIG::FONT_WIDTH
          h = ORMS_CONFIG::FONT_HEIGHT
          return Rect.new(0, 0, s * w, s * h) unless str
          Rect.new(0, 0, s * w * str.length, s * h)
        end
        #--------------------------------------------------------------------------
        # * Dessiner le texte
        #--------------------------------------------------------------------------
        def draw_text(*args)
          unless Orms.active?(:bitmap_font)
            args.pop if args.length == 4 || args.length == 7
            return orms_draw_text(*args)
          end
          if args.length.between?(2,4)
            x, y, width, text = args[0].x, args[0].y, args[0].width, args[1].to_s.clone
            align    = args[2] || 0
            color_id = args[3] || @color_id || 0
          else
            x, y, width, text = args[0], args[1], args[2], args[4].to_s.clone
            align    = args[5] || 0
            color_id = args[6] || @color_id || 0
          end
          if align == 1
            x = x + (width - text_size(text).width) / 2
          end
          if align == 2
            x = x + width - text_size(text).width
          end
          until text.empty?
            draw_char(text.slice!(0, 1), x, y, color_id)
            x += ORMS_CONFIG::FONT_WIDTH * (ORMS_CONFIG::DOUBLE_FONT_SIZE ? 2 : 1)
          end
        end
        #--------------------------------------------------------------------------
        # * Dessiner une lettre
        #--------------------------------------------------------------------------
        def draw_char(char, x, y, color_id = 0)
          s = ORMS_CONFIG::DOUBLE_FONT_SIZE ? 2 : 1
          w = ORMS_CONFIG::FONT_WIDTH
          h = ORMS_CONFIG::FONT_HEIGHT
          bmp  = Cache.bitmap_font
          char = 1 if char.ord > bmp.width / w - 1
          dest = Rect.new(x, y, w * s, h * s)
          src  = Rect.new(char.ord * w, color_id * h, w, h)
          if ORMS_CONFIG::REWRITE_ALL_TEXTS
            stretch_blt(dest, bmp, src)
          else
            contents.stretch_blt(dest, bmp, src)
          end
        end
      end
    end
  end
end
 
#==============================================================================
# ** ORMS_Bitmap
#------------------------------------------------------------------------------
#  Permet de dessiner avec la font bitmap !
#==============================================================================
 
class ORMS_Bitmap < Bitmap
  alias_method :orms_draw_text, :draw_text
  alias_method :orms_text_size, :text_size
  include ORMS_Bitmap_Font
end
 
if ORMS_CONFIG::BITMAP_FONT
 
  #==============================================================================
  # ** Window_Base
  #==============================================================================
 
  class Window_Base
    #--------------------------------------------------------------------------
    # * Obtenir la couleur du texte
    #--------------------------------------------------------------------------
    def text_color(n)
      @color_id = n
      windowskin.get_pixel(64 + (n % 8) * 8, 96 + (n / 8) * 8)
    end
    #--------------------------------------------------------------------------
    # * Dessiner texte
    #--------------------------------------------------------------------------
    alias_method :orms_draw_text, :draw_text
    def draw_text(*args)
      return orms_draw_text(*args) unless Orms.active?(:bitmap_font)
      args.push(0) if args.length == 2 || args.length == 5
      args.push(@color_id)
      contents.draw_text(*args)
    end
    #--------------------------------------------------------------------------
    # * Obtenir les couleurs du texte
    #--------------------------------------------------------------------------
    def system_color;      text_color(6);   end;    # System
    def crisis_color;      text_color(4);   end;    # Crisis
    def knockout_color;    text_color(11);  end;    # Knock out
    def mp_cost_color;     text_color(10);  end;    # MP cost
    def power_up_color;    text_color(9);   end;    # Equipment power up
    def power_down_color;  text_color(11);  end;    # Equipment power down
    def tp_cost_color;     text_color(9);   end;    # TP cost
    #--------------------------------------------------------------------------
    # * Modifier la couleur du texte
    #--------------------------------------------------------------------------
    alias_method :orms_change_color, :change_color
    def change_color(color, enabled = true)
      return orms_change_color(color, enabled) unless Orms.active?(:bitmap_font)
      contents.font.color.set(enabled ? color : text_color(3))
    end
    #--------------------------------------------------------------------------
    # * Calculer la hauteur de ligne
    #--------------------------------------------------------------------------
    alias_method :orms_calc_line_height, :calc_line_height
    def calc_line_height(text, restore_font_size = true)
      unless Orms.active?(:bitmap_font)
        return orms_calc_line_height(text, restore_font_size)
      end
      line_height
    end
    #--------------------------------------------------------------------------
    # * Obtenir la hauteur de ligne
    #--------------------------------------------------------------------------
    alias_method :orms_line_height, :line_height
    def line_height
      return orms_line_height unless Orms.active?(:bitmap_font)
      ORMS_CONFIG::LINE_HEIGHT
    end
  end
 
  #==============================================================================
  # ** REWRITE ALL TEXTS ou Window_Base seulement
  #==============================================================================
 
  if ORMS_CONFIG::REWRITE_ALL_TEXTS
    class Bitmap
      alias_method :orms_draw_text, :draw_text
      alias_method :orms_text_size, :text_size
    end
    Bitmap.send(:include, ORMS_Bitmap_Font)
  else
    Window_Base.send(:include, ORMS_Bitmap_Font)
  end
 
  #==============================================================================
  # ** Window_NameEdit
  #==============================================================================
 
  class Window_NameEdit
    #--------------------------------------------------------------------------
    # * Obtenir la hauteur de ligne
    #--------------------------------------------------------------------------
    def line_height
      24
    end
  end
 
  #==============================================================================
  # ** Window_NameInput
  #==============================================================================
 
  class Window_NameInput
    #--------------------------------------------------------------------------
    # * Ecrire "Pge" au lieu de "Page"
    #--------------------------------------------------------------------------
    LATIN1[88] = 'Nx'
    LATIN2[88] = 'Pr'
    #--------------------------------------------------------------------------
    # * Obtenir la hauteur de ligne
    #--------------------------------------------------------------------------
    def line_height
      24
    end
  end
 
  #==============================================================================
  # ** Window_Message
  #==============================================================================
 
  class Window_Message
    #--------------------------------------------------------------------------
    # * Dessiner le face (faceset)
    #--------------------------------------------------------------------------
    alias_method :orms_draw_face, :draw_face
    def draw_face(*args)
      return orms_draw_face(*args) unless Orms.active?(:bitmap_font)
      args[2] = args[3] = (contents_height - 96) / 2
      orms_draw_face(*args)
    end
    #--------------------------------------------------------------------------
    # * Obtenir la nouvelle position de la ligne en X
    #--------------------------------------------------------------------------
    alias_method :orms_new_line_x, :new_line_x
    def new_line_x
      return orms_new_line_x unless Orms.active?(:bitmap_font)
      x = [96, height - standard_padding].max
      $game_message.face_name.empty? ? 0 : x
    end
    #--------------------------------------------------------------------------
    # * Obtenir la taille de marge standard
    #--------------------------------------------------------------------------
    alias_method :orms_standard_padding, :standard_padding
    def standard_padding
      return orms_standard_padding unless Orms.active?(:bitmap_font)
      ORMS_CONFIG::PADDING
    end
  end
  class Window_ActorCommand
    alias_method :orms_standard_padding, :standard_padding
    def standard_padding
      return orms_standard_padding unless Orms.active?(:bitmap_font)
      ORMS_CONFIG::PADDING
    end
  end
  class Window_BattleStatus
    alias_method :orms_standard_padding, :standard_padding
    def standard_padding
      return orms_standard_padding unless Orms.active?(:bitmap_font)
      ORMS_CONFIG::PADDING
    end
  end
  class Window_BattleEnemy
    alias_method :orms_standard_padding, :standard_padding
    def standard_padding
      return orms_standard_padding unless Orms.active?(:bitmap_font)
      ORMS_CONFIG::PADDING
    end
  end
  class Window_PartyCommand
    alias_method :orms_standard_padding, :standard_padding
    def standard_padding
      return orms_standard_padding unless Orms.active?(:bitmap_font)
      ORMS_CONFIG::PADDING
    end
  end
 
  #==============================================================================
  # ** Window_MenuStatus
  #==============================================================================
 
  class Window_MenuStatus
    #--------------------------------------------------------------------------
    # * Dessiner Objet
    #--------------------------------------------------------------------------
    alias_method :orms_draw_item, :draw_item
    def draw_item(index)
      return orms_draw_item(index) unless Orms.active?(:bitmap_font)
      actor = $game_party.members[index]
      enabled = $game_party.battle_members.include?(actor)
      rect = item_rect(index)
      draw_item_background(index)
      draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)
      draw_actor_simple_status(actor, rect.x + 108, rect.y)
    end
  end
 
  #==============================================================================
  # ** Window_TitleCommand
  #==============================================================================
 
  class Window_TitleCommand
    #--------------------------------------------------------------------------
    # * Obtenir la largeur de la fenêtre
    #--------------------------------------------------------------------------
    alias_method :orms_window_width, :window_width
    def window_width
      return orms_window_width unless Orms.active?(:bitmap_font)
      s = ORMS_CONFIG::DOUBLE_FONT_SIZE ? 2 : 1
      max = @list.map {|i| i[:name].length * ORMS_CONFIG::FONT_WIDTH * s}.max
      max + 2 * standard_padding + 8
    end
    #--------------------------------------------------------------------------
    # * Mettre à jour la position de la fenêtre
    #--------------------------------------------------------------------------
    def update_placement
      self.x = (Graphics.width - width) / 2
      self.y = 296 * Graphics.height / 480 #RM2k(3) style, OK?
    end
  end
 
end
 
#==============================================================================
# ** OPAQUE_BOX
#------------------------------------------------------------------------------
#  Boîte de dialogue opaque
#==============================================================================
 
if ORMS_CONFIG::OPAQUE_BOX
 
  #==============================================================================
  # ** Window_Base
  #==============================================================================
 
  class Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    alias_method :orms_opaque_initialize, :initialize
    def initialize(*args)
      orms_opaque_initialize(*args)
      self.back_opacity = 255 if Orms.active?(:opaque_box)
    end
  end
 
end
 
#==============================================================================
# ** STOP_CURSOR_BLINKING
#------------------------------------------------------------------------------
#  Empêche le rectangle de sélection de clignoter
#==============================================================================
 
if ORMS_CONFIG::STOP_CURSOR_BLINKING
 
  #==============================================================================
  # ** Window
  #==============================================================================
 
  class Window
    #--------------------------------------------------------------------------
    # * Vérifier le statut du clignotement de rectangle
    #--------------------------------------------------------------------------
    alias_method :orms_active, :active
    def active
      return orms_active unless Orms.active?(:stop_cursor_blinking)
      @active
    end
    alias_method :orms_blink_active, :active=
    def active=(index)
      return orms_blink_active(index) unless Orms.active?(:stop_cursor_blinking)
      orms_blink_active(false)
      @active = index
    end
    #--------------------------------------------------------------------------
    # * Le rectangle de sélection (Rect)
    #--------------------------------------------------------------------------
    alias_method :orms_blink_cursor_rect, :cursor_rect
    def cursor_rect
      orms_blink_active(false) if Orms.active?(:stop_cursor_blinking)
      orms_blink_cursor_rect
    end
  end
 
end
 
#==============================================================================
# ** OLDSCHOOL_CHOICE_LIST
#------------------------------------------------------------------------------
#  La liste des choix comme sur RM2K(3)
#==============================================================================
 
if ORMS_CONFIG::OLDSCHOOL_CHOICE_LIST
 
  #==============================================================================
  # ** Window_Base
  #==============================================================================
 
  class Window_Base
    #--------------------------------------------------------------------------
    # * Public instance variables
    #--------------------------------------------------------------------------
    attr_accessor :line_number
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    alias_method :orms_choice_initialize, :initialize
    def initialize(*args)
      orms_choice_initialize(*args)
      @line_number = 0
    end
  end
 
  #==============================================================================
  # ** Window_Message
  #==============================================================================
 
  class Window_Message
    #--------------------------------------------------------------------------
    # * Nouvelle Page
    #--------------------------------------------------------------------------
    alias_method :orms_choice_new_page, :new_page
    def new_page(text, pos)
      orms_choice_new_page(text, pos)
      @line_number = text.split("\n").length
    end
  end
 
  #==============================================================================
  # ** Window_ChoiceList
  #==============================================================================
 
  class Window_ChoiceList
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    alias_method :oldschool_choice_initialize, :initialize
    def initialize(message_window)
      oldschool_choice_initialize(message_window)
      if Orms.active?(:oldschool_choice_list)
        self.windowskin = Cache.system("Window").clone
        self.windowskin.fill_rect(Rect.new(0,0,168,64), Color.new(0,0,0,0))
      end
    end
    #--------------------------------------------------------------------------
    # * Start Input Processing
    #--------------------------------------------------------------------------
    alias_method :orms_start, :start
    def start
      if Orms.active?(:oldschool_choice_list)
        if @message_window.openness == 0
          @message_window.create_contents
          @message_window.line_number = 0
          @message_window.open
        end
        if (@message_window.line_number + $game_message.choices.size >
            @message_window.visible_line_number)
          @message_window.input_pause
          @message_window.new_page("", {x:0, y:0, new_x:0, height:0})
        end
      end
      orms_start
    end
    #--------------------------------------------------------------------------
    # * Mise à jour de la position de la fenêtre
    #--------------------------------------------------------------------------
    alias_method :orms_update_placement, :update_placement
    def update_placement
      orms_update_placement unless Orms.active?(:oldschool_choice_list)
      self.x = @message_window.new_line_x + 6
      self.y = @message_window.y + @message_window.line_number * @message_window.line_height
      self.width = @message_window.width - self.x - 10
      self.height = fitting_height($game_message.choices.size)
      self.viewport ||= Viewport.new
      self.viewport.z = 200
    end
  end
 
end
 
#==============================================================================
# ** OLD_CHARSET_DIRECTION
#------------------------------------------------------------------------------
# Les charset de VXAce ont comme directions "BAS, GAUCHE, DROIT, HAUT"
# mais dans RM2k/3, c'est "HAUT, DROITE, BAS, GAUCHE"
# Ce fix permet d'utiliser l'affichage des direction de 2k(3) !
#==============================================================================
 
if ORMS_CONFIG::OLD_CHARSET_DIRECTION
 
  #==============================================================================
  # ** Sprite_Character
  #==============================================================================
 
  class Sprite_Character
    #--------------------------------------------------------------------------
    # * Mise à jour du rectangle d'origine
    #--------------------------------------------------------------------------
    alias_method :orms_update_src_rect, :update_src_rect
    def update_src_rect
      return orms_update_src_rect unless Orms.active?(:old_charset_direction)
      if @tile_id == 0
        direction = [2, 3, 1, 0][@character.direction / 2 - 1]
        index = @character.character_index
        pattern = @character.pattern < 3 ? @character.pattern : 1
        sx = (index % 4 * 3 + pattern) * @cw
        sy = (index / 4 * 4 + direction) * @ch
        self.src_rect.set(sx, sy, @cw, @ch)
      end
    end
  end
 
  #==============================================================================
  # ** Game_Event
  #==============================================================================
 
  class Game_Event
    #--------------------------------------------------------------------------
    # * Initie les options de la page des events
    #--------------------------------------------------------------------------
    alias_method :orms_setup_page_setting, :setup_page_settings
    def setup_page_settings
      orms_setup_page_setting
      if Orms.active?(:old_charset_direction)
        @original_direction = @direction = [8, 6, 2, 4][@page.graphic.direction / 2 - 1]
      end
    end
  end
 
end
 
#==============================================================================
# ** KILL_CHARSET_SHIFT_Y
#------------------------------------------------------------------------------
#  Considère que tous les "Characters" ont "!" devant leur nom
#==============================================================================
 
if ORMS_CONFIG::KILL_CHARSET_SHIFT_Y
 
  class Game_CharacterBase
    alias_method :orms_shift_y, :shift_y
    def shift_y
      return orms_shift_y unless Orms.active?(:kill_charset_shift_y)
      0
    end
  end
 
end
 
#==============================================================================
# ** PIXELATE_SCREEN
#------------------------------------------------------------------------------
#  Si vous souhaitez des gros pixels partout
#==============================================================================
 
if ORMS_CONFIG::PIXELATE_SCREEN
 
  #==============================================================================
  # ** ORMS_FPS
  #------------------------------------------------------------------------------
  #  Calcule le FPS du RGSS en cours de fonctionnement et le raffraîchissement de l'écran
  #==============================================================================
 
  module ORMS_FPS
    extend self
    #--------------------------------------------------------------------------
    # * Public instance variables
    #--------------------------------------------------------------------------
    attr_reader :fps, :ups, :ups2, :visible
    attr_accessor :previous_time
    #--------------------------------------------------------------------------
    # * Update rate: Number of times the FPS is calculated per second
    #--------------------------------------------------------------------------
    UPDATE_RATE = 2.0
    #--------------------------------------------------------------------------
    # * Mise à jour
    #--------------------------------------------------------------------------
    def update
      update_ups
      update_ups2
    end
    #--------------------------------------------------------------------------
    # * Calcul de Graphics.updates par seconde
    #--------------------------------------------------------------------------
    def update_ups
      @frame_count ||= 0
      @frame_count += 1
      dt = Time.now - @previous_time
      if dt >= 1.0 / UPDATE_RATE
        @ups = (@frame_count / dt).round
        @ups = [@ups, Graphics.frame_rate + 10].min
        update_fps(dt)
        @frame_count = 0
        @previous_time = Time.now
        update_counter
      end
    end
    #--------------------------------------------------------------------------
    # * Fréquence réelle de Graphics.updates
    #--------------------------------------------------------------------------
    def update_ups2
      @previous_time2 ||= @previous_time
      dt = Time.now - @previous_time2
      if dt >= 1.0 / Graphics.frame_rate
        @ups2 = (1.0 / dt).round
        @previous_time2 = Time.now
      end
    end
    #--------------------------------------------------------------------------
    # * Frames pixélisées par seconde
    #--------------------------------------------------------------------------
    def update_fps(dt)
      if Orms.active?(:pixelate_screen)
        sframe_count = Graphics.frame_counter || Graphics.frame_rate
        @fps = (sframe_count / dt).round
      else
        @fps = @ups
      end
      Graphics.frame_counter = 0
    end
    #--------------------------------------------------------------------------
    # * Initialisation du compteur affiché
    #--------------------------------------------------------------------------
    def initialize_counter
      @background = Sprite.new(Viewport.new(4, 4, 200, 30))
      @background.viewport.z = 600
      @background.bitmap = Bitmap.new(1, 1)
      @background.bitmap.set_pixel(0, 0, Color.new(0, 0, 0, 127))
      @counter = Sprite.new(@background.viewport)
      begin
        @counter.bitmap = ORMS_Bitmap.new(200, 30)
      rescue
        @counter.bitmap = Bitmap.new(200, 30)
      end
      @counter.x = 2
      @counter.y = -4
      @counter.z = 10
    end
    #--------------------------------------------------------------------------
    # * Mise à jour du compteur
    #--------------------------------------------------------------------------
    def update_counter
      @visible ||= false
      return unless @visible
      if @counter.nil? || @counter.disposed?
        @visible ? initialize_counter : return
      end
      text = [@ups, @fps].uniq
      size  = @counter.bitmap.text_size(text.join("~"))
      size2 = @counter.bitmap.text_size(text[0].to_s) if text.length == 2
      @background.zoom_x = size.width  + 4
      @background.zoom_y = size.height - 6
      @counter.bitmap.clear
      color = 9
      color = 4  if text[0] <= 30
      color = 11 if text[0] <= 15
      @counter.bitmap.draw_text(size, text[0].to_s, 0, color)
      if text.length == 2
        size.x = size2.width
        size.width -= size2.width
        @counter.bitmap.draw_text(size, "~" + text[1].to_s, 0, 3)
      end
    end
    #--------------------------------------------------------------------------
    # * Allume/éteint le compteur
    #--------------------------------------------------------------------------
    def toggle_display
      initialize_counter if @counter.nil? || @counter.disposed?
      @visible = !@visible
      visible = @visible
    end
    def visible=(v)
      return if @counter.nil? || @counter.disposed?
      @counter.visible = @background.visible = v
    end
  end
 
  #==============================================================================
  # ** ORMS_MESSAGE
  #------------------------------------------------------------------------------
  #  Affiche les messages en haut à droite de l'écran (utilisé avec "pixelation ON/OFF")
  #==============================================================================
 
  module ORMS_MESSAGE
    extend self
    #--------------------------------------------------------------------------
    # * Mise à jour du message affiché
    #--------------------------------------------------------------------------
    def update
      create_message_sprite if @message.nil? || @message.disposed?
      @timer ||= 0
      @message.opacity == 0 ? @timer = 0 : @timer += 1
      @message.opacity -= 20 if @timer > 30
    end
    #--------------------------------------------------------------------------
    # * Création du sprite
    #--------------------------------------------------------------------------
    def create_message_sprite
      @message = Sprite.new(Viewport.new(Graphics.width - 200, 4, 204, 30))
      @message.viewport.z = 600
      @message.x = -4
      @message.y = -2
      @message.z = 10
    end
    #--------------------------------------------------------------------------
    # * Affichage du message
    #--------------------------------------------------------------------------
    def display(text, color)
      @message.bitmap = get_message_bitmap(text, color)
      @message.opacity = 255
    end
    #--------------------------------------------------------------------------
    # * Obtention du Bitmap correspondant au message et mise dans le Cache
    #--------------------------------------------------------------------------
    def get_message_bitmap(text, color)
      @texts ||= Hash.new
      if @texts[text].nil? || @texts[text].is_a?(Bitmap) && @texts[text].disposed?
        begin
          @texts[text] = ORMS_Bitmap.new(200, 30)
        rescue
          @texts[text] = Bitmap.new(200, 30)
        end
        draw_message(@texts[text], text, color)
      end
      @texts[text]
    end
    #--------------------------------------------------------------------------
    # * Dessin du message dans le Bitmap
    #--------------------------------------------------------------------------
    def draw_message(bmp, text, color)
      size = bmp.text_size(text)
      size.x = 200 - 4 - size.width
      size.width  += 4
      size.height += 4
      rect = bmp.rect
      rect.width -= 2
      bmp.fill_rect(size, Color.new(0, 0, 0, 127))
      bmp.draw_text(rect, text, 2, color)
    end
    #--------------------------------------------------------------------------
    # * Cacher/Montrer le message
    #--------------------------------------------------------------------------
    def visible=(v)
      return if @message.nil? || @message.disposed?
      @message.visible = v
    end
  end
 
  #==============================================================================
  # ** Graphics
  #==============================================================================
 
  class << Graphics
    #--------------------------------------------------------------------------
    # * Public instance variables
    #--------------------------------------------------------------------------
    attr_accessor :orms_screen, :frame_counter
    #--------------------------------------------------------------------------
    # * Mise à jour du screen affiché
    #--------------------------------------------------------------------------
    alias_method :orms_graphics_update, :update
    def update
      ORMS_FPS.previous_time ||= Time.now
      @skip = ORMS_FPS.ups && ORMS_FPS.ups < (frame_rate - 10) && ORMS_FPS.ups2 < (frame_rate / 2)
      unless @skip
        if respond_to?(:zeus_fullscreen_update)
          update_screen_display
          release_alt if Disable_VX_Fullscreen and Input.trigger?(Input::ALT)
          zeus_fullscreen_update
        else
          update_screen_display
          orms_graphics_update
        end
      else
        frame_reset
      end
      ORMS_FPS.update
      ORMS_MESSAGE.update
    end
    #--------------------------------------------------------------------------
    # * Saut de frame dynamique pour les problèmes de performance
    #  N'utilise pas le saut de frame par défaut quand le FPS du RGSS < 50
    #--------------------------------------------------------------------------
    def update_screen_display
      return unless Orms.active?(:pixelate_screen)
      @timer ||= 0
      ups = ORMS_FPS.ups || frame_rate
      ups = [ups, frame_rate].min
      @timer = 0 if @timer >= (frame_rate.to_f / [ups, 20].max).round
      if @timer == 0
        pixelate_screen
        @frame_counter ||= 0
        @frame_counter += 1
      end
      @timer += 1
    end
    #--------------------------------------------------------------------------
    # * Pixeliser l'écran
    #--------------------------------------------------------------------------
    def pixelate_screen
      return unless Orms.active?(:pixelate_screen)
      if respond_to?(:screen) && screen
        esc = [screen.blur, screen.motion_blur, screen.pixelation, screen.zoom]
        if esc && esc != [0, 0, 1, 100]
          screen.update_filters
          return @orms_screen && !@orms_screen.disposed? && @orms_screen.visible = false
        else
          @orms_screen && !@orms_screen.disposed? && @orms_screen.visible = true
        end
      end
      w, h = Graphics.width / 2, Graphics.height / 2
      if @orms_screen.nil? || @orms_screen.disposed?
        @orms_screen = Sprite.new
        @orms_screen.zoom_x = 2
        @orms_screen.zoom_y = 2
        @orms_screen.bitmap = Bitmap.new(w, h)
        @orms_screen.viewport = Viewport.new
        @orms_screen.viewport.z = 500
      end
      @orms_screen.visible = ORMS_FPS.visible = ORMS_MESSAGE.visible = false
      snap = snap_to_bitmap
      @orms_screen.bitmap.stretch_blt(Rect.new(0, 0, w, h), snap, snap.rect)
      snap.dispose
      @orms_screen.visible = ORMS_MESSAGE.visible = true
      ORMS_FPS.visible = ORMS_FPS.visible
    end
    #--------------------------------------------------------------------------
    # * Faire une transition
    #--------------------------------------------------------------------------
    alias_method :orms_transition, :transition
    def transition(*args)
      pixelate_screen
      orms_transition(*args)
    end
  end
 
  #==============================================================================
  # ** Evite d'oublier une mise à jour graphique après la fermeture de la fenêtre
  #==============================================================================
 
  class Window_Base
    #--------------------------------------------------------------------------
    # * Update Close Processing
    #--------------------------------------------------------------------------
    alias_method :orms_update_close, :update_close
    def update_close
      orms_update_close
      Graphics.pixelate_screen if close?
    end
  end
 
end
 
#==============================================================================
# ** TOGGLE_SCREEN_INPUT
#------------------------------------------------------------------------------
#  Options d'écran comme RM2K(3) avec F4 et F5 (mini fenêtre avec F5 !!!)
#==============================================================================
 
#==============================================================================
# ** Input
#==============================================================================
 
module Input
  class << self
    alias_method :orms_input_update, :update
    def update
      orms_input_update
      Toggle_Screen.check_input
    end
  end
end
 
#==============================================================================
# ** Toggle Screen
#------------------------------------------------------------------------------
#  Le module module qui prend en charge le changement d'écran.
#==============================================================================
 
module Toggle_Screen
  #--------------------------------------------------------------------------
  # * Singleton
  #--------------------------------------------------------------------------
  class << self
    #--------------------------------------------------------------------------
    # * Public instance variables
    #--------------------------------------------------------------------------
    attr_reader :tiny_window
    #--------------------------------------------------------------------------
    # * Win32API methods
    #--------------------------------------------------------------------------
    SetWindowPos         = Win32API.new 'user32', 'SetWindowPos', 'iiiiiii', 'i'
    GetWindowRect        = Win32API.new 'user32', 'GetWindowRect', 'ip', 'i'
    GetClientRect        = Win32API.new 'user32', 'GetClientRect', 'ip', 'i'
    GetKeyState          = Win32API.new 'user32', 'GetKeyState', 'p', 'i'
    KeybdEvent           = Win32API.new 'user32.dll', 'keybd_event', 'iill', 'v'
    FindWindow           = Win32API.new'user32', 'FindWindow', 'pp', 'i'
    HWND                 = FindWindow.call 'RGSS Player', 0
    #--------------------------------------------------------------------------
    # * Obtention de la clé de code (:F5 => 0x74)
    #--------------------------------------------------------------------------
    def get_key_code(sym)
      return 0 unless sym.is_a?(Symbol)
      sym = sym.to_s.upcase
      sym.slice!(0)
      0x6F + sym.to_i
    end
    #--------------------------------------------------------------------------
    # * Intialise les raccourcis configurés
    #--------------------------------------------------------------------------
    def initialize_shortcuts
      return if @tf_sc
      @tf_sc ||= get_key_code(ORMS_CONFIG::TOGGLE_FULLSCREEN)
      @tw_sc ||= get_key_code(ORMS_CONFIG::TOGGLE_WINDOW_MODE)
      @ps_sc ||= get_key_code(ORMS_CONFIG::PIXELATION_SHORTCUT)
    end
    #--------------------------------------------------------------------------
    # * Vérifie le statut du clavier et change l'écran
    #--------------------------------------------------------------------------
    def check_input
      initialize_shortcuts
      # check_fullscreen_shortcut
      if ![0,1].include?(GetKeyState.call(@tf_sc)) && Orms.active?(:toggle_fullscreen)
        toggle_fullscreen unless @tf
        @tf = true
      else
        @tf = false
      end
      # check_window_mode_shortcut
      if ![0,1].include?(GetKeyState.call(@tw_sc)) && Orms.active?(:toggle_window_mode)
        toggle_size unless @tw || @fullscreen
        @tw = true
      else
        @tw = false
      end
      # check_pixelation_shortcut
      if ![0,1].include?(GetKeyState.call(@ps_sc)) && Orms.active?(:pixelation_shortcut)
        toggle_pixelation unless @ps
        @ps = true
      else
        @ps = false
      end
      # check_fps_display_shortcut
      if ![0,1].include?(GetKeyState.call(0x71)) && Module.const_defined?(:ORMS_FPS)
        ORMS_FPS.toggle_display unless @fp
        @fp = true
      else
        @fp = false
      end
    end
    #--------------------------------------------------------------------------
    # * Obtention de window rect
    #--------------------------------------------------------------------------
    def window_rect
      GetWindowRect.call(HWND, wr = [0, 0, 0, 0].pack('l4'))
      wr = wr.unpack('l4')
      Rect.new(wr[0], wr[1], wr[2] - wr[0], wr[3] - wr[1])
    end
    #--------------------------------------------------------------------------
    # * Obtention de la dimension de la fenêtre à l'exclusion du cadre
    #--------------------------------------------------------------------------
    def client_rect
      GetClientRect.call(HWND, cr = [0, 0, 0, 0].pack('l4'))
      cr = cr.unpack('l4')
      Rect.new(*cr)
    end
    #--------------------------------------------------------------------------
    # * Redimmensionne la fenêtre de jeu et son contenu
    #--------------------------------------------------------------------------
    def resize_window(w, h)
      wr = window_rect
      cr = client_rect
      w += wr.width  - cr.width
      h += wr.height - cr.height
      x = wr.x - (w - wr.width ) / 2
      y = wr.y - (h - wr.height) / 2
      SetWindowPos.call(HWND, 0, x, y, w, h, 0x0200)
    end
    #--------------------------------------------------------------------------
    # * Change la taille de la fenêtre de jeu
    #--------------------------------------------------------------------------
    def toggle_size
      w, h = Graphics.width, Graphics.height
      @tiny_window ? resize_window(w, h) : resize_window(w / 2, h / 2)
      @tiny_window = !@tiny_window
    end
    #--------------------------------------------------------------------------
    # * Change au plein écran
    #--------------------------------------------------------------------------
    def toggle_fullscreen
      KeybdEvent.call 0xA4, 0, 0, 0
      KeybdEvent.call 13, 0, 0, 0
      KeybdEvent.call 13, 0, 2, 0
      KeybdEvent.call 0xA4, 0, 2, 0
      @fullscreen = !@fullscreen
    end
    #--------------------------------------------------------------------------
    # * Change screen_pixelation selon ON/OFF
    #--------------------------------------------------------------------------
    def toggle_pixelation
      return unless Module.const_defined?(:ORMS_MESSAGE)
      if ORMS_CONFIG::PIXELATE_SCREEN
        ORMS_MESSAGE.display("pixelation OFF", 11)
        Orms.set(:pixelate_screen, false)
      else
        ORMS_MESSAGE.display("pixelation ON", 9)
        Orms.set(:pixelate_screen, true)
      end
    end
  end
end
 
#==============================================================================
# ** OLD_RESOLUTION (for the slackers)
#------------------------------------------------------------------------------
#  Met la résolution du jeu à 640*480
#==============================================================================
 
Graphics.resize_screen(640, 480) if ORMS_CONFIG::OLD_RESOLUTION
 
#==============================================================================
# ** DEACTIVATE_DASH
#------------------------------------------------------------------------------
#  Pas d'accélération quand on appuie sur Shift
#==============================================================================
 
if ORMS_CONFIG::DEACTIVATE_DASH
 
  #==============================================================================
  # ** Game_Player
  #==============================================================================
 
  class Game_Player
    #--------------------------------------------------------------------------
    # * Détermine si accélération
    #--------------------------------------------------------------------------
    alias_method :orms_dash?, :dash?
    def dash?
      !Orms.active?(:deactivate_dash) && orms_dash?
    end
  end
 
end
 
#==============================================================================
# ** Compatibilité avec Fullscreen++ (Zeus81)
#------------------------------------------------------------------------------
#  Obtenir Fullscreen++ :
# https://forums.rpgmakerweb.com/index.php?threads/fullscreen.14081/
#==============================================================================
 
if $imported && $imported[:Zeus_Fullscreen]
  begin
    class << Graphics
      alias_method :zeus_save_fullscreen_settings, :save_fullscreen_settings
      def save_fullscreen_settings
        @half = @windowed_ratio = 1 if @windowed_ratio == 0.5
        zeus_save_fullscreen_settings
        @windowed_ratio = 0.5 if @half == 1
        @half = 0
      end
      alias_method :zeus_set_ratio, :ratio=
      def ratio=(r)
        r = 0.5 if ratio == 0 unless fullscreen?
        r = 1 if r == 1.5
        zeus_set_ratio(r)
      end
      unless Module.const_defined?(:ORMS_MESSAGE)
        def update
          release_alt if Disable_VX_Fullscreen and Input.trigger?(Input::ALT)
          zeus_fullscreen_update
        end
      end
    end
    module Toggle_Screen
      def self.toggle_size
        Graphics.toggle_ratio
      end
      def self.toggle_fullscreen
        Graphics.toggle_fullscreen
      end
    end
  rescue
  end
end
 
#==============================================================================
# ** Compatibilité des effets d'écran avec RME (RMEx)
#------------------------------------------------------------------------------
#  Obtenir RME :
# https://github.com/RMEx/RME
#==============================================================================
 
if Module.const_defined?(:RME)
  if ORMS_CONFIG::PIXELATE_SCREEN
    module ScreenEffects
      class Screen
        def update
          return if disposed?
          update_transitions
          if !SceneManager.scene_is?(Scene_Map) || [@blur, @motion_blur, @pixelation, @zoom] == [0, 0, 1, 100]
            return self.visible = false
          end
        end
        def update_filters
          update_zoom_target
          update_capture_rect
          update_pixelation
          update_bitmap
        end
      end
    end
  end
  if ORMS_CONFIG::REWRITE_ALL_TEXTS
    module Gui
      module Components
        class Text_Field
          def create_sprite
            @sprite = Sprite.new
            @sprite.bitmap = Bitmap.new(1,1)
            @sprite.bitmap.font = @font
            @split_format = 640 / @sprite.bitmap.orms_text_size("W").width
          end
          def create_viewport
            @h = @sprite.bitmap.orms_text_size("W").height
            @viewport = Viewport.new(@x,@y,@w,@h)
            @sprite.viewport = @viewport
          end
          def update_bitmap
            text = value
            text = " " if text.empty?
            rect = @sprite.bitmap.orms_text_size(text)
            @sprite.bitmap.dispose
            @sprite.bitmap = Bitmap.new(rect.width, rect.height)
            @sprite.bitmap.font = @font
            last_x = 0
            text.split_each(@split_format).each do |a_text|
              rect = @sprite.bitmap.orms_text_size(a_text)
              rect.x = last_x
              @sprite.bitmap.orms_draw_text(rect, a_text)
              last_x += rect.width
            end
          end
          def update_cursor_pos
            @cursor_timer = 0
            pos = @text.virtual_position
            if pos == 0
              @cursor.x = 1
            else
              @cursor.x = @sprite.bitmap.orms_text_size(value[0...pos]).width
            end
          end
          def update_selection_rect
            pos = @text.selection_start
            if pos == 0
              @selection_rect.x = 1
            else
              @selection_rect.x = @sprite.bitmap.orms_text_size(value[0...pos]).width
            end
            delta = @cursor.x - @selection_rect.x
            @selection_rect.zoom_x = delta.abs
            @selection_rect.x += delta if delta < 0
          end
          def approach(a, x, memoa=a, memob=0)
            bound = a.bound(0,value.length)
            return bound if bound != a
            b = @sprite.bitmap.orms_text_size(value[0...a]).width
            return a if (b-x) == 0 || (b-x)==(x-memob)
            return memoa if (b-x).abs > (memob-x).abs
            approach(a + (0 <=> (b-x)), x, a, b)
          end
        end
      end
      class Label
        def initialize_text(txt)
          return unless @sprite_text
          txt ||= ""
          fon = @style[:font]
          bmp = Bitmap.new(1,1)
          bmp.font = fon
          size = bmp.orms_text_size(txt)
          @sprite_text.bitmap = Bitmap.new(size.width, size.height)
          @sprite_text.bitmap.font = fon
          @sprite_text.bitmap.orms_draw_text(size, txt)
          @style[:width]  = size.width
          @style[:height] = size.height
        end
      end
    end
  end
end




Ajouté le 28 novembre 2022.






Ephy - posté le 29/11/2022 à 20:33:17 (30082 messages postés) - honor

❤ 0

[BIG SHOT]

Testé et approuvé. Le moyen facile et idéal pour avoir le style RM200x et les systèmes + scripts de VXAce.
Il reste quand même quelques bricolages ici et là pour avoir du vrai pixel x2 partout mais le résultat est plus que convainquant.



Power Level: 1 148 355,38|Mystic Slayer (Value!+)|Le monde d'Adélaïde|Reikon no Yume|★ H-Project|Toho Danmaku Arena|Loli versus Ponies|Mes vidéos|Ma galerie|Débuter sur VX:10, 11|Tuto: Importation de ressources|Mapper avec les RTP VX|Touhou|Fan de Omenides|Fan de Estheone|Eph'ille: 14


Gari - posté le 30/11/2022 à 11:38:43 (5899 messages postés) - honor

❤ 0

C'est quoi les bricolages en question ?


Joke - posté le 02/12/2022 à 11:56:57 (5089 messages postés)

❤ 0

Bilouteux fou

Mettre pixelate_screen à true pour éviter tout décalage de pixel (par exemple pour les rotations et compagnie) mais c'est déjà un gros bricolage niveau script qui peut impacter la fluidité du jeu...

biloumaster.fr, mon joli site ouèb tout bô tout frai !

Suite à de nombreux abus, le post en invités a été désactivé. Veuillez vous inscrire si vous souhaitez participer à la conversation.

Haut de page

Merci de ne pas reproduire le contenu de ce site sans autorisation.
Contacter l'équipe - Mentions légales

Plan du site

Communauté: Accueil | Forum | Chat | Commentaires | News | Flash-news | Screen de la semaine | Sorties | Tests | Gaming-Live | Interviews | Galerie | OST | Blogs | Recherche
Apprendre: Visite guidée | RPG Maker 95 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker MV | Tutoriels | Guides | Making-of
Télécharger: Programmes | Scripts/Plugins | Ressources graphiques / sonores | Packs de ressources | Midis | Eléments séparés | Sprites
Jeux: Au hasard | Notre sélection | Sélection des membres | Tous les jeux | Jeux complets | Le cimetière | RPG Maker 95 | RPG Maker 2000 | RPG Maker 2003 | RPG Maker XP | RPG Maker VX | RPG Maker VX Ace | RPG Maker MV | Autres | Proposer
Ressources RPG Maker 2000/2003: Chipsets | Charsets | Panoramas | Backdrops | Facesets | Battle anims | Battle charsets | Monstres | Systems | Templates
Ressources RPG Maker XP: Tilesets | Autotiles | Characters | Battlers | Window skins | Icônes | Transitions | Fogs | Templates
Ressources RPG Maker VX: Tilesets | Charsets | Facesets | Systèmes
Ressources RPG Maker MV: Tilesets | Characters | Faces | Systèmes | Title | Battlebacks | Animations | SV/Ennemis
Archives: Palmarès | L'Annuaire | Livre d'or | Le Wiki | Divers