Help Scripting Menus, Window_Base.update, lag & fps loss issues

Discussion in 'Javascript/Plugin Support' started by SrOscuro, Apr 20, 2018.

  1. SrOscuro

    SrOscuro oO Member

    Likes Received:
    First Language:
    Primarily Uses:
    Hi, I'am trying to implement my own custom menus and now scripting some windows. After looking at some examples and tutorials what i do is create a Game_Window instance, and play with .update() to refresh my window.

    My_Window.prototype.update = function() {
          this.drawText('test', 200,200,200);
    I noticed that this recreates all the conents inside the window, but some tutorials suggests to do that.
    Additionally, because i need to put some decorative images, used this funcion to draw images inside the window:

    Window_Base.prototype.drawPicture = function(pictureName, x, y) {
                    var bitmap = ImageManager.loadPicture(pictureName);
                    var pw = bitmap.width;
                    var ph = bitmap.height;
                    var sx = 0;
                    var sy = 0;
                    this.contents.blt(bitmap, sx, sy, pw, ph, x, y);

    That works, but after some time with the menu open, the game starts to slow down, soon becomes irresponsive, and FPS
    drops to 10.. 5... 1... freezed.

    I dont know where exactly is the problem, maybe the drawPicture its not well implemented, or maybe drawing the full window every time its not the whay to go. In case the problem is the last one, how i can update parts of the window without calling contents.clear()+redraw every time?

    I dont want to redraw the window only when some key is pressed because there are some decorative moving images on the menu.

    Any help will be apreciated.

Share This Page