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

Sorties: Star Trek: Glorious Wolf / Jeux: Pillar Town / Sorties: Dread Mac Farlane - Complet / Sorties: "Dread Mac Farlane", (...) / Tutos: Checklist de la composition (...) / Chat

Bienvenue
visiteur !




publicité RPG Maker!

Statistiques

Liste des
membres


Contact

Mentions légales

422 connectés actuellement

29740840 visiteurs
depuis l'ouverture

8755 visiteurs
aujourd'hui



Barre de séparation

Partenaires

Indiexpo

Akademiya RPG Maker

Blog Alioune Fall

Fairy Tail Constellations

Zarok

New RPG Maker

Le Comptoir Du clickeur

Alex d'Or

Planète Glutko

Tous nos partenaires

Devenir
partenaire



RS_Screenshot simplifié

Permet de prendre une capture d'écran lorsque vous jouez ou testez votre jeu.

Script pour RPG Maker MV
Ecrit par biud436, neo29 (edit) (site de l'auteur)
Publié par neo29 (lui envoyer un message privé)
Signaler un script cassé

❤ 1

Auteur : biud436
Support : RPG Maker MV
Nombre de scripts : 1
Source du plugin original : https://github.com/biud436/MV


Fonctionnalité
Permet de prendre un screenshot de votre jeu en cours de jeu avec la touche Impr. écran.
Il s'agit du script RS_ScreenShot.js de biud436 dans une version simplifiée.

Conditions d'utilisation
Ce plugin est sous licence MIT :
- Créditer l'auteur n'est pas obligatoire
- Vous pouvez modifier le plugin
- Vous pouvez publier la version originale ou modifiée
- Vous pouvez l'utiliser pour un projet commercial
- Vous devez garder la notice de licence et copyright dans toutes les copies (en l'occurence le bordereau d'origine et le texte en citation, dans un fichier texte)

Citation:

MIT License

Copyright (c) 2015-2019 Eo Jinseok

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



Plugin simplifié

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
/*:
//================================================================
// RS_ScreenShot.js
// ---------------------------------------------------------------
// The MIT License
// Copyright (c) 2015 biud436
// ---------------------------------------------------------------
// Free for commercial and non commercial use.
//================================================================
 * Neo_Screenshot.js
 * @plugindesc Press the Key \"PrintScreen\" for take a screenshot.
 * 2023.03.03
 * @author ShadowNeo29
 * @help
 * Modified plugin from RS_ScreenShot.js (biud436)
 */
 
var Imported = Imported || {};
Imported.RS_ScreenShot = true;
 
var RS = RS || {};
RS.ScreenShot = RS.ScreenShot || {};
 
(function($) {
 
  \"use strict\";
 
  var parameters = $plugins.filter(function(i) {
    return i.description.contains(\"<RS_ScreenShot>\");
  });
 
  parameters = (parameters.length > 0) && parameters[0].parameters;
 
 
  $.isPlaySe = \'true\';
  $.seName = \'Save\';
  $.fileFormat =  \"png\";
 
  $.localFilePath = function (fileName) {
    if(!Utils.isNwjs()) return \'\';
    var path, base;
    path = require(\'path\');
    base = path.dirname(process.mainModule.filename);
    return path.join(base, \'ScreenShots/\');
  };
 
  $.getPath = function () {
    if(Utils.RPGMAKER_VERSION >= \'1.6.0\') return $.localFilePath();
    var path = window.location.pathname.replace(/(\\/www|)\\/[^\\/]*$/, \'/ScreenShots/\');
    if (path.match(/^\\/([A-Z]\\:)/)) {
      path = path.slice(1);
    }
    return decodeURIComponent(path);
  };
 
 
 
  $.takeSnapshot = function() {
 
    if(!StorageManager.isLocalMode()) {
      console.warn(\'takeSnapshot function does not support on your mobile device\');
      return;
    }
 
    const fs = require(\'fs\');
    const {promisify} = require(\'util\');
    const screenshotFolder = this.getPath();
 
    let gui = require(\'nw.gui\');
    let win = gui.Window.get();
 
    if( !fs.existsSync(screenshotFolder) ) fs.mkdirSync(screenshotFolder);
    let fileName = new Date().toJSON().replace(/[.:]+/g, \"-\");
    let filePath = screenshotFolder + `${fileName}.${$.fileFormat}`;
 
    let result = win.capturePage(buffer => {
      promisify(fs.writeFile)(filePath, buffer).then(val => {
        if($.isPlaySe) AudioManager.playStaticSe({name: $.seName, pan: 0, pitch: 100, volume: ConfigManager.seVolume});
        if($.isPreviewWindow) $.previewScreenShot(fileName);
      }).catch(err => {
        throw new Error(err);
      });
 
    }, { format : $.fileFormat, datatype : \'buffer\'} );
 
  };
 
 
 
document.addEventListener(\"keyup\", function(event) {
  if (event.key === \"PrintScreen\") {
    $.takeSnapshot();
  }
});
 
 
 
})(RS.ScreenShot);



Plugin original

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
//================================================================
// RS_ScreenShot.js
// ---------------------------------------------------------------
// The MIT License
// Copyright (c) 2015 biud436
// ---------------------------------------------------------------
// Free for commercial and non commercial use.
//================================================================
/*:
 * RS_ScreenShot.js
 * @plugindesc <RS_ScreenShot>
 *
 * @author biud436
 * @date 2015.12.22
 *
 * @param key
 * @type number
 * @desc Please set the virtual key code value.
 * Default button sets to F7 (118)
 * @default 118
 *
 * @param Screenshot Preview Window
 * @type boolean
 * @desc To activate the preview window, change to true.
 * @default true
 * 
 * @param In-Game Preview Window
 * @type boolean
 * @desc To activate the in-game preview, change to true.
 * @default false
 *
 * @param Play Se
 * @type boolean
 * @desc Change to true to play sound when taking screenshots.
 * @default true
 *
 * @param Se Name
 * @desc Specify a sound file from audio/se folder.
 * @default Save
 * @require 1
 * @dir audio/se/
 * @type file
 *
 * @param file format
 * @text File Format
 * @type select
 * @desc Select desired file format in the game screenshot.
 * @default png
 * @option png
 * @value png
 * @option jpeg
 * @value jpeg
 *
 * @reference http://stackoverflow.com/questions/32613060/how-to-take-screenshot-with-node-webkit
 *
 * @help
 * - Key Code Link
 * https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
 *
 * - Change Log
 * 2015.12.22 (v1.0.0) - First Release.
 * 2016.03.20 (v1.0.1) - Added parameter called key.
 * 2016.08.13 (v1.0.2) - Added previewWindow.
 * 2016.11.27 (v1.0.3) - Added the code that can delete the texture from the memory.
 * 2016.11.27 (v1.0.4) : Fixed preview window in the html format instead of an image.
 * - Displays the name of the screen shot file in the preview window.
 * - Plays the sound when you are taking a screenshot.
 * 2016.12.08 (v1.0.42) - Added code to remove references to URL objects.
 * 2018.02.27 (v1.0.5) :
 * - Fixed the getPath function issue in RMMV 1.6.0.
 * - Changed the source code for RMMV 1.6.0.
 * 2018.04.25 (v1.0.6) - Added a feature that allows you to select the file format in the screenshot.
 * 2019.03.13 (v1.0.7) :
 * - Fixed the issue that is not showing the image to preview window in the RMMV 1.6.2
 * 2020.07.07 (v1.0.8) :
 * - Added in-game screenshot preview window.
 */
 
var Imported = Imported || {};
Imported.RS_ScreenShot = true;
 
var RS = RS || {};
RS.ScreenShot = RS.ScreenShot || {};
 
(function($) {
 
  "use strict";
 
  var parameters = $plugins.filter(function(i) {
    return i.description.contains("<RS_ScreenShot>");
  });
 
  parameters = (parameters.length > 0) && parameters[0].parameters;
 
  $.KEY = Number(parameters['key'] || 118 );
  $.isPreviewWindow = Boolean(parameters['Screenshot Preview Window'] === 'true');
  $.isPlaySe = Boolean(parameters['Play Se'] === 'true');
  $.seName = parameters['Se Name'] || 'Save';
  $.fileFormat = parameters["file format"] || "png";
  $.isInGamePreview = true;
 
  $.localFilePath = function (fileName) {
    if(!Utils.isNwjs()) return '';
    var path, base;
    path = require('path');
    base = path.dirname(process.mainModule.filename);
    return path.join(base, 'ScreenShots/');
  };
 
  $.getPath = function () {
    if(Utils.RPGMAKER_VERSION >= '1.6.0') return $.localFilePath();
    var path = window.location.pathname.replace(/(\/www|)\/[^\/]*$/, '/ScreenShots/');
    if (path.match(/^\/([A-Z]\:)/)) {
      path = path.slice(1);
    }
    return decodeURIComponent(path);
  };
 
  $.previewScreenShot = function (fileName) {
    const renderer = Graphics._renderer;
    const renderTexture = PIXI.RenderTexture.create(renderer.width, renderer.height);
    const stage = SceneManager._scene;
 
    if(stage) {
      renderer.render(stage, renderTexture);
      let canvas = renderer.extract.base64(renderTexture);
 
      if($.isInGamePreview) {
        stage.emit("screenshot_hookat", canvas, fileName);
      } else {
        let html = `
        <!DOCTYPE html>
        <html>
          <head>
            <meta charset="utf-8">
            <style>
            .preview {
                position: absolute;
                background-color: #888888;
                font-size: 18px;
                color: white;
                text-align: center;
                width: 256px;
                height: 19px;
                opacity: 0.7;
                word-wrap: break-word;
              }
            </style>
            <title>ScreenShots Preview</title>
          </head>
          <div class="preview">${fileName}.${$.fileFormat}</div>
          <body>
            <img src=\'${canvas}\'>
          </body>
          </html>
        `;
  
        const blob = new Blob([html], {type : 'text/html'});
        let url = URL.createObjectURL(blob);
        let win = window.open(url, '_blank');
        
        if(Utils.RPGMAKER_VERSION >= "1.6.0") {
          url = canvas.toDataURL(`image/${$.fileFormat}`);
          win = window.open(url, '_blank');
        }
      }
 
    }
 
    if(renderTexture) {
      renderTexture.destroy( { destroyBase: true } );
    }
 
    if(!$.isInGamePreview) {
      // Call this method when it doesn't need to keep the reference to URL object any longer.
      URL.revokeObjectURL(url);
    }
 
  };
 
  $.takeSnapshot = function() {
 
    if(!StorageManager.isLocalMode()) {
      console.warn('takeSnapshot function does not support on your mobile device');
      return;
    }
 
    const fs = require('fs');
    const {promisify} = require('util');
    const screenshotFolder = this.getPath();
 
    let gui = require('nw.gui');
    let win = gui.Window.get();
 
    if( !fs.existsSync(screenshotFolder) ) fs.mkdirSync(screenshotFolder);
    let fileName = new Date().toJSON().replace(/[.:]+/g, "-");
    let filePath = screenshotFolder + `${fileName}.${$.fileFormat}`;
 
    let result = win.capturePage(buffer => {
      promisify(fs.writeFile)(filePath, buffer).then(val => {
        if($.isPlaySe) AudioManager.playStaticSe({name: $.seName, pan: 0, pitch: 100, volume: ConfigManager.seVolume});
        if($.isPreviewWindow) $.previewScreenShot(fileName);
      }).catch(err => {
        throw new Error(err);
      });
 
    }, { format : $.fileFormat, datatype : 'buffer'} );
 
  };
 
  const alias_SceneManager_onKeyDown = SceneManager.onKeyDown;
  SceneManager.onKeyDown = function(event) {
      alias_SceneManager_onKeyDown.call(this, event);
      if (!event.ctrlKey && !event.altKey) {
        switch (event.keyCode) {
        case $.KEY:   // F7
          $.takeSnapshot();
        break;
        }
      }
  };
 
  /**
   * This class allows you to hook a new screenshot in the game.
   */
  class Window_ScreenshotHooker extends Window_Base {
 
    constructor() {
      super(0, 0, Graphics.boxWidth, Graphics.boxHeight);
      this._isWindow = false;
      this.opacity = 0;
 
      this.setVisible(false);
    }
 
    setVisible(value) {
      this.children.forEach(e => {
        if(e.constructor.name.contains("_window")) {
          e.visible = value;
        }
      });   
    }
 
    on(canvas, filename) {
      this.setVisible(true);
 
      this._screenshot = PIXI.Sprite.from(canvas);
 
      const style = {
        "dropShadow": true,
        "dropShadowAlpha": 0.4,
        "dropShadowDistance": 1,
        "stroke": "white",
        "strokeThickness": 2
      };
 
      this._text = new PIXI.Text(`${filename}.${$.fileFormat}`, style);
 
      this._screenshot.addChild(this._text);
 
      this.addChildAt(this._screenshot, 1);
      this._updateContents();
 
      this.visible = true;
    }
 
    off() {
      this.setVisible(false);
 
      if(this._screenshot) {
        this._windowContentsSprite.removeChild(this._screenshot);
      }
 
      this.visible = false;
 
    }
 
    update() {
      super.update();
 
      if(Input.isTriggered("ok") || Input.isTriggered("escape")) {
        if(this.visible) {
          this.off();
        }
      }
 
    }
 
  }
 
  var alias_Scene_Map_start = Scene_Map.prototype.start;
  Scene_Map.prototype.start = function() {
    alias_Scene_Map_start.call(this);
    if($.isInGamePreview) {    
      this._screenshotHooker = new Window_ScreenshotHooker();
      this.addChild(this._screenshotHooker);
 
      this.on("screenshot_hookat", this.screenshotHookAt, this);
    }
  };
 
  var alias_Scene_Map_terminate = Scene_Map.prototype.terminate;
  Scene_Map.prototype.terminate = function() {
    alias_Scene_Map_terminate.call(this);
    if($.isInGamePreview) {  
      this.off("screenshot_hookat", this.screenshotHookAt, this);
    }
  };
 
  Scene_Map.prototype.screenshotHookAt = function(canvas, fileName) {
    if(!this._screenshotHooker) return;
    this._screenshotHooker.on(canvas, fileName);
  };
 
})(RS.ScreenShot);





Aucun commentaire n'a été posté pour le moment.

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