├── .gitignore ├── src ├── scripts │ ├── _footer.js │ ├── _header.js │ ├── rpgui-content.js │ ├── init.js │ ├── rpgui-radio.js │ ├── rpgui-checkbox.js │ ├── rpgui-draggable.js │ ├── global_methods.js │ ├── rpgui-progress-bar.js │ ├── rpgui-select-list.js │ ├── utils.js │ ├── rpgui-select-dropdown.js │ └── rpgui-slider.js ├── styles │ ├── _imports.scss │ ├── _hr.scss │ ├── app.scss │ ├── _disabled.scss │ ├── _scrollbars.scss │ ├── _radio.scss │ ├── _checkbox.scss │ ├── _misc.scss │ ├── _input.scss │ ├── _content.scss │ ├── _icon.scss │ ├── _progress_bar.scss │ ├── _list.scss │ ├── _cursor.scss │ ├── _dropdown.scss │ ├── _slider.scss │ ├── _paragraphs_and_headers.scss │ ├── _containers_and_frames.scss │ └── _button.scss └── includes.json ├── dist ├── img │ ├── hr.png │ ├── button.png │ ├── progress.png │ ├── radio-on.png │ ├── hr-golden.png │ ├── radio-off.png │ ├── border-image.png │ ├── button-down.png │ ├── button-golden.png │ ├── button-hover.png │ ├── checkbox-off.png │ ├── checkbox-on.png │ ├── cursor │ │ ├── cursor.cur │ │ ├── point.png │ │ ├── select.png │ │ ├── default.png │ │ ├── grab-close.png │ │ └── grab-open.png │ ├── icons │ │ ├── shield.png │ │ ├── sword.png │ │ ├── ring-slot.png │ │ ├── armor-slot.png │ │ ├── empty-slot.png │ │ ├── exclamation.png │ │ ├── helmet-slot.png │ │ ├── magic-slot.png │ │ ├── potion-blue.png │ │ ├── potion-green.png │ │ ├── potion-red.png │ │ ├── potion-slot.png │ │ ├── shield-slot.png │ │ ├── shoes-slot.png │ │ └── weapon-slot.png │ ├── progress-blue.png │ ├── progress-red.png │ ├── slider-left.png │ ├── slider-right.png │ ├── slider-thumb.png │ ├── slider-track.png │ ├── progress-green.png │ ├── radio-golden-on.png │ ├── scrollbar-thumb.png │ ├── scrollbar-track.png │ ├── background-image.png │ ├── border-image-grey.png │ ├── button-background.png │ ├── button-golden-down.png │ ├── button-golden-left.png │ ├── checkbox-golden-on.png │ ├── progress-bar-left.png │ ├── progress-bar-right.png │ ├── progress-bar-track.png │ ├── radio-golden-off.png │ ├── scrollbar-button.png │ ├── slider-left-golden.png │ ├── border-image-golden.png │ ├── border-image-golden2.png │ ├── button-golden-hover.png │ ├── button-golden-right.png │ ├── checkbox-golden-off.png │ ├── select-border-image.png │ ├── slider-right-golden.png │ ├── slider-thumb-golden.png │ ├── slider-track-golden.png │ ├── background-image-golden.png │ ├── background-image-grey.png │ ├── select-background-image.png │ └── background-image-golden2.png ├── package.json ├── LICENSE.txt ├── README.md ├── test.html └── rpgui.min.js ├── screenshot.jpg ├── for_readme ├── hr.jpg ├── bars.jpg ├── frames.jpg ├── icons.jpg ├── input.jpg ├── list.jpg ├── radio.jpg ├── buttons.jpg ├── checkbox.jpg ├── dropdown.jpg ├── sliders.jpg └── paragraph.jpg ├── We_stand_with_Israel.jpg ├── _graphic_sources ├── credits.txt ├── ui_sheet.png ├── ui_split.png └── ui_gold_sheet.png ├── bower.json ├── package.json ├── LICENSE.txt ├── examples ├── input.html ├── paragraphs.html ├── cursors.html ├── icons.html ├── buttons.html ├── containers.html ├── checkbox_and_radio.html ├── dropdown_and_list.html ├── sliders_and_bars.html ├── disabled_stuff.html └── everything.html ├── gulpfile.js └── old_versions ├── 1.02 ├── rpgui.min.js └── rpgui.min.css ├── 1.03 └── rpgui.min.js ├── 1.01 ├── rpgui.min.js └── rpgui.min.css └── 1.0 ├── rpgui.min.js └── rpgui.min.css /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | node_modules/ 3 | -------------------------------------------------------------------------------- /src/scripts/_footer.js: -------------------------------------------------------------------------------- 1 | return RPGUI;})(); -------------------------------------------------------------------------------- /src/scripts/_header.js: -------------------------------------------------------------------------------- 1 | RPGUI = (function() { 2 | -------------------------------------------------------------------------------- /dist/img/hr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/hr.png -------------------------------------------------------------------------------- /screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/screenshot.jpg -------------------------------------------------------------------------------- /for_readme/hr.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/for_readme/hr.jpg -------------------------------------------------------------------------------- /dist/img/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/button.png -------------------------------------------------------------------------------- /dist/img/progress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/progress.png -------------------------------------------------------------------------------- /dist/img/radio-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/radio-on.png -------------------------------------------------------------------------------- /for_readme/bars.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/for_readme/bars.jpg -------------------------------------------------------------------------------- /for_readme/frames.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/for_readme/frames.jpg -------------------------------------------------------------------------------- /for_readme/icons.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/for_readme/icons.jpg -------------------------------------------------------------------------------- /for_readme/input.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/for_readme/input.jpg -------------------------------------------------------------------------------- /for_readme/list.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/for_readme/list.jpg -------------------------------------------------------------------------------- /for_readme/radio.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/for_readme/radio.jpg -------------------------------------------------------------------------------- /dist/img/hr-golden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/hr-golden.png -------------------------------------------------------------------------------- /dist/img/radio-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/radio-off.png -------------------------------------------------------------------------------- /for_readme/buttons.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/for_readme/buttons.jpg -------------------------------------------------------------------------------- /for_readme/checkbox.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/for_readme/checkbox.jpg -------------------------------------------------------------------------------- /for_readme/dropdown.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/for_readme/dropdown.jpg -------------------------------------------------------------------------------- /for_readme/sliders.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/for_readme/sliders.jpg -------------------------------------------------------------------------------- /We_stand_with_Israel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/We_stand_with_Israel.jpg -------------------------------------------------------------------------------- /dist/img/border-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/border-image.png -------------------------------------------------------------------------------- /dist/img/button-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/button-down.png -------------------------------------------------------------------------------- /dist/img/button-golden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/button-golden.png -------------------------------------------------------------------------------- /dist/img/button-hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/button-hover.png -------------------------------------------------------------------------------- /dist/img/checkbox-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/checkbox-off.png -------------------------------------------------------------------------------- /dist/img/checkbox-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/checkbox-on.png -------------------------------------------------------------------------------- /dist/img/cursor/cursor.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/cursor/cursor.cur -------------------------------------------------------------------------------- /dist/img/cursor/point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/cursor/point.png -------------------------------------------------------------------------------- /dist/img/cursor/select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/cursor/select.png -------------------------------------------------------------------------------- /dist/img/icons/shield.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/shield.png -------------------------------------------------------------------------------- /dist/img/icons/sword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/sword.png -------------------------------------------------------------------------------- /dist/img/progress-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/progress-blue.png -------------------------------------------------------------------------------- /dist/img/progress-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/progress-red.png -------------------------------------------------------------------------------- /dist/img/slider-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/slider-left.png -------------------------------------------------------------------------------- /dist/img/slider-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/slider-right.png -------------------------------------------------------------------------------- /dist/img/slider-thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/slider-thumb.png -------------------------------------------------------------------------------- /dist/img/slider-track.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/slider-track.png -------------------------------------------------------------------------------- /for_readme/paragraph.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/for_readme/paragraph.jpg -------------------------------------------------------------------------------- /dist/img/cursor/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/cursor/default.png -------------------------------------------------------------------------------- /dist/img/icons/ring-slot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/ring-slot.png -------------------------------------------------------------------------------- /dist/img/progress-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/progress-green.png -------------------------------------------------------------------------------- /dist/img/radio-golden-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/radio-golden-on.png -------------------------------------------------------------------------------- /dist/img/scrollbar-thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/scrollbar-thumb.png -------------------------------------------------------------------------------- /dist/img/scrollbar-track.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/scrollbar-track.png -------------------------------------------------------------------------------- /_graphic_sources/credits.txt: -------------------------------------------------------------------------------- 1 | http://opengameart.org/content/golden-ui 2 | http://opengameart.org/content/cursor -------------------------------------------------------------------------------- /_graphic_sources/ui_sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/_graphic_sources/ui_sheet.png -------------------------------------------------------------------------------- /_graphic_sources/ui_split.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/_graphic_sources/ui_split.png -------------------------------------------------------------------------------- /dist/img/background-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/background-image.png -------------------------------------------------------------------------------- /dist/img/border-image-grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/border-image-grey.png -------------------------------------------------------------------------------- /dist/img/button-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/button-background.png -------------------------------------------------------------------------------- /dist/img/button-golden-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/button-golden-down.png -------------------------------------------------------------------------------- /dist/img/button-golden-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/button-golden-left.png -------------------------------------------------------------------------------- /dist/img/checkbox-golden-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/checkbox-golden-on.png -------------------------------------------------------------------------------- /dist/img/cursor/grab-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/cursor/grab-close.png -------------------------------------------------------------------------------- /dist/img/cursor/grab-open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/cursor/grab-open.png -------------------------------------------------------------------------------- /dist/img/icons/armor-slot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/armor-slot.png -------------------------------------------------------------------------------- /dist/img/icons/empty-slot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/empty-slot.png -------------------------------------------------------------------------------- /dist/img/icons/exclamation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/exclamation.png -------------------------------------------------------------------------------- /dist/img/icons/helmet-slot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/helmet-slot.png -------------------------------------------------------------------------------- /dist/img/icons/magic-slot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/magic-slot.png -------------------------------------------------------------------------------- /dist/img/icons/potion-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/potion-blue.png -------------------------------------------------------------------------------- /dist/img/icons/potion-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/potion-green.png -------------------------------------------------------------------------------- /dist/img/icons/potion-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/potion-red.png -------------------------------------------------------------------------------- /dist/img/icons/potion-slot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/potion-slot.png -------------------------------------------------------------------------------- /dist/img/icons/shield-slot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/shield-slot.png -------------------------------------------------------------------------------- /dist/img/icons/shoes-slot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/shoes-slot.png -------------------------------------------------------------------------------- /dist/img/icons/weapon-slot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/icons/weapon-slot.png -------------------------------------------------------------------------------- /dist/img/progress-bar-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/progress-bar-left.png -------------------------------------------------------------------------------- /dist/img/progress-bar-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/progress-bar-right.png -------------------------------------------------------------------------------- /dist/img/progress-bar-track.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/progress-bar-track.png -------------------------------------------------------------------------------- /dist/img/radio-golden-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/radio-golden-off.png -------------------------------------------------------------------------------- /dist/img/scrollbar-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/scrollbar-button.png -------------------------------------------------------------------------------- /dist/img/slider-left-golden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/slider-left-golden.png -------------------------------------------------------------------------------- /dist/img/border-image-golden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/border-image-golden.png -------------------------------------------------------------------------------- /dist/img/border-image-golden2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/border-image-golden2.png -------------------------------------------------------------------------------- /dist/img/button-golden-hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/button-golden-hover.png -------------------------------------------------------------------------------- /dist/img/button-golden-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/button-golden-right.png -------------------------------------------------------------------------------- /dist/img/checkbox-golden-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/checkbox-golden-off.png -------------------------------------------------------------------------------- /dist/img/select-border-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/select-border-image.png -------------------------------------------------------------------------------- /dist/img/slider-right-golden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/slider-right-golden.png -------------------------------------------------------------------------------- /dist/img/slider-thumb-golden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/slider-thumb-golden.png -------------------------------------------------------------------------------- /dist/img/slider-track-golden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/slider-track-golden.png -------------------------------------------------------------------------------- /_graphic_sources/ui_gold_sheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/_graphic_sources/ui_gold_sheet.png -------------------------------------------------------------------------------- /dist/img/background-image-golden.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/background-image-golden.png -------------------------------------------------------------------------------- /dist/img/background-image-grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/background-image-grey.png -------------------------------------------------------------------------------- /dist/img/select-background-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/select-background-image.png -------------------------------------------------------------------------------- /dist/img/background-image-golden2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RonenNess/RPGUI/HEAD/dist/img/background-image-golden2.png -------------------------------------------------------------------------------- /src/styles/_imports.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Import the font stylesheet. 3 | If not supported you can add backup via: 4 | 5 | inside your html file. 6 | */ 7 | 8 | @import url("https://fonts.googleapis.com/css?family=Press+Start+2P"); -------------------------------------------------------------------------------- /src/styles/_hr.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * hr styling 3 | */ 4 | 5 | /* rpgui hr */ 6 | .rpgui-content hr { 7 | display:block; 8 | border:0px; 9 | height:10px; 10 | background: url("img/hr.png") repeat-x top left; 11 | } 12 | 13 | /* rpgui golden hr */ 14 | .rpgui-content hr.golden { 15 | display:block; 16 | border:0px; 17 | height:10px; 18 | background: url("img/hr-golden.png") no-repeat top left; 19 | background-size: 100% 100%; 20 | } 21 | -------------------------------------------------------------------------------- /src/styles/app.scss: -------------------------------------------------------------------------------- 1 | @import '_imports'; 2 | @import '_misc'; 3 | 4 | @import '_button'; 5 | @import '_checkbox'; 6 | @import '_content'; 7 | @import '_containers_and_frames'; 8 | @import '_cursor'; 9 | @import '_dropdown'; 10 | @import '_hr'; 11 | @import '_icon'; 12 | @import '_input'; 13 | @import '_list'; 14 | @import '_paragraphs_and_headers'; 15 | @import '_progress_bar'; 16 | @import '_radio'; 17 | @import '_scrollbars'; 18 | @import '_disabled'; 19 | @import '_slider'; 20 | -------------------------------------------------------------------------------- /src/includes.json: -------------------------------------------------------------------------------- 1 | [ 2 | "src/scripts/_header.js", 3 | "src/scripts/init.js", 4 | "src/scripts/global_methods.js", 5 | "src/scripts/rpgui-checkbox.js", 6 | "src/scripts/rpgui-content.js", 7 | "src/scripts/rpgui-draggable.js", 8 | "src/scripts/rpgui-progress-bar.js", 9 | "src/scripts/rpgui-radio.js", 10 | "src/scripts/rpgui-select-dropdown.js", 11 | "src/scripts/rpgui-select-list.js", 12 | "src/scripts/rpgui-slider.js", 13 | "src/scripts/utils.js", 14 | "src/scripts/_footer.js" 15 | ] 16 | -------------------------------------------------------------------------------- /src/scripts/rpgui-content.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Init rpgui content and what's inside. 3 | */ 4 | 5 | // init all the rpgui containers and their children 6 | RPGUI.on_load(function() 7 | { 8 | // get all containers and iterate them 9 | var contents = document.getElementsByClassName("rpgui-content"); 10 | for (var i = 0; i < contents.length; ++i) 11 | { 12 | // get current container and init it 13 | var content = contents[i]; 14 | 15 | // prevent dragging 16 | RPGUI.prevent_drag(content); 17 | 18 | // set default cursor 19 | RPGUI.set_cursor(content, "default"); 20 | } 21 | }); 22 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RPGUI", 3 | "version": "1.0.3", 4 | "homepage": "https://github.com/RonenNess/RPGUI", 5 | "authors": [ 6 | "Ronen Ness " 7 | ], 8 | "description": "Lightweight framework for old-school RPG GUI in web!", 9 | "moduleType": [ 10 | "globals" 11 | ], 12 | "keywords": [ 13 | "gui", 14 | "rpg", 15 | "game", 16 | "interface", 17 | "ui" 18 | ], 19 | "license": "Zlib", 20 | "ignore": [ 21 | "**/.*", 22 | "node_modules", 23 | "bower_components", 24 | "test", 25 | "tests" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RPGUI", 3 | "version": "1.0.3", 4 | "description": "Lightweight framework for old-school RPG GUI in web!", 5 | "main": "", 6 | "dependencies": { 7 | }, 8 | "devDependencies": { 9 | "gulp": "^3.9.0", 10 | "gulp-minify-css": "^1.2.2", 11 | "gulp-sass": "^2.1.1", 12 | "gulp-concat": "^2.6.0", 13 | "gulp-imagemin": "^2.4.0", 14 | "del": "^2.2.0", 15 | "gulp-notify": "^2.2.0", 16 | "gulp-uglify": "^1.5.1" 17 | }, 18 | "scripts": { 19 | "test": "echo \"Error: no test specified\" && exit 1" 20 | }, 21 | "author": "Ronen Ness", 22 | "license": "Zlib", 23 | "homepage": "http://ronenness.github.io/RPGUI/" 24 | } 25 | -------------------------------------------------------------------------------- /dist/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rpgui", 3 | "version": "1.0.3", 4 | "description": "Lightweight framework for old-school RPG GUI in web!", 5 | "main": "", 6 | "dependencies": { 7 | }, 8 | "repository": { 9 | "type": "git", 10 | "url": "git+https://github.com/RonenNess/RPGUI.git" 11 | }, 12 | "scripts": { 13 | "test": "echo \"Error: no test specified\" && exit 1" 14 | }, 15 | "keywords": [ 16 | "gui", 17 | "rpg", 18 | "game", 19 | "interface", 20 | "ui" 21 | ], 22 | "bugs": { 23 | "url": "https://github.com/RonenNess/RPGUI/issues" 24 | }, 25 | "author": "Ronen Ness", 26 | "license": "Zlib", 27 | "homepage": "http://ronenness.github.io/RPGUI/" 28 | } 29 | -------------------------------------------------------------------------------- /src/styles/_disabled.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * for disabled elements 3 | */ 4 | 5 | /* disabled object */ 6 | .rpgui-disabled, 7 | .rpgui-content :disabled, 8 | .rpgui-content input[type=radio]:disabled + label, 9 | .rpgui-content input[type=checkbox]:disabled + label, 10 | .rpgui-content input[type=range]:disabled + .rpgui-slider-container, 11 | .rpgui-content :disabled + .rpgui-dropdown-imp, 12 | .rpgui-content :disabled + .rpgui-dropdown-imp + .rpgui-dropdown-imp, 13 | .rpgui-content :disabled + .rpgui-list-imp 14 | { 15 | cursor: url("img/cursor/default.png"), auto; 16 | -webkit-filter: grayscale(1); 17 | -webkit-filter: grayscale(100%); 18 | filter: grayscale(100%); 19 | filter: url(#greyscale); 20 | filter: url("data:image/svg+xml;utf8,#grayscale"); 21 | filter: gray; 22 | color: #999; 23 | } -------------------------------------------------------------------------------- /src/styles/_scrollbars.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Rules for misc and general things. 3 | */ 4 | 5 | /* set scrollbars for webkit browsers (like chrome) */ 6 | .rpgui-content ::-webkit-scrollbar, 7 | .rpgui-content::-webkit-scrollbar 8 | { 9 | width: 18px; 10 | } 11 | 12 | /* Track */ 13 | .rpgui-content ::-webkit-scrollbar-track, 14 | .rpgui-content::-webkit-scrollbar-track 15 | { 16 | background-image:url('img/scrollbar-track.png'); 17 | background-size: 18px 60px; 18 | background-repeat: repeat-y; 19 | } 20 | 21 | /* Handle */ 22 | .rpgui-content ::-webkit-scrollbar-thumb, 23 | .rpgui-content::-webkit-scrollbar-thumb 24 | { 25 | background-image:url('img/scrollbar-thumb.png'); 26 | background-size: 100% 100%; 27 | background-repeat: no-repeat; 28 | } 29 | 30 | /* buttons */ 31 | .rpgui-content ::-webkit-scrollbar-button, 32 | .rpgui-content::-webkit-scrollbar-button 33 | { 34 | background-image:url('img/scrollbar-button.png'); 35 | background-size: 100% 100%; 36 | background-repeat: no-repeat; 37 | } 38 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | RPGUI (RPG gui for web games) is distributed with the zlib-license: 2 | 3 | /* 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would be 15 | appreciated but is not required. 16 | 2. Altered source versions must be plainly marked as such, and must not be 17 | misrepresented as being the original software. 18 | 3. This notice may not be removed or altered from any source distribution. 19 | 20 | Ronen Ness 21 | ronenness@gmail.com 22 | 23 | */ -------------------------------------------------------------------------------- /dist/LICENSE.txt: -------------------------------------------------------------------------------- 1 | RPGUI (RPG gui for web games) is distributed with the zlib-license: 2 | 3 | /* 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would be 15 | appreciated but is not required. 16 | 2. Altered source versions must be plainly marked as such, and must not be 17 | misrepresented as being the original software. 18 | 3. This notice may not be removed or altered from any source distribution. 19 | 20 | Ronen Ness 21 | ronenness@gmail.com 22 | 23 | */ -------------------------------------------------------------------------------- /src/styles/_radio.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * style for radioes 3 | */ 4 | 5 | /* radio box */ 6 | 7 | .rpgui-content input[type=radio].rpgui-radio 8 | { 9 | display: none; 10 | } 11 | 12 | .rpgui-content input[type=radio].rpgui-radio + label 13 | { 14 | background: url('img/radio-off.png') no-repeat; 15 | line-height: 24px; 16 | display: inline-block; 17 | background-size: auto 100%; 18 | padding-left: 34px; 19 | height: 24px; 20 | margin-top: 8px; 21 | margin-bottom: 8px; 22 | } 23 | 24 | .rpgui-content input[type=radio].rpgui-radio:checked + label 25 | { 26 | background: url('img/radio-on.png') no-repeat; 27 | line-height: 24px; 28 | display: inline-block; 29 | background-size: auto 100%; 30 | padding-left: 34px; 31 | height: 24px; 32 | } 33 | 34 | /* golden radio */ 35 | 36 | .rpgui-content .rpgui-radio.golden + label 37 | { 38 | background: url('img/radio-golden-off.png') no-repeat !important; 39 | background-size: auto 100% !important; 40 | } 41 | 42 | .rpgui-content .rpgui-radio.golden:checked + label 43 | { 44 | background: url('img/radio-golden-on.png') no-repeat !important; 45 | background-size: auto 100% !important; 46 | } -------------------------------------------------------------------------------- /src/styles/_checkbox.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * style for checkboxes 3 | */ 4 | 5 | /* basic checkbox */ 6 | 7 | .rpgui-content input[type=checkbox].rpgui-checkbox 8 | { 9 | display: none; 10 | } 11 | 12 | .rpgui-content input[type=checkbox].rpgui-checkbox + label 13 | { 14 | background: url('img/checkbox-off.png') no-repeat; 15 | line-height: 24px; 16 | display: inline-block; 17 | background-size: auto 100%; 18 | padding-left: 34px; 19 | height: 24px; 20 | margin-top: 10px; 21 | margin-bottom: 10px; 22 | } 23 | 24 | .rpgui-content input[type=checkbox].rpgui-checkbox:checked + label 25 | { 26 | background: url('img/checkbox-on.png') no-repeat; 27 | line-height: 24px; 28 | display: inline-block; 29 | background-size: auto 100%; 30 | padding-left: 34px; 31 | height: 24px; 32 | } 33 | 34 | /* golden checkbox */ 35 | 36 | .rpgui-content input[type=checkbox].rpgui-checkbox.golden + label 37 | { 38 | background: url('img/checkbox-golden-off.png') no-repeat; 39 | background-size: auto 100%; 40 | } 41 | 42 | .rpgui-content input[type=checkbox].rpgui-checkbox.golden:checked + label 43 | { 44 | background: url('img/checkbox-golden-on.png') no-repeat; 45 | background-size: auto 100%; 46 | } -------------------------------------------------------------------------------- /src/styles/_misc.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Customized scrollbars 3 | */ 4 | 5 | /* to get pixelated images (nearest-neighbor filter) on all browsers */ 6 | .rpgui-pixelated { 7 | -ms-interpolation-mode: nearest-neighbor; 8 | image-rendering: -webkit-optimize-contrast; 9 | image-rendering: -webkit-crisp-edges; 10 | image-rendering: -moz-crisp-edges; 11 | image-rendering: -o-crisp-edges; 12 | image-rendering: pixelated; 13 | } 14 | 15 | /* unselectable text */ 16 | .rpgui-noselect { 17 | -webkit-touch-callout: none; 18 | -webkit-user-select: none; 19 | -khtml-user-select: none; 20 | -moz-user-select: none; 21 | -ms-user-select: none; 22 | user-select: none; 23 | } 24 | 25 | /* center things */ 26 | .rpgui-center { 27 | text-align: center; 28 | align-content: center; 29 | } 30 | 31 | /* rotate object 90 degrees */ 32 | .rpgui-rotate-90 33 | { 34 | /* rotate 90 degrees */ 35 | -webkit-transform: rotate(90deg); 36 | -moz-transform: rotate(90deg); 37 | -o-transform: rotate(90deg); 38 | -ms-transform: rotate(90deg); 39 | transform: rotate(90deg); 40 | 41 | /* rotate from center-left side */ 42 | -ms-transform-origin: 0% 50%; /* IE 9 */ 43 | -webkit-transform-origin: 0% 50%; /* Chrome, Safari, Opera */ 44 | transform-origin: 0% 50%; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /examples/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RPGUI - Input 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 |
27 |

Textual Inputs

28 |
29 | 30 | 31 | 32 |

33 | 34 | 35 | 36 |

37 | 38 | 39 | 40 |
41 |
42 | -------------------------------------------------------------------------------- /src/styles/_input.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * input styling 3 | */ 4 | 5 | /* input/textarea input */ 6 | .rpgui-content input, 7 | .rpgui-content textarea 8 | { 9 | /* set size and colors */ 10 | -webkit-box-sizing : border-box; 11 | -moz-box-sizing : border-box; 12 | box-sizing : border-box; 13 | color: white; 14 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 15 | font-size: 0.9em; 16 | line-height: 32px; 17 | background: #4e4a4e; 18 | max-width: 100%; 19 | width: 100%; 20 | padding-left:10px; 21 | 22 | /* for ie */ 23 | min-height: 30px; 24 | 25 | /* enable text selecting */ 26 | -webkit-touch-callout: text; 27 | -webkit-user-select: text; 28 | -khtml-user-select: text; 29 | -moz-user-select: text; 30 | -ms-user-select: text; 31 | user-select: text; 32 | -webkit-tap-highlight-color: rgba(0,0,0,0.5); 33 | 34 | } 35 | 36 | /* textarea extra rules */ 37 | .rpgui-content textarea 38 | { 39 | line-height: 22px; 40 | padding-top: 7px; 41 | height: 80px; 42 | resize: none; 43 | } 44 | 45 | /* selection highlight */ 46 | .rpgui-content input::selection, 47 | .rpgui-content textarea::selection { 48 | background: rgba(0,0,0,0.5); 49 | } 50 | .rpgui-content input::-moz-selection, 51 | .rpgui-content textarea::-moz-selection { 52 | background: rgba(0,0,0,0.5); 53 | } -------------------------------------------------------------------------------- /src/styles/_content.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * global content styling 3 | */ 4 | 5 | /* game div with background image*/ 6 | .rpgui-content 7 | { 8 | padding: 0 0 0 0; 9 | margin: 0 0 0 0; 10 | width: 100%; 11 | height: 100%; 12 | left: 0px; 13 | top: 0px; 14 | position: fixed; 15 | overflow: hidden; 16 | font-size: 0.8em; 17 | } 18 | 19 | /* general rules to apply on anything inside the content */ 20 | .rpgui-content * { 21 | 22 | /* remove outline effect for input elements etc */ 23 | outline: none; 24 | 25 | /* prevent dragging */ 26 | user-drag: none; 27 | -webkit-user-drag: none; 28 | 29 | /* prevent text selecting */ 30 | -webkit-touch-callout: none; 31 | -webkit-user-select: none; 32 | -khtml-user-select: none; 33 | -moz-user-select: none; 34 | -ms-user-select: none; 35 | user-select: none; 36 | -webkit-tap-highlight-color: rgba(0,0,0,0); 37 | 38 | /* pixelated enlargement filter (to keep the pixel-art style when enlarging pictures) */ 39 | -ms-interpolation-mode: nearest-neighbor; 40 | image-rendering: -webkit-optimize-contrast; 41 | image-rendering: -webkit-crisp-edges; 42 | image-rendering: -moz-crisp-edges; 43 | image-rendering: -o-crisp-edges; 44 | image-rendering: pixelated; 45 | 46 | /* default font */ 47 | font-family: 'Press Start 2P', cursive; 48 | } 49 | -------------------------------------------------------------------------------- /src/scripts/init.js: -------------------------------------------------------------------------------- 1 | /** 2 | * init rpgui. 3 | * this is the first file included in the compiled js. 4 | */ 5 | 6 | // rpgui global namespace 7 | var RPGUI = RPGUI || {}; 8 | 9 | // lib version 10 | RPGUI.version = 1.04; 11 | 12 | // author 13 | RPGUI.author = "Ronen Ness"; 14 | 15 | // if true, will init rpgui as soon as page loads 16 | // if you set to false you need to call RPGUI.init(); yourself. 17 | RPGUI.init_on_load = true; 18 | window.addEventListener("load", function() 19 | { 20 | if (RPGUI.init_on_load) {RPGUI.init();} 21 | }); 22 | 23 | // init RPGUI and everything related 24 | RPGUI.init = function() 25 | { 26 | if (RPGUI._was_init) {throw "RPGUI was already init!";} 27 | for (var i = 0; i < RPGUI.__init_list.length; ++i) 28 | { 29 | RPGUI.__init_list[i](); 30 | } 31 | RPGUI._was_init = true; 32 | } 33 | 34 | // list of functions to run as part of the init process 35 | RPGUI.__init_list = []; 36 | 37 | // add a function to be called as part of the init process. 38 | // note: order is preserve. you may use this function to init things after RPGUI is fully loaded, since 39 | // all RPGUI will have its init functions during the inclusion of the script. 40 | RPGUI.on_load = function(callback) 41 | { 42 | // if was already init call immediately 43 | if (RPGUI._was_init) {callback();} 44 | 45 | // add to init list 46 | RPGUI.__init_list.push(callback); 47 | } -------------------------------------------------------------------------------- /examples/paragraphs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RPGUI - Paragraphs 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 |
27 |

Header 1

28 |
29 |

Header 2

30 |
31 |

Header 3

32 |
33 |

Header 4

34 |
35 |

Hello, this is a paragparh,

and this is a link.
36 | Here's a span, 37 | 38 |
39 |

Here's a plain list (not listbox):

40 | 41 |
  • item 1
  • 42 |
  • item 2
  • 43 |
  • item 3
  • 44 |
    45 |
    46 |
    47 | -------------------------------------------------------------------------------- /examples/cursors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RPGUI - Cursors 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
    25 | 26 |
    27 |

    Everything

    28 |
    29 |

    Here

    30 |
    31 |

    Will

    32 |
    33 |

    Have

    34 |
    35 |

    HAND cursor.

    36 | 37 |
    38 | yessss. 39 | 40 |
    41 | 42 | 43 |
    44 |

    Everything

    45 |
    46 |

    Here

    47 |
    48 |

    Will

    49 |
    50 |

    Have

    51 |
    52 |

    SELECT cursor.

    53 | 54 |
    55 | yessss. 56 | 57 |

    But this text will have the open-hand cursor.

    58 | 59 |
    60 | 61 |
    62 | -------------------------------------------------------------------------------- /src/styles/_icon.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Icon styles. 3 | */ 4 | 5 | .rpgui-icon { 6 | 7 | display: inline-block; 8 | background-size: 100% 100%; 9 | background-repeat: no-repeat; 10 | width: 64px; 11 | height: 64px; 12 | } 13 | 14 | .rpgui-icon.sword { 15 | background-image: url('img/icons/sword.png'); 16 | } 17 | 18 | .rpgui-icon.shield { 19 | background-image: url('img/icons/shield.png'); 20 | } 21 | 22 | .rpgui-icon.exclamation { 23 | background-image: url('img/icons/exclamation.png'); 24 | } 25 | 26 | .rpgui-icon.potion-red { 27 | background-image: url('img/icons/potion-red.png'); 28 | } 29 | 30 | .rpgui-icon.potion-green { 31 | background-image: url('img/icons/potion-green.png'); 32 | } 33 | 34 | .rpgui-icon.potion-blue { 35 | background-image: url('img/icons/potion-blue.png'); 36 | } 37 | 38 | .rpgui-icon.weapon-slot { 39 | background-image: url('img/icons/weapon-slot.png'); 40 | } 41 | 42 | .rpgui-icon.shield-slot { 43 | background-image: url('img/icons/shield-slot.png'); 44 | } 45 | 46 | .rpgui-icon.armor-slot { 47 | background-image: url('img/icons/armor-slot.png'); 48 | } 49 | 50 | .rpgui-icon.helmet-slot { 51 | background-image: url('img/icons/helmet-slot.png'); 52 | } 53 | 54 | .rpgui-icon.ring-slot { 55 | background-image: url('img/icons/ring-slot.png'); 56 | } 57 | 58 | .rpgui-icon.potion-slot { 59 | background-image: url('img/icons/potion-slot.png'); 60 | } 61 | 62 | .rpgui-icon.magic-slot { 63 | background-image: url('img/icons/magic-slot.png'); 64 | } 65 | 66 | .rpgui-icon.shoes-slot { 67 | background-image: url('img/icons/shoes-slot.png'); 68 | } 69 | 70 | .rpgui-icon.empty-slot { 71 | background-image: url('img/icons/empty-slot.png'); 72 | } 73 | -------------------------------------------------------------------------------- /examples/icons.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RPGUI - Icons 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
    25 | 26 |
    27 |

    Icons

    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 | -------------------------------------------------------------------------------- /src/styles/_progress_bar.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * progress bar styling 3 | */ 4 | 5 | /* progress bar container */ 6 | .rpgui-progress 7 | { 8 | height: 42px; 9 | width: 100%; 10 | margin-top: 5px; 11 | margin-bottom: 5px; 12 | position: relative; 13 | } 14 | 15 | /* progress bar left edge */ 16 | .rpgui-progress-left-edge 17 | { 18 | position: absolute; 19 | height: 42px; 20 | width: 40px; 21 | left: 0px; 22 | background-image: url('img/progress-bar-left.png'); 23 | background-size: 100% 100%; 24 | } 25 | 26 | /* progress bar right edge */ 27 | .rpgui-progress-right-edge 28 | { 29 | position: absolute; 30 | height: 42px; 31 | width: 40px; 32 | right: 0px; 33 | background-image: url('img/progress-bar-right.png'); 34 | background-size: 100% 100%; 35 | } 36 | 37 | /* progress bar background track */ 38 | .rpgui-progress-track 39 | { 40 | position: absolute; 41 | height: 42px; 42 | left: 40px; 43 | right: 40px; 44 | background-image: url('img/progress-bar-track.png'); 45 | background-repeat: repeat-x; 46 | background-size: 36px 100%; 47 | } 48 | 49 | 50 | /* progress bar - the fill itself */ 51 | .rpgui-progress-fill 52 | { 53 | position: absolute; 54 | top: 9px; 55 | bottom: 8px; 56 | left: 0; 57 | width: 100%; 58 | background-image: url('img/progress.png'); 59 | background-repeat: repeat-x; 60 | background-size: 36px 100%; 61 | } 62 | 63 | /* progress bar - blue color */ 64 | .rpgui-progress-fill.blue 65 | { 66 | background-image: url('img/progress-blue.png'); 67 | } 68 | 69 | /* progress bar - green color */ 70 | .rpgui-progress-fill.green 71 | { 72 | background-image: url('img/progress-green.png'); 73 | } 74 | 75 | /* progress bar - red color */ 76 | .rpgui-progress-fill.red 77 | { 78 | background-image: url('img/progress-red.png'); 79 | } 80 | -------------------------------------------------------------------------------- /examples/buttons.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RPGUI - Buttons 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
    25 | 26 |
    27 |

    RPGUI buttons

    28 |

    29 | 30 |
    31 | 32 |
    33 | 34 |
    35 | 36 |
    37 | 38 |
    39 | 40 |
    41 | 42 |
    43 | 44 |
    45 |

    RPGUI golden buttons

    46 |

    47 | 48 |
    49 | 50 |
    51 | 52 |
    53 | 54 |
    55 | 56 |
    57 | 58 |
    59 | 60 |
    61 |
    62 | -------------------------------------------------------------------------------- /src/scripts/rpgui-radio.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This script generate the rpgui radio class. 3 | * This will replace automatically every element that has the "rpgui-radio" class. 4 | */ 5 | 6 | 7 | // class name we will convert to special radio 8 | var _radio_class = "rpgui-radio"; 9 | 10 | // create a rpgui-radio from a given element. 11 | // note: element must be of type "radio" for this to work properly. 12 | RPGUI.__create_funcs["radio"] = function(element) 13 | { 14 | RPGUI.add_class(element, _radio_class); 15 | create_radio(element); 16 | }; 17 | 18 | // set function to set value of the radio 19 | RPGUI.__set_funcs["radio"] = function(elem, value) 20 | { 21 | elem.checked = value; 22 | }; 23 | 24 | // set function to get value of the radio button 25 | RPGUI.__get_funcs["radio"] = function(elem) 26 | { 27 | return elem.checked; 28 | }; 29 | 30 | // init all radio elements on page load 31 | RPGUI.on_load(function() 32 | { 33 | // get all the input elements we need to upgrade 34 | var elems = document.getElementsByClassName(_radio_class); 35 | 36 | // iterate the selects and upgrade them 37 | for (var i = 0; i < elems.length; ++i) 38 | { 39 | RPGUI.create(elems[i], "radio"); 40 | } 41 | }); 42 | 43 | // upgrade a single "input" element to the beautiful radio class 44 | function create_radio(elem) 45 | { 46 | // get next sibling, assuming its the radio label. 47 | // this object will be turned into the new radio. 48 | var new_radio = elem.nextSibling; 49 | 50 | // validate 51 | if (!new_radio || new_radio.tagName !== "LABEL") 52 | { 53 | throw "After a '" + _radio_class + "' there must be a label!"; 54 | } 55 | 56 | // copy all event listeners and events 57 | RPGUI.copy_event_listeners(elem, new_radio); 58 | 59 | // do the click event for the new radio 60 | (function(elem, new_radio) 61 | { 62 | new_radio.addEventListener("click", function() 63 | { 64 | if (!elem.disabled) 65 | { 66 | RPGUI.set_value(elem, true); 67 | } 68 | }); 69 | })(elem, new_radio); 70 | } 71 | -------------------------------------------------------------------------------- /src/scripts/rpgui-checkbox.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This script generate the rpgui checkbox class. 3 | * This will replace automatically every element that has the "rpgui-checkbox" class. 4 | */ 5 | 6 | 7 | // class name we will convert to special checkbox 8 | var _checkbox_class = "rpgui-checkbox"; 9 | 10 | // create a rpgui-checkbox from a given element. 11 | // note: element must be of type "checkbox" for this to work properly. 12 | RPGUI.__create_funcs["checkbox"] = function(element) 13 | { 14 | RPGUI.add_class(element, _checkbox_class); 15 | create_checkbox(element); 16 | }; 17 | 18 | // set function to set value of the checkbox 19 | RPGUI.__set_funcs["checkbox"] = function(elem, value) 20 | { 21 | elem.checked = value; 22 | }; 23 | 24 | // set function to get value of the checkbox 25 | RPGUI.__get_funcs["checkbox"] = function(elem) 26 | { 27 | return elem.checked; 28 | }; 29 | 30 | // init all checkbox elements on page load 31 | RPGUI.on_load(function() 32 | { 33 | // get all the input elements we need to upgrade 34 | var elems = document.getElementsByClassName(_checkbox_class); 35 | 36 | // iterate the selects and upgrade them 37 | for (var i = 0; i < elems.length; ++i) 38 | { 39 | RPGUI.create(elems[i], "checkbox"); 40 | } 41 | }); 42 | 43 | // upgrade a single "input" element to the beautiful checkbox class 44 | function create_checkbox(elem) 45 | { 46 | // get next sibling, assuming its the checkbox label. 47 | // this object will be turned into the new checkbox. 48 | var new_checkbox = elem.nextSibling; 49 | 50 | // validate 51 | if (!new_checkbox || new_checkbox.tagName !== "LABEL") 52 | { 53 | throw "After a '" + _checkbox_class + "' there must be a label!"; 54 | } 55 | 56 | // copy all event listeners and events 57 | RPGUI.copy_event_listeners(elem, new_checkbox); 58 | 59 | // do the click event for the new checkbox 60 | (function(elem, new_checkbox) 61 | { 62 | new_checkbox.addEventListener("click", function() 63 | { 64 | if (!elem.disabled) 65 | { 66 | RPGUI.set_value(elem, !elem.checked); 67 | } 68 | 69 | }); 70 | })(elem, new_checkbox); 71 | } 72 | -------------------------------------------------------------------------------- /src/styles/_list.scss: -------------------------------------------------------------------------------- 1 | 2 | /* dropdown box implemented with list (see rpgui-dropdown.js for details) */ 3 | /* note! this class rule affect both the dropdown header and the list elements! */ 4 | .rpgui-list-imp 5 | { 6 | /* font */ 7 | //font-family: 'Press Start 2P', cursive; 8 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 9 | color: white; 10 | 11 | /* default size */ 12 | min-height: 40px; 13 | margin-top: 0px; 14 | 15 | /* scrollers */ 16 | overflow-x: hidden; 17 | overflow-y: scroll; 18 | 19 | /* border */ 20 | border-style: solid; 21 | border-width: 7px 7px 7px 7px; 22 | -moz-border-image: url("img/select-border-image.png") 10% repeat repeat; 23 | -webkit-border-image: url("img/select-border-image.png") 10% repeat repeat; 24 | -o-border-image: url("img/select-border-image.png") 10% repeat repeat; 25 | border-image: url("img/select-border-image.png") 10% repeat repeat; 26 | 27 | /* background */ 28 | background: url("img/select-background-image.png") repeat repeat; 29 | background-clip: padding-box; 30 | background-origin: padding-box; 31 | background-position: center; 32 | } 33 | 34 | 35 | /* dropdown options list */ 36 | ul.rpgui-list-imp 37 | { 38 | padding: 0 0 0 0 !important; 39 | z-index: 100; 40 | } 41 | 42 | /* dropdown options */ 43 | .rpgui-list-imp li 44 | { 45 | /* font */ 46 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 47 | color: white; 48 | height: 16px; 49 | margin-left: 5px !important; 50 | 51 | /* remove the dot */ 52 | list-style-type: none; 53 | 54 | /* padding */ 55 | padding-top: 6px; 56 | padding-bottom: 6px; 57 | padding-left: 6px; 58 | 59 | /* background */ 60 | background: url("img/select-background-image.png") repeat repeat; 61 | background-clip: padding-box; 62 | background-origin: padding-box; 63 | background-position: center; 64 | } 65 | 66 | /* list options hover */ 67 | .rpgui-list-imp li:hover 68 | { 69 | color: yellow; 70 | } 71 | 72 | /* list hover */ 73 | .rpgui-list-imp:hover 74 | { 75 | color: yellow; 76 | } 77 | 78 | .rpgui-list-imp .rpgui-selected 79 | { 80 | background: rgba(0, 0, 0, 0.3); 81 | } -------------------------------------------------------------------------------- /src/styles/_cursor.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * different cursor graphics 3 | */ 4 | 5 | 6 | 7 | /* default cursor important */ 8 | /* this rule is for when you specifically request this cursor class */ 9 | .rpgui-cursor-default 10 | { 11 | cursor: url("img/cursor/default.png"), auto !important; 12 | } 13 | 14 | /* default cursor, not important, for all elements without any other rule. */ 15 | .rpgui-content, 16 | label 17 | { 18 | cursor: url("img/cursor/default.png"), auto; 19 | } 20 | 21 | 22 | 23 | 24 | /* pointer / hand cursor important */ 25 | /* this rule is for when you specifically request this cursor class */ 26 | .rpgui-cursor-point, 27 | .rpgui-cursor-point * 28 | { 29 | cursor: url("img/cursor/point.png") 10 0, auto !important; 30 | } 31 | 32 | /* pointer / hand cursor, not important, for all elements that have pointer by-default */ 33 | .rpgui-content a, 34 | .rpgui-content button, 35 | .rpgui-button, 36 | .rpgui-slider-container, 37 | .rpgui-content input[type=radio].rpgui-radio + label, 38 | .rpgui-list-imp, 39 | .rpgui-dropdown-imp, 40 | .rpgui-content input[type=checkbox].rpgui-checkbox + label 41 | { 42 | cursor: url("img/cursor/point.png") 10 0, auto; 43 | } 44 | 45 | 46 | 47 | 48 | /* for input / text selection important */ 49 | /* this rule is for when you specifically request this cursor class */ 50 | .rpgui-cursor-select, 51 | .rpgui-cursor-select * 52 | { 53 | cursor: url("img/cursor/select.png") 10 0, auto !important; 54 | } 55 | 56 | /* for input / text selection, not important, for all elements that have pointer by-default */ 57 | .rpgui-cursor-select, 58 | .rpgui-content input, 59 | .rpgui-content textarea 60 | { 61 | cursor: url("img/cursor/select.png") 10 0, auto; 62 | } 63 | 64 | /* for grabbing stuff */ 65 | /* this rule is for when you specifically request this cursor class */ 66 | .rpgui-cursor-grab-open, 67 | .rpgui-cursor-grab-open * 68 | { 69 | cursor: url("img/cursor/grab-open.png") 10 0, auto !important; 70 | } 71 | 72 | /* for grabbing stuff */ 73 | /* this rule is for when you specifically request this cursor class */ 74 | .rpgui-cursor-grab-close, 75 | .rpgui-cursor-grab-close * 76 | { 77 | cursor: url("img/cursor/grab-close.png") 10 0, auto !important; 78 | } -------------------------------------------------------------------------------- /examples/containers.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RPGUI - Containers 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
    25 |
    26 |

    This is a basic rpgui-container with "framed" class.

    27 |
    28 |

    [Internal grey frame].

    29 |
    30 |
    31 | 32 |
    33 |

    This is a basic rpgui-container with "framed-golden" class.

    34 |
    35 | 36 |
    37 |

    This is a basic rpgui-container with "framed-golden-2" class.

    38 |
    39 | 40 |
    41 |

    You don't have to use frames though. This text is inside a 'rpgui-container' but without a frame.

    42 |
    43 | 44 |
    45 |

    This is a grey-framed container ("framed-grey" class).

    46 |
    47 | 48 |
    49 |

    And this one is draggable!

    Go ahead, try and drag me ^_^

    50 | 51 |
    52 |
    53 | -------------------------------------------------------------------------------- /src/scripts/rpgui-draggable.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This script add the dragging functionality to all elements with "rpgui-draggable" class. 3 | */ 4 | 5 | 6 | // element currently dragged 7 | var _curr_dragged = null; 8 | var _curr_dragged_point = null; 9 | var _dragged_z = 1000; 10 | 11 | // class name we consider as draggable 12 | var _draggable_class = "rpgui-draggable"; 13 | 14 | // set element as draggable 15 | // note: this also add the "rpgui-draggable" css class to the element. 16 | RPGUI.__create_funcs["draggable"] = function(element) 17 | { 18 | // prevent forms of default dragging on this element 19 | element.draggable = false; 20 | element.ondragstart = function() {return false;} 21 | 22 | // add the mouse down event listener 23 | RPGUI.add_class(element, _draggable_class); 24 | element.addEventListener('mousedown', mouseDown); 25 | }; 26 | 27 | // init all draggable elements (objects with "rpgui-draggable" class) 28 | RPGUI.on_load(function() 29 | { 30 | // init all draggable elements 31 | var elems = document.getElementsByClassName(_draggable_class); 32 | for (var i = 0; i < elems.length; ++i) 33 | { 34 | RPGUI.create(elems[i], "draggable"); 35 | } 36 | 37 | // add mouseup event on window to stop dragging 38 | window.addEventListener('mouseup', mouseUp); 39 | }); 40 | 41 | // stop drag 42 | function mouseUp(e) 43 | { 44 | _curr_dragged = null; 45 | window.removeEventListener('mousemove', divMove); 46 | } 47 | 48 | // start drag 49 | function mouseDown(e){ 50 | 51 | // set dragged object and make sure its really draggable 52 | var target = e.target || e.srcElement; 53 | if (!RPGUI.has_class(target, _draggable_class)) {return;} 54 | 55 | _curr_dragged = target; 56 | 57 | // set holding point 58 | var rect = _curr_dragged.getBoundingClientRect(); 59 | _curr_dragged_point = {x: rect.left-e.clientX, y: rect.top-e.clientY}; 60 | 61 | // add z-index to top this element 62 | target.style.zIndex = _dragged_z++; 63 | 64 | // begin dragging 65 | window.addEventListener('mousemove', divMove, true); 66 | 67 | } 68 | 69 | // dragging 70 | function divMove(e){ 71 | if (_curr_dragged) 72 | { 73 | _curr_dragged.style.position = 'absolute'; 74 | _curr_dragged.style.left = (e.clientX + _curr_dragged_point.x) + 'px'; 75 | _curr_dragged.style.top = (e.clientY + _curr_dragged_point.y) + 'px'; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/styles/_dropdown.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Customized dropdown with rpgui design. 3 | */ 4 | 5 | /* dropdown box implemented with list (see rpgui-dropdown.js for details) */ 6 | /* note! this class rule affect both the dropdown header and the list elements! */ 7 | .rpgui-dropdown-imp, 8 | .rpgui-dropdown 9 | { 10 | /* font */ 11 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 12 | color: white; 13 | 14 | /* default size */ 15 | min-height: 40px; 16 | margin-top: 0px; 17 | 18 | /* border */ 19 | border-style: solid; 20 | border-width: 7px 7px 7px 7px; 21 | -moz-border-image: url("img/select-border-image.png") 10% repeat repeat; 22 | -webkit-border-image: url("img/select-border-image.png") 10% repeat repeat; 23 | -o-border-image: url("img/select-border-image.png") 10% repeat repeat; 24 | border-image: url("img/select-border-image.png") 10% repeat repeat; 25 | 26 | /* background */ 27 | background: url("img/select-background-image.png") repeat repeat; 28 | background-clip: padding-box; 29 | background-origin: padding-box; 30 | background-position: center; 31 | } 32 | 33 | 34 | /* dropdown options list */ 35 | ul.rpgui-dropdown-imp 36 | { 37 | padding: 0 0 0 0 !important; 38 | z-index: 100; 39 | } 40 | 41 | /* note! this affect only the dropdown header */ 42 | /* shows the currently selected value from select element */ 43 | .rpgui-content .rpgui-dropdown-imp-header 44 | { 45 | color: white !important; 46 | min-height: 22px !important; 47 | padding: 5px 10px 0 10px !important; 48 | margin: 0 0 0 0 !important; 49 | position: relative !important; 50 | } 51 | 52 | /* dropdown options */ 53 | .rpgui-dropdown-imp li 54 | { 55 | /* font */ 56 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 57 | color: white; 58 | height: 16px; 59 | 60 | /* remove the dot */ 61 | list-style-type: none; 62 | 63 | /* padding */ 64 | padding-top: 6px; 65 | padding-bottom: 6px; 66 | padding-left: 6px; 67 | 68 | /* background */ 69 | background: url("img/select-background-image.png") repeat repeat; 70 | background-clip: padding-box; 71 | background-origin: padding-box; 72 | background-position: center; 73 | } 74 | 75 | /* dropdown options hover */ 76 | .rpgui-dropdown-imp li:hover 77 | { 78 | color: yellow; 79 | } 80 | 81 | /* dropdown hover */ 82 | .rpgui-dropdown-imp:hover 83 | { 84 | color: yellow; 85 | } -------------------------------------------------------------------------------- /dist/README.md: -------------------------------------------------------------------------------- 1 | # RPGUI 2 | Lightweight framework for old-school RPG GUI in web! 3 | 4 | ## Live example 5 | 6 | Live examples can be found [here](http://ronenness.github.io/RPGUI/). 7 | 8 | ## What is it? 9 | This framework provide out-of-the-box GUI for web games with old-school RPG style. 10 | Once including this lib all you need to do is start adding regular html elements with RPGUI classes, and RPGUI will do all the rest! 11 | 12 | ![alt tag](https://raw.githubusercontent.com/RonenNess/RPGUI/master/screenshot.jpg) 13 | (Image is slightly outdated.) 14 | 15 | **RPGUI is a css+js framework for client side only, you don't need to require it on node.js side.** 16 | 17 | ## Key Features 18 | The following are the key features of RPGUI: 19 | 20 | - Using RPGUI don't require coding at all! Just using css classes. 21 | - A complete and whole CSS system that will cover most HTML elements. 22 | - Containers with several type of frames. 23 | - Dragging functionality. 24 | - Beautiful sliders and progress bars. 25 | - Customized cursors with 8-bit style. 26 | - A collection of build-in icons for rpgs. 27 | - Neat checkboxes and Radio buttons. 28 | - Styled buttons. 29 | - Sophisticated dropdown widget (based on <select>). 30 | - Pretty listbox (based on <select>). 31 | - Very easy to use. Create game GUI in seconds with only plain html code. 32 | - No dependencies, works right out of the box! 33 | - Very lightweight - just ~25kb of css/js, + 1.5Mb of resources (images). 34 | 35 | RPGUI should work on all modern browsers, tested and confirmed on Chrome, FireFox, Opera, and Internet Explorer edge*. 36 | 37 | ## How to use 38 | 39 | RPGUI docs can be found at the [github repo](https://github.com/RonenNess/RPGUI#rpgui), or you can watch some live example [here](http://ronenness.github.io/RPGUI/). 40 | 41 | ## Credits 42 | 43 | - PRGUI default theme uses the public-domain graphics made by Buch, aka Michele Bucelli ()http://opengameart.org/users/buch). 44 | - Special thanks to titoasty (https://github.com/titoasty) that contributed a lot to this lib. 45 | 46 | ## License 47 | 48 | RPGUI is distributed under the zlib-license, and is absolutely free for use in any purpose (personal, educational, commercial, etc..). 49 | See LICENSE.txt for more info. 50 | 51 | ## Contact Me 52 | 53 | For issues / bugs use the Report Issue button. 54 | For anything else, feel free to contact me: ronenness@gmail.com. 55 | 56 | 57 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // load plugins 4 | var gulp = require('gulp'); 5 | var sass = require('gulp-sass'); 6 | var minifycss = require('gulp-minify-css'); 7 | var imagemin = require('gulp-imagemin'); 8 | var concat = require('gulp-concat'); 9 | var del = require('del'); 10 | var notify = require('gulp-notify'); 11 | var uglify = require('gulp-uglify'); 12 | 13 | 14 | var includes = require('./src/includes.json'); 15 | 16 | // styles 17 | gulp.task('styles', function() { 18 | var tmp = gulp.src('src/styles/app.scss') 19 | .pipe(sass().on('error', sass.logError)); 20 | 21 | // unminified 22 | tmp.pipe(concat('rpgui.css')) 23 | .pipe(gulp.dest('dist/')); 24 | 25 | // minified 26 | return tmp.pipe(concat('rpgui.min.css')) 27 | .pipe(minifycss()) 28 | .pipe(gulp.dest('dist/')) 29 | .pipe(notify({ message: 'styles task complete' })); 30 | }); 31 | 32 | // scripts 33 | gulp.task('scripts', function() { 34 | var tmp = gulp.src(includes); 35 | 36 | // unminified 37 | tmp.pipe(concat('rpgui.js')) 38 | .pipe(gulp.dest('dist/')) 39 | .pipe(notify({ message: 'scripts task complete' })); 40 | 41 | // minified 42 | return tmp.pipe(concat('rpgui.min.js')) 43 | .pipe(uglify()) 44 | .pipe(gulp.dest('dist/')) 45 | .pipe(notify({ message: 'scripts task complete' })); 46 | }); 47 | 48 | // images 49 | gulp.task('images', function() { 50 | //return gulp.src('src/images/**/*') 51 | // .pipe(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true })) 52 | // .pipe(gulp.dest('dist/images')) 53 | // .pipe(notify({ message: 'images task complete' })); 54 | }); 55 | 56 | // clean 57 | gulp.task('clean', function() { 58 | return del(['dist/css', 'dist/js', 'dist/images']); 59 | }); 60 | 61 | // default task 62 | gulp.task('default', ['watch'], function() { 63 | // gulp.start('styles', 'scripts', 'images'); 64 | }); 65 | 66 | // watch 67 | gulp.task('watch', ['clean', 'styles', 'scripts', 'images'], function() { 68 | // Watch .scss files 69 | gulp.watch('src/styles/**/*.scss', ['styles']); 70 | 71 | // Watch .js files 72 | gulp.watch('src/scripts/**/*.js', ['scripts']); 73 | 74 | // Watch image files 75 | gulp.watch('src/images/**/*', ['images']); 76 | 77 | // Watch any files in dist/, reload on change 78 | gulp.watch(['dist/**']); 79 | }); 80 | 81 | // dist 82 | gulp.task('dist', ['clean', 'styles', 'scripts', 'images'], function() { 83 | }); 84 | -------------------------------------------------------------------------------- /src/scripts/global_methods.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Used to provide unified, easy javascript access to customized elements. 3 | */ 4 | 5 | 6 | // different callbacks for different methods and types 7 | RPGUI.__update_funcs = {}; 8 | RPGUI.__create_funcs = {}; 9 | RPGUI.__get_funcs = {} 10 | RPGUI.__set_funcs = {}; 11 | 12 | // create a customized rpgui element ("list", "dropbox", etc.) 13 | // note: this function expect the original html element. 14 | RPGUI.create = function(element, rpgui_type) 15 | { 16 | // call the creation func and set type 17 | if (RPGUI.__create_funcs[rpgui_type]) 18 | { 19 | element.dataset['rpguitype'] = rpgui_type; 20 | RPGUI.__create_funcs[rpgui_type](element); 21 | } 22 | // not a valid type? exception. 23 | else 24 | { 25 | throw "Not a valid rpgui type! options: " + Object.keys(RPGUI.__create_funcs); 26 | } 27 | } 28 | 29 | // update an element after you changed it manually via javascript. 30 | // note: this function expect the original html element. 31 | RPGUI.update = function(element) 32 | { 33 | // if have update callback for this type, use it 34 | var type = element.dataset['rpguitype'] 35 | if (RPGUI.__update_funcs[type]) 36 | { 37 | RPGUI.__update_funcs[type](element); 38 | } 39 | // if not, use the default (firing update event) 40 | else 41 | { 42 | RPGUI.fire_event(element, "change"); 43 | } 44 | } 45 | 46 | 47 | // set & update the value of an element. 48 | // note: this function expect the original html element. 49 | RPGUI.set_value = function(element, value) 50 | { 51 | // if have set value callback for this type, use it 52 | var type = element.dataset['rpguitype']; 53 | if (RPGUI.__set_funcs[type]) 54 | { 55 | RPGUI.__set_funcs[type](element, value); 56 | } 57 | // if not, use the default (setting "value" member) 58 | else 59 | { 60 | element.value = value; 61 | } 62 | 63 | // trigger update 64 | RPGUI.update(element); 65 | } 66 | 67 | 68 | 69 | // get the value of an element. 70 | // note: this function expect the original html element. 71 | RPGUI.get_value = function(element) 72 | { 73 | // if have get value callback for this type, use it 74 | var type = element.dataset['rpguitype']; 75 | if (RPGUI.__get_funcs[type]) 76 | { 77 | return RPGUI.__get_funcs[type](element); 78 | } 79 | // if not, use the default (getting the "value" member) 80 | else 81 | { 82 | return element.value; 83 | } 84 | } -------------------------------------------------------------------------------- /examples/checkbox_and_radio.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RPGUI - Checkbox and Radio 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
    25 | 26 |
    27 |

    RPGUI checkboxes:

    28 |
    29 | 30 | 31 | 32 | 33 | 34 |
    35 | 36 | 37 |
    38 | 39 |
    40 |

    RPGUI radio buttons:

    41 |
    42 |
    43 | 44 |
    45 | 46 |
    47 | 48 |
    49 |
    50 |
    51 | 52 |
    53 | 54 |
    55 | 56 |
    57 |
    58 |
    59 | -------------------------------------------------------------------------------- /examples/dropdown_and_list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RPGUI - Dropdown and List 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
    25 | 26 |
    27 |

    RPGUI dropdown

    28 |
    29 | 30 | 36 |
    37 | 38 | 44 |
    45 | 46 | 54 |
    55 | 56 |
    57 |

    RPGUI list:

    58 |
    59 | 60 | 71 |
    72 |
    73 | -------------------------------------------------------------------------------- /src/styles/_slider.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Rules for the slider. 3 | */ 4 | 5 | /* regular slider stuff */ 6 | 7 | /* slider container */ 8 | .rpgui-slider-container 9 | { 10 | height: 20px; 11 | width: 100%; 12 | margin-top: 15px; 13 | margin-bottom: 15px; 14 | position: relative; 15 | } 16 | 17 | /* slider left edge */ 18 | .rpgui-slider-left-edge 19 | { 20 | position: absolute; 21 | height: 20px; 22 | width: 20px; 23 | left: 0px; 24 | background-image: url('img/slider-left.png'); 25 | background-size: 100% 100%; 26 | } 27 | 28 | /* slider right edge */ 29 | .rpgui-slider-right-edge 30 | { 31 | position: absolute; 32 | height: 20px; 33 | width: 20px; 34 | right: 0px; 35 | background-image: url('img/slider-right.png'); 36 | background-size: 100% 100%; 37 | } 38 | 39 | /* slider background track */ 40 | .rpgui-slider-track 41 | { 42 | position: absolute; 43 | height: 20px; 44 | left: 0; 45 | right: 0; 46 | background-image: url('img/slider-track.png'); 47 | background-repeat: repeat-x; 48 | background-size: 24px 100%; 49 | } 50 | 51 | /* the part of the slider that moves and indicates the value */ 52 | .rpgui-slider-thumb 53 | { 54 | position: absolute; 55 | height: 30px; 56 | width: 15px; 57 | margin-top: -5px; 58 | left: 40px; 59 | background-image: url('img/slider-thumb.png'); 60 | background-size: 100% 100%; 61 | } 62 | 63 | /* golden slider stuff */ 64 | 65 | /* golden slider container */ 66 | .rpgui-slider-container.golden 67 | { 68 | height: 30px; 69 | width: 100%; 70 | margin-top: 15px; 71 | margin-bottom: 15px; 72 | position: relative; 73 | } 74 | 75 | /* golden slider left edge */ 76 | .rpgui-slider-left-edge.golden 77 | { 78 | position: absolute; 79 | height: 30px; 80 | width: 30px; 81 | left: 0px; 82 | background-image: url('img/slider-left-golden.png'); 83 | background-size: 100% 100%; 84 | } 85 | 86 | /* golden slider right edge */ 87 | .rpgui-slider-right-edge.golden 88 | { 89 | position: absolute; 90 | height: 30px; 91 | width: 30px; 92 | right: 0px; 93 | background-image: url('img/slider-right-golden.png'); 94 | background-size: 100% 100%; 95 | } 96 | 97 | /* golden slider background track */ 98 | .rpgui-slider-track.golden 99 | { 100 | position: absolute; 101 | height: 30px; 102 | left: 0; 103 | right: 0; 104 | background-image: url('img/slider-track-golden.png'); 105 | background-repeat: repeat-x; 106 | background-size: 40px 100%; 107 | } 108 | 109 | /* golden the part of the slider that moves and indicates the value */ 110 | .rpgui-slider-thumb.golden 111 | { 112 | position: absolute; 113 | height: 36px; 114 | width: 18px; 115 | margin-top: -4px; 116 | left: 40px; 117 | background-image: url('img/slider-thumb-golden.png'); 118 | background-size: 100% 100%; 119 | } 120 | -------------------------------------------------------------------------------- /src/scripts/rpgui-progress-bar.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This script generate the rpgui progress-bar class. 3 | * This will replace automatically every
    element that has the "rpgui-progress" class. 4 | */ 5 | 6 | 7 | // class name we will convert to special progress 8 | var _progress_class = "rpgui-progress"; 9 | 10 | // create a rpgui-progress from a given element. 11 | // note: element must be of type "range" for this to work properly. 12 | RPGUI.__create_funcs["progress"] = function(element) 13 | { 14 | RPGUI.add_class(element, _progress_class); 15 | create_progress(element); 16 | }; 17 | 18 | // set function to set value of the progress bar 19 | // value should be in range of 0 - 1.0 20 | RPGUI.__set_funcs["progress"] = function(elem, value) 21 | { 22 | // get trackbar and progress bar elements 23 | var track = RPGUI.get_child_with_class(elem, "rpgui-progress-track"); 24 | var progress = RPGUI.get_child_with_class(track, "rpgui-progress-fill"); 25 | 26 | // get the two edges 27 | var edge_left = RPGUI.get_child_with_class(elem, "rpgui-progress-left-edge"); 28 | var edge_right = RPGUI.get_child_with_class(elem, "rpgui-progress-right-edge"); 29 | 30 | // set progress width 31 | progress.style.left = "0px"; 32 | progress.style.width = (value * 100) + "%"; 33 | }; 34 | 35 | // init all progress elements on page load 36 | RPGUI.on_load(function() 37 | { 38 | // get all the select elements we need to upgrade 39 | var elems = document.getElementsByClassName(_progress_class); 40 | 41 | // iterate the selects and upgrade them 42 | for (var i = 0; i < elems.length; ++i) 43 | { 44 | RPGUI.create(elems[i], "progress"); 45 | } 46 | }); 47 | 48 | // upgrade a single "input" element to the beautiful progress class 49 | function create_progress(elem) 50 | { 51 | // create the containing div for the new progress 52 | progress_container = elem; 53 | 54 | // insert the progress container 55 | RPGUI.insert_after(progress_container, elem); 56 | 57 | // create progress parts (edges, track, thumb) 58 | 59 | // track 60 | var track = RPGUI.create_element("div"); 61 | RPGUI.add_class(track, "rpgui-progress-track"); 62 | progress_container.appendChild(track); 63 | 64 | // left edge 65 | var left_edge = RPGUI.create_element("div"); 66 | RPGUI.add_class(left_edge, "rpgui-progress-left-edge"); 67 | progress_container.appendChild(left_edge); 68 | 69 | // right edge 70 | var right_edge = RPGUI.create_element("div"); 71 | RPGUI.add_class(right_edge, "rpgui-progress-right-edge"); 72 | progress_container.appendChild(right_edge); 73 | 74 | // the progress itself 75 | var progress = RPGUI.create_element("div"); 76 | RPGUI.add_class(progress, "rpgui-progress-fill"); 77 | track.appendChild(progress); 78 | 79 | // set color 80 | if (RPGUI.has_class(elem, "blue")) {progress.className += " blue";} 81 | if (RPGUI.has_class(elem, "red")) {progress.className += " red";} 82 | if (RPGUI.has_class(elem, "green")) {progress.className += " green";} 83 | 84 | // set starting default value 85 | var starting_val = elem.dataset.value !== undefined ? parseFloat(elem.dataset.value) : 1; 86 | RPGUI.set_value(elem, starting_val); 87 | } 88 | -------------------------------------------------------------------------------- /src/styles/_paragraphs_and_headers.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Paragraphs and headers while inside an rpgui container. 3 | */ 4 | 5 | 6 | /* default gui header */ 7 | .rpgui-content h1 8 | { 9 | /* color and border */ 10 | color: white; 11 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 12 | font-size: 1.14em; 13 | 14 | /* center text */ 15 | text-align: center; 16 | 17 | /* padding */ 18 | padding: 0 0 0 0; 19 | margin: 7px 7px 17px 7px; 20 | } 21 | 22 | 23 | /* default gui header2 */ 24 | .rpgui-content h2 25 | { 26 | /* color and border */ 27 | color: white; 28 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 29 | font-size: 1.25em; 30 | 31 | /* center text */ 32 | text-align: center; 33 | 34 | /* padding */ 35 | padding: 0 0 0 0; 36 | margin: 7px 7px 17px 7px; 37 | } 38 | 39 | /* default gui header3 */ 40 | .rpgui-content h3 41 | { 42 | /* color and border */ 43 | color: white; 44 | font-weight: 1; 45 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 46 | font-size: 1.15em; 47 | text-decoration: underline; 48 | 49 | /* center text */ 50 | text-align: center; 51 | 52 | /* padding */ 53 | padding: 0 0 0 0; 54 | margin: 7px 7px 17px 7px; 55 | } 56 | 57 | /* default gui header4 */ 58 | .rpgui-content h4 59 | { 60 | /* color and border */ 61 | color: white; 62 | font-weight: 1; 63 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 64 | font-size: 1.0em; 65 | text-decoration: underline; 66 | 67 | /* center text */ 68 | text-align: center; 69 | 70 | /* padding */ 71 | padding: 0 0 0 0; 72 | margin: 7px 7px 17px 7px; 73 | } 74 | 75 | /* default p */ 76 | .rpgui-content p 77 | { 78 | /* color and border */ 79 | color: white; 80 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 81 | font-size: 1.0em; 82 | line-height: 22px; 83 | } 84 | 85 | /* default span */ 86 | .rpgui-content span 87 | { 88 | /* color and border */ 89 | color: white; 90 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 91 | font-size: 1.0em; 92 | line-height: 22px; 93 | } 94 | 95 | /* default gui link */ 96 | .rpgui-content a 97 | { 98 | /* color and border */ 99 | color: yellow; 100 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 101 | font-size: 1.0em; 102 | line-height: 22px; 103 | text-decoration: none; 104 | } 105 | /* default gui link */ 106 | .rpgui-content a:hover 107 | { 108 | text-decoration: underline; 109 | } 110 | 111 | /* default gui label */ 112 | .rpgui-content label 113 | { 114 | /* color and border */ 115 | color: white; 116 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 117 | font-size: 1.0em; 118 | line-height: 20px; 119 | display: inline; 120 | } 121 | 122 | /* default gui label */ 123 | .rpgui-content li 124 | { 125 | /* color and border */ 126 | margin-left:20px; 127 | color: white; 128 | text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black; 129 | font-size: 1.0em; 130 | line-height: 22px; 131 | } 132 | 133 | -------------------------------------------------------------------------------- /src/styles/_containers_and_frames.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * customized divs (containers) and framed objects (background and frame image). 3 | */ 4 | 5 | /* game div without background image*/ 6 | .rpgui-container 7 | { 8 | /* position style and default z */ 9 | position: fixed; 10 | z-index: 10; 11 | 12 | overflow: show; 13 | } 14 | 15 | /* game div with background image*/ 16 | .rpgui-container.framed 17 | { 18 | /* border */ 19 | border-style: solid; 20 | border-image-source: url("img/border-image.png"); 21 | border-image-repeat: repeat; 22 | border-image-slice: 6 6 6 6; 23 | border-image-width: 18px; 24 | border-width: 15px; 25 | padding: 12px; 26 | 27 | /* internal border */ 28 | box-sizing: border-box; 29 | -moz-box-sizing: border-box; 30 | -webkit-box-sizing: border-box; 31 | 32 | /* background */ 33 | background: url("img/background-image.png") repeat repeat; 34 | background-clip: padding-box; 35 | background-origin: padding-box; 36 | background-position: center; 37 | } 38 | 39 | /* game div with golden background image*/ 40 | .rpgui-container.framed-golden 41 | { 42 | /* border */ 43 | border-style: solid; 44 | border-image-source: url("img/border-image-golden.png"); 45 | border-image-repeat: repeat; 46 | border-image-slice: 4 4 4 4; 47 | border-image-width: 18px; 48 | border-width: 15px; 49 | padding: 12px; 50 | 51 | /* internal border */ 52 | box-sizing: border-box; 53 | -moz-box-sizing: border-box; 54 | -webkit-box-sizing: border-box; 55 | 56 | /* background */ 57 | background: url("img/background-image-golden.png") repeat repeat; 58 | background-clip: padding-box; 59 | background-origin: padding-box; 60 | background-position: center; 61 | } 62 | 63 | /* game div with golden2 background image*/ 64 | .rpgui-container.framed-golden-2 65 | { 66 | /* border */ 67 | border-style: solid; 68 | border-image-source: url("img/border-image-golden2.png"); 69 | border-image-repeat: repeat; 70 | border-image-slice: 8 8 8 8; 71 | border-image-width: 18px; 72 | border-width: 15px; 73 | padding: 12px; 74 | 75 | /* internal border */ 76 | box-sizing: border-box; 77 | -moz-box-sizing: border-box; 78 | -webkit-box-sizing: border-box; 79 | 80 | /* background */ 81 | background: url("img/background-image-golden2.png") repeat repeat; 82 | background-clip: padding-box; 83 | background-origin: padding-box; 84 | background-position: center; 85 | } 86 | 87 | /* game div with soft grey background image*/ 88 | .rpgui-container.framed-grey 89 | { 90 | position: relative; 91 | 92 | /* border */ 93 | border-style: solid; 94 | border-image-source: url("img/border-image-grey.png"); 95 | border-image-repeat: repeat; 96 | border-image-slice: 3 3 3 3; 97 | border-image-width: 7px; 98 | border-width: 7px; 99 | padding: 12px; 100 | 101 | /* internal border */ 102 | box-sizing: border-box; 103 | -moz-box-sizing: border-box; 104 | -webkit-box-sizing: border-box; 105 | 106 | /* background */ 107 | background: url("img/background-image-grey.png") repeat repeat; 108 | background-clip: padding-box; 109 | background-origin: padding-box; 110 | background-position: center; 111 | } 112 | -------------------------------------------------------------------------------- /src/styles/_button.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Styling for buttons 3 | */ 4 | 5 | /* button style */ 6 | .rpgui-button { 7 | 8 | /* hide button default stuff */ 9 | background-color: Transparent; 10 | background-repeat:no-repeat; 11 | border: none; 12 | overflow: hidden; 13 | outline:none; 14 | 15 | /* background */ 16 | background: url("img/button.png") no-repeat no-repeat; 17 | background-clip: padding-box; 18 | background-origin: padding-box; 19 | background-position: center; 20 | background-size: 100% 100%; 21 | 22 | /* font size */ 23 | font-size: 1.0em; 24 | 25 | /* default size and display */ 26 | max-width: 100%; 27 | min-width: 140px; 28 | height: 60px; 29 | display: inline-block; 30 | 31 | /* padding */ 32 | padding-left: 35px; 33 | padding-right: 35px; 34 | } 35 | 36 | /* button hover */ 37 | .rpgui-button.hover, 38 | .rpgui-button:hover { 39 | 40 | background-image: url("img/button-hover.png"); 41 | 42 | } 43 | 44 | /* button clicked */ 45 | .rpgui-button.down, 46 | .rpgui-button:active { 47 | 48 | background-image: url("img/button-down.png"); 49 | } 50 | 51 | /* golden button stuff */ 52 | .rpgui-button.golden p 53 | { 54 | display: inline-block 55 | } 56 | 57 | /* golden button style */ 58 | .rpgui-button.golden { 59 | 60 | /* hide button default stuff */ 61 | background-color: Transparent; 62 | background-repeat:no-repeat; 63 | border: none; 64 | overflow: hidden; 65 | outline:none; 66 | 67 | /* background */ 68 | background: url("img/button-golden.png") no-repeat no-repeat; 69 | background-clip: padding-box; 70 | background-origin: padding-box; 71 | background-position: center; 72 | background-size: 100% 80%; 73 | 74 | /* default size and display */ 75 | max-width: 100%; 76 | min-width: 140px; 77 | height: 60px; 78 | display: inline-block; 79 | 80 | /* padding */ 81 | padding-top: 5px; 82 | padding-left: 35px; 83 | padding-right: 35px; 84 | overflow: visible; 85 | } 86 | 87 | /* button hover */ 88 | .rpgui-button.golden.hover, 89 | .rpgui-button.golden:hover { 90 | 91 | background-image: url("img/button-golden-hover.png"); 92 | } 93 | 94 | /* button clicked */ 95 | .rpgui-button.golden.down, 96 | .rpgui-button.golden:active { 97 | 98 | background-image: url("img/button-golden-down.png"); 99 | } 100 | 101 | .rpgui-button.golden:before 102 | { 103 | 104 | white-space: nowrap; 105 | display: inline-block; 106 | content: ""; 107 | width: 34px; 108 | display: block; 109 | height: 110%; 110 | background: transparent url('img/button-golden-left.png') no-repeat right center; 111 | background-size: 100% 100%; 112 | margin: 0 0 0 0; 113 | left: 0px; 114 | float: left; 115 | margin-left: -46px; 116 | margin-top: -5%; 117 | } 118 | 119 | .rpgui-button.golden:after 120 | { 121 | 122 | white-space: nowrap; 123 | display: block; 124 | content: ""; 125 | width: 34px; 126 | height: 110%; 127 | background: transparent url('img/button-golden-right.png') no-repeat left center; 128 | background-size: 100% 100%; 129 | margin: 0 0 0 0; 130 | right: 0px; 131 | float: right; 132 | margin-right: -46px; 133 | margin-top: -5%; 134 | } 135 | 136 | /* 137 | .rpgui-button.golden:hover:before { 138 | 139 | background-image: url('img/button-golden-left-hover.png'); 140 | } 141 | 142 | .rpgui-button.golden:hover:after { 143 | 144 | background-image: url('img/button-golden-right-hover.png'); 145 | } 146 | */ -------------------------------------------------------------------------------- /src/scripts/rpgui-select-list.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This script generate the rpgui list element that has the "rpgui-list" class. 4 | */ 5 | 6 | 7 | // class name we will convert to list 8 | var _list_class = "rpgui-list"; 9 | 10 | // create a rpgui-list from a given element. 11 | // note: element must be 31 | 32 | 33 |
    34 | 35 | 36 |
    37 | 38 |
    39 |

    RPGUI prograss bars

    40 |
    41 | 42 |
    43 | 44 |
    45 | 46 |
    47 | 48 |
    49 |
    50 | 51 |
    52 |

    Test progress bars

    53 |
    54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
    63 | 64 | 65 |
    66 |

    Rotated sliders

    67 |
    68 |
    69 | 70 |
    71 |
    72 | 73 |
    74 |
    75 | 76 |
    77 |
    78 | 79 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /src/scripts/rpgui-select-dropdown.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This script generate the rpgui dropdown element that has the "rpgui-dropdown" class. 4 | */ 5 | 6 | 7 | // class name we will convert to dropdown 8 | var _dropdown_class = "rpgui-dropdown"; 9 | 10 | // create a rpgui-dropdown from a given element. 11 | // note: element must be element that has the "rpgui-slider" class. 4 | */ 5 | 6 | 7 | // class name we will convert to special slider 8 | var _slider_class = "rpgui-slider"; 9 | 10 | // create a rpgui-slider from a given element. 11 | // note: element must be of type "range" for this to work properly. 12 | RPGUI.__create_funcs["slider"] = function(element) 13 | { 14 | RPGUI.add_class(element, _slider_class); 15 | create_slider(element); 16 | }; 17 | 18 | // init all slider elements on page load 19 | RPGUI.on_load(function() 20 | { 21 | // get all the select elements we need to upgrade 22 | var elems = document.getElementsByClassName(_slider_class); 23 | 24 | // iterate the selects and upgrade them 25 | for (var i = 0; i < elems.length; ++i) 26 | { 27 | RPGUI.create(elems[i], "slider"); 28 | } 29 | }); 30 | 31 | // upgrade a single "input" element to the beautiful slider class 32 | function create_slider(elem) 33 | { 34 | // check if should do it golden slider 35 | var golden = RPGUI.has_class(elem, "golden") ? " golden" : ""; 36 | 37 | // create the containing div for the new slider 38 | var slider_container = RPGUI.create_element("div"); 39 | if (elem.id) {slider_container.id = elem.id + "-rpgui-slider"}; 40 | RPGUI.copy_css(elem, slider_container); 41 | RPGUI.add_class(slider_container, "rpgui-slider-container" + golden); 42 | 43 | // insert the slider container 44 | RPGUI.insert_after(slider_container, elem); 45 | 46 | // set container width based on element original width 47 | slider_container.style.width = elem.offsetWidth + "px"; 48 | 49 | // create slider parts (edges, track, thumb) 50 | 51 | // track 52 | var track = RPGUI.create_element("div"); 53 | RPGUI.add_class(track, "rpgui-slider-track" + golden); 54 | slider_container.appendChild(track); 55 | 56 | // left edge 57 | var left_edge = RPGUI.create_element("div"); 58 | RPGUI.add_class(left_edge, "rpgui-slider-left-edge" + golden); 59 | slider_container.appendChild(left_edge); 60 | 61 | // right edge 62 | var right_edge = RPGUI.create_element("div"); 63 | RPGUI.add_class(right_edge, "rpgui-slider-right-edge" + golden); 64 | slider_container.appendChild(right_edge); 65 | 66 | // thumb (slider value show) 67 | var thumb = RPGUI.create_element("div"); 68 | RPGUI.add_class(thumb, "rpgui-slider-thumb" + golden); 69 | slider_container.appendChild(thumb); 70 | 71 | // hide original slider 72 | elem.style.display = "none"; 73 | 74 | // copy events from original slider to container. 75 | // this will handle things like click, mouse move, mouse up, etc. 76 | // it will not handle things like "onchange". 77 | RPGUI.copy_event_listeners(elem, slider_container); 78 | 79 | // now set events (wrap them in anonymous function to preserve local vars) 80 | var state = {mouse_down: false}; 81 | (function(elem, slider_container, thumb, track, state, right_edge, left_edge) 82 | { 83 | // get the range of the original slider (min and max) 84 | var min = parseFloat(elem.min); 85 | var max = parseFloat(elem.max); 86 | 87 | // calculate edges width and track actual width 88 | var edges_width = right_edge.offsetWidth + left_edge.offsetWidth; 89 | var track_width = track.offsetWidth - edges_width; 90 | 91 | // set state if moving slider or not 92 | slider_container.addEventListener('mouseup', function(e) 93 | { 94 | state.mouse_down = false; 95 | }); 96 | window.addEventListener('mouseup', function(e) 97 | { 98 | state.mouse_down = false; 99 | }); 100 | track.addEventListener('mousedown', function(e) 101 | { 102 | state.mouse_down = true; 103 | slide(e.offsetX || e.layerX); 104 | }); 105 | slider_container.addEventListener('mousedown', function(e) 106 | { 107 | state.mouse_down = true; 108 | }); 109 | 110 | // handle clicking on edges (set to min / max) 111 | left_edge.addEventListener('mousedown', function(e) 112 | { 113 | set_value(min); 114 | }); 115 | right_edge.addEventListener('mousedown', function(e) 116 | { 117 | set_value(max); 118 | }); 119 | left_edge.addEventListener('mousemove', function(e) 120 | { 121 | if (state.mouse_down) set_value(min); 122 | }); 123 | right_edge.addEventListener('mousemove', function(e) 124 | { 125 | if (state.mouse_down) set_value(max); 126 | }); 127 | 128 | // handle sliding 129 | function slide(pos) 130 | { 131 | // calc new slider value 132 | var new_val = min + Math.round((pos / track_width) * (max-min)) - 1; 133 | 134 | // set thumb position 135 | set_value(new_val); 136 | } 137 | 138 | // setting value 139 | function set_value(new_val) 140 | { 141 | if (!elem.disabled && 142 | elem.value != new_val) 143 | { 144 | RPGUI.set_value(elem, new_val); 145 | } 146 | } 147 | 148 | // moving the slider 149 | track.addEventListener('mousemove', function(e) 150 | { 151 | if (state.mouse_down && !elem.disabled) 152 | { 153 | slide(e.offsetX || e.layerX); 154 | } 155 | }); 156 | 157 | 158 | // when original slider value change update thumb position 159 | elem.addEventListener("change", function(e) 160 | { 161 | _onchange(); 162 | }); 163 | function _onchange() 164 | { 165 | // get the range of the original slider (min and max) 166 | var step = track_width / (max-min); 167 | var relative_val = Math.round(parseFloat(elem.value) - min); 168 | thumb.style.left = (Math.floor(edges_width * 0.25) + (relative_val * step)) + "px"; 169 | } 170 | 171 | // call "_onchange()" to init the thumb starting position 172 | _onchange(); 173 | 174 | })(elem, slider_container, thumb, track, state, right_edge, left_edge); 175 | 176 | } -------------------------------------------------------------------------------- /examples/disabled_stuff.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RPGUI - Everything 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 31 | 32 | 33 |
    34 | 35 |

    This example shows all the key elements of RPGUI, but DISABLED.
    You might need to zoom-out a little to view all.

    36 | 37 | 38 |
    39 |

    Text Input

    40 |
    41 | 42 | 43 | 44 |

    45 | 46 | 47 | 48 |

    49 | 50 | 51 | 52 | 53 |

    Slider:

    54 | 55 |

    Golden slider:

    56 | 57 |
    58 | 59 | 60 |
    61 |

    Buttons

    62 |
    63 | 64 | 65 |

    66 | 67 |

    68 | 69 |

    Radio/Check

    70 |
    71 |
    72 | 73 |
    74 | 75 |
    76 | 77 |
    78 |
    79 | 80 | 81 |
    82 | 83 | 84 |
    85 |

    Drop & List

    86 |
    87 | 88 |

    RPGUI dropdown

    89 | 90 | 96 |
    97 | 98 |

    RPGUI list:

    99 | 100 | 111 | 112 |

    Progress bar:

    113 |
    114 |
    115 | 116 | 117 |
    118 |

    Icons

    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 | -------------------------------------------------------------------------------- /dist/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RPGUI - Everything 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 31 | 32 | 33 |
    34 | 35 |

    This example shows all the key elements of RPGUI.
    You might need to zoom-out a little to view all.

    36 | 37 | 38 |
    39 |

    Inputs

    40 |
    41 | 42 | 43 | 44 |

    45 | 46 | 47 | 48 |

    49 | 50 | 51 | 52 | 53 |

    Here is a paragraph.

    54 | 55 |
    56 | And this is a link. 57 |
    58 | 59 | 60 |
    61 |

    Buttons

    62 |
    63 | 64 | 65 |

    66 | 67 |

    68 | 69 |

    Radio/Check

    70 |
    71 |
    72 | 73 |
    74 | 75 |
    76 | 77 |
    78 |
    79 | 80 | 81 |
    82 | 83 | 84 |
    85 |

    Drop & List

    86 |
    87 | 88 |

    RPGUI dropdown

    89 | 90 | 96 |
    97 | 98 |

    RPGUI list:

    99 | 100 | 111 | 112 |
    113 | 114 |
    115 |
    116 | 117 | 118 |
    119 |

    Icons

    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 |

    Sliders

    151 |
    152 | 153 | 154 | 155 | 156 | 157 | 158 |

    Bars

    159 |
    160 | 161 |
    162 | 163 |
    164 | 165 |
    166 |
    167 | 168 | 169 |
    170 |

    This is a golden frame.

    171 |
    172 |
    173 |

    This is a golden-2 frame.

    174 |
    175 |
    176 |

    This is a grey frame.

    177 |
    178 |
    179 | -------------------------------------------------------------------------------- /examples/everything.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RPGUI - Everything 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 22 | 23 | 31 | 32 | 33 |
    34 | 35 |

    This example shows all the key elements of RPGUI.
    You might need to zoom-out a little to view all.

    36 | 37 | 38 |
    39 |

    Inputs

    40 |
    41 | 42 | 43 | 44 |

    45 | 46 | 47 | 48 |

    49 | 50 | 51 | 52 | 53 |

    Here is a paragraph.

    54 | 55 |
    56 | And this is a link. 57 |
    58 | 59 | 60 |
    61 |

    Buttons

    62 |
    63 | 64 | 65 |

    66 | 67 |

    68 | 69 |

    Radio/Check

    70 |
    71 |
    72 | 73 |
    74 | 75 |
    76 | 77 |
    78 |
    79 | 80 | 81 |
    82 | 83 | 84 |
    85 |

    Drop & List

    86 |
    87 | 88 |

    RPGUI dropdown

    89 | 90 | 96 |
    97 | 98 |

    RPGUI list:

    99 | 100 | 111 | 112 |
    113 | 114 |
    115 |
    116 | 117 | 118 |
    119 |

    Icons

    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 |

    Sliders

    151 |
    152 | 153 | 154 | 155 | 156 | 157 | 158 |

    Bars

    159 |
    160 | 161 |
    162 | 163 |
    164 | 165 |
    166 |
    167 | 168 | 169 |
    170 |

    This is a golden frame.

    171 |
    172 |
    173 |

    This is a golden-2 frame.

    174 |
    175 |
    176 |

    This is a grey frame.

    177 |
    178 |
    179 | -------------------------------------------------------------------------------- /old_versions/1.02/rpgui.min.js: -------------------------------------------------------------------------------- 1 | RPGUI=function(){function e(e){var n=e.nextSibling;if(!n||"LABEL"!==n.tagName)throw"After an '"+l+"' there must be a label!";d.copy_event_listeners(e,n),function(e,n){n.addEventListener("click",function(){d.set_value(e,!e.checked)})}(e,n)}function n(e){u=null,window.removeEventListener("mousemove",s)}function t(e){var n=e.target||e.srcElement;if(d.has_class(n,p)){u=n;var t=u.getBoundingClientRect();_={x:t.left-e.clientX,y:t.top-e.clientY},n.style.zIndex=f++,window.addEventListener("mousemove",s,!0)}}function s(e){u&&(u.style.position="absolute",u.style.left=e.clientX+_.x+"px",u.style.top=e.clientY+_.y+"px")}function a(e){progress_container=e,d.insert_after(progress_container,e);var n=d.create_element("div");d.add_class(n,"rpgui-progress-track"),progress_container.appendChild(n);var t=d.create_element("div");d.add_class(t,"rpgui-progress-left-edge"),progress_container.appendChild(t);var s=d.create_element("div");d.add_class(s,"rpgui-progress-right-edge"),progress_container.appendChild(s);var a=d.create_element("div");d.add_class(a,"rpgui-progress-fill"),n.appendChild(a),d.has_class(e,"blue")&&(a.className+=" blue"),d.has_class(e,"red")&&(a.className+=" red"),d.has_class(e,"green")&&(a.className+=" green");var i=void 0!==e.dataset.value?parseFloat(e.dataset.value):1;d.set_value(e,i)}function i(e){var n=e.nextSibling;if(!n||"LABEL"!==n.tagName)throw"After an '"+v+"' there must be a label!";d.copy_event_listeners(e,n),function(e,n){n.addEventListener("click",function(){d.set_value(e,!0)})}(e,n)}function r(e){var n=" ",t=d.create_element("p");e.id&&(t.id=e.id+"-rpgui-dropdown-head"),d.add_class(t,"rpgui-dropdown-imp rpgui-dropdown-imp-header"),d.insert_after(t,e);var s=d.create_element("ul");e.id&&(s.id=e.id+"-rpgui-dropdown"),d.add_class(s,"rpgui-dropdown-imp"),d.insert_after(s,t);var a=t.getBoundingClientRect();s.style.position="absolute",s.style.width=a.right-a.left-14+"px",s.style.display="none",e.style.display="none";for(var i=0;i-1},d.add_class=function(e,n){d.has_class(e,n)||(e.className+=" "+n)},d.get_child_with_class=function(e,n){for(var t=0;t-1},c.add_class=function(e,n){c.has_class(e,n)||(e.className+=" "+n)},c.get_child_with_class=function(e,n){for(var t=0;t-1},c.add_class=function(e,n){c.has_class(e,n)||(e.className+=" "+n)},c.get_child_with_class=function(e,n){for(var t=0;t-1},l.add_class=function(e,t){l.has_class(e,t)||(e.className+=" "+t)},l.get_child_with_class=function(e,t){for(var n=0;n-1},RPGUI.add_class=function(e,t){RPGUI.has_class(e,t)||(e.className+=" "+t)},RPGUI.get_child_with_class=function(e,t){for(var n=0;n