Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> Use iconsets in XP, Ever wanted to use VX iconsets in XP, now you can
Legacy
post Feb 18 2010, 11:12 PM
Post #1


B★RS Coding Ninja
Group Icon

Group: Global Mod
Posts: 1,414
Type: Scripter
RM Skill: Advanced
Rev Points: 15




VX iconsets in XP - by LegACy
Version 1.0


Description:
This little snippet allows you to use IconSets instead of single files for icons, just like VX. Easy to install and easy to use.

Compatibility:
no issues so far.

Screenshots:


Instructions:

Place above main, and above any custom scripts. So, place under Scene_Debug.

to use follow this syntax: draw_icon(file_name, icon_index, x, y)
- file_name : the file name for the iconset
- icon_index : Icon number
- x : draw spot x-coordinate
- y : draw spot y-coordinate

* All iconsets must be placed in the Pictures folder.

for the VX iconset, and the set used in the Example please use this:



Main Script:

CODE

#=======================================================
# ~** VX iconsets in XP **~
#=======================================================
# Author: LegACy (LegacyX)
# Version: 1.0
# Build Date: 2009-02-26
#-------------------------------------------------------------------------------
#
# This little snippet allows you to use VX iconsets in XP
#
#========================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Icon
# file_name : the file name for the iconset
# icon_index : Icon number
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# enabled : Enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_icon(file_name,icon_index, x, y, enabled = true)
bitmap = RPG::Cache.picture(file_name.to_s)
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.contents.blt(x, y, bitmap, rect, enabled ? 255 : 128)
end

end


Example Window using this script:

CODE

class Sample_Window < Window_Base
#----------------------------------------------------------------------
# * Object Initialization
#----------------------------------------------------------------------
def initialize
super(20, 20, 100, 100)
self.contents = Bitmap.new(width - 32, height - 32)
refresh # Calls the refresh function in this class
end

def refresh
self.contents.clear
# file name is " IconSet", icon is the 5th in the set.
self.draw_icon("IconSet", 5, 20, 30)
end

end


To test this, make a new event, then add a call event and paste this: Sample_Window.new



Any problems or questions please ask. ~LegACy

This post has been edited by LegACy: Feb 18 2010, 11:21 PM


__________________________
Freelance Programmer (C#, C++, Ruby)
#onegameamonth


Have you seen the new Unity3D sections?..
Unity 3D Discussion
Unity Script Development
Unity Projects
Go to the top of the page
 
+Quote Post
   



Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 10:07 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker