Giter Club home page Giter Club logo

progress2's Introduction

progress2.inc

A SA:MP UI library for rendering progress bars used to visualise all manner of data from health to a countdown timer.

Library originally written by Flávio Toribio, Now maintained by Southclaws in version 2+ with new features.

Bars 1

Bars 2

Bars 3

Installation

Simply install to your project:

sampctl package install Southclaws/progress2

Include in your code and begin using the library:

#include <progress2>

Usage

Constants

  • MAX_PLAYER_BARS:
    • Defaults to the textdraw limit divided by 3.
  • INVALID_PLAYER_BAR_VALUE:
    • Invalid return value for interface functions.
  • INVALID_PLAYER_BAR_ID:
    • Invalid bar ID value.
  • BAR_DIRECTION_RIGHT:
    • Bar direction left-to-right
  • BAR_DIRECTION_LEFT:
    • Bar direction right-to-left
  • BAR_DIRECTION_UP:
    • Bar direction bottom to top
  • BAR_DIRECTION_DOWN:
    • Bar direction top to bottom

Functions

  • PlayerBar:CreatePlayerProgressBar(playerid, Float:x, Float:y, Float:width = 55.5, Float:height = 3.2, colour, Float:max = 100.0, direction = BAR_DIRECTION_RIGHT):
    • Creates a progress bar for a player.
  • DestroyPlayerProgressBar(playerid, PlayerBar:barid):
    • Destroys a player's progress bar.
  • ShowPlayerProgressBar(playerid, PlayerBar:barid):
    • Shows a player's progress bar to them.
  • HidePlayerProgressBar(playerid, PlayerBar:barid):
    • Hides a player's progress bar from them.
  • IsValidPlayerProgressBar(playerid, PlayerBar:barid):
    • Returns true if the input bar ID is valid and exists.
  • GetPlayerProgressBarPos(playerid, PlayerBar:barid, &Float:x, &Float:y):
    • Returns the on-screen position of the specified progress bar.
  • SetPlayerProgressBarPos(playerid, PlayerBar:barid, Float:x, Float:y):
    • Updates the position for a progress bar and re-renders it.
  • Float:GetPlayerProgressBarWidth(playerid, PlayerBar:barid):
    • Returns the width of a progress bar.
  • SetPlayerProgressBarWidth(playerid, PlayerBar:barid, Float:width):
    • Updates the width of a progress bar and re-renders it.
  • Float:GetPlayerProgressBarHeight(playerid, PlayerBar:barid):
    • Returns the height of a progress bar.
  • SetPlayerProgressBarHeight(playerid, PlayerBar:barid, Float:height):
    • Updates the height of a progress bar and re-renders it.
  • GetPlayerProgressBarColour(playerid, PlayerBar:barid):
    • Returns the colour of a progress bar.
  • SetPlayerProgressBarColour(playerid, PlayerBar:barid, colour):
    • Sets the colour of a progress bar.
  • Float:GetPlayerProgressBarMaxValue(playerid, PlayerBar:barid):
    • Returns the maximum value of a progress bar.
  • SetPlayerProgressBarMaxValue(playerid, PlayerBar:barid, Float:max):
    • Sets the maximum value that a progress bar represents.
  • Float:GetPlayerProgressBarValue(playerid, PlayerBar:barid):
    • Returns the value a progress bar represents.
  • SetPlayerProgressBarValue(playerid, PlayerBar:barid, Float:value):
    • Sets the value a progress bar represents.
  • GetPlayerProgressBarDirection(playerid, PlayerBar:barid):
    • Returns the direction of a progress bar.
  • SetPlayerProgressBarDirection(playerid, PlayerBar:barid, direction):
    • Updates the direction for a progress bar and re-renders it.

Internal

  • _RenderBar(playerid, barid):
    • Renders a valid bar on-screen using it's current properties. Called on creation and whenever position, width or height are updated.

Hooked

  • OnScriptInit:
    • When y_iterate is used, initialises iterators.
  • OnPlayerDisconnect:
    • To automatically destroy bars when a player disconnects.

Testing

To test, simply run the package:

sampctl package run

And connect to localhost:7777 to test.

progress2's People

Contributors

muthax avatar southclaws avatar zorono avatar nathanramli avatar ze8h avatar michaelbelgium avatar pt-player avatar victormacielghost avatar samp-pinch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.