Code Monkey home page Code Monkey logo

warp-framework's Introduction

Warp-Framework (Beta)

Welcome to Warp, a framework to create powerful and rich GUI C++ Single-Window applications using Direct2D API

INDEX

STATUS

🔧 CURRENTLY WORKING ON: DOCUMENTATION

NOTE: TEXTBOX IS STILL WIP

DOCUMENTATION

The documentation is finally being worked on, you can find it in the docs folder.

PLANS

Since the plan list got a little bigger than I originally expected, I decided it would be best if I moved it to another MarkDown (MD) page; You can find it Here!

FRAMEWORK VIEW

Warp-Framework

alt text

Warp-Logger

alt text

EXAMPLES

This is a simple WEntry.cpp example which would be your main starting point of the framework!

It shows you how to create buttons, a textbox, a listbox, and add whatever is in the textbox to the content of the listbox upon clicking the Push button!

To go to the file in the repo click Here!

// © 2019 NIREX ALL RIGHTS RESERVED

#include "WContainer.h"
#include "WControlHandler.h"
#include "WRadioButtonHandler.h"

// These need to be initialized before everything else
std::map<W_INT, IControl*> WControlHandler::mtcp = {};
std::set<WRadioButton*> WRadioButtonHandler::strz = {};
std::set<W_INT> WControlHandler::stcz = {};
WTheme WContainer::wTheme = {};

/* EXAMPLE BUTTON */

#include "WButton.h"
WButton* myFirstButton;
WButton* mySecondButton;

/* EXAMPLE TEXTBOX */

#include "WTextBox.h"
WTextBox* myFirstTextBox;


/* EXAMPLE LISTBOX */

#include "WListBox.h"
#include "WListBoxItem.h"

WListBox* myDynamicListBox;

/* EXAMPLE EVENTS */

void myFirstButton_Click(WEntity* sender, WEventArgs* arguments)
{
	myDynamicListBox->CreateItem((wchar_t*)myFirstTextBox->Content().c_str());
}

void mySecondButton_Click(WEntity* sender, WEventArgs* arguments)
{
	// Don't worry, RAII is not being denied!
	myDynamicListBox->RemoveLast();
}

void myFirstTextBox_Click(WEntity* sender, WEventArgs* arguments)
{
	// Clean the content on click!
	myFirstTextBox->Content(L"");
}

/* GRADIENT BACKGROUND */

#include "WContainer.h"
W_COLOR firstColor;
W_COLOR secondColor;
WRectF clientRegion;

// Runs at the start of the application
void WEntry::Start(void)
{
	// Button #1
	myFirstButton = new WButton(100, 100, 150, 200, 10);
	myFirstButton->Content(L"PUSH");
	myFirstButton->MouseDownRegistery()->Register(myFirstButton_Click);

	// Button #2
	mySecondButton = new WButton(100, 230, 150, 330, 11);
	mySecondButton->Content(L"POP");
	mySecondButton->MouseDownRegistery()->Register(mySecondButton_Click);

	// Textbox
	myFirstTextBox = new WTextBox(170, 100, 200, 330, 12);
	myFirstTextBox->Content(L"Click and Write (It's not fancy!)");
	myFirstTextBox->MouseDownRegistery()->Register(myFirstTextBox_Click);

	// List box
	myDynamicListBox = new WListBox(230, 100, 500, 330, 1);
	
	// Gradient Background
	firstColor = Graphics()->FromRGBA(10, 10, 10, 1);
	secondColor = Graphics()->FromRGBA(120, 120, 120, 1);

	clientRegion.Top((W_FLOAT)Graphics()->GetClientArea().top);
	clientRegion.Left((W_FLOAT)Graphics()->GetClientArea().left);
	clientRegion.Bottom((W_FLOAT)Graphics()->GetClientArea().bottom);
	clientRegion.Right((W_FLOAT)Graphics()->GetClientArea().right);
}

// Runs every frame pre-render
void WEntry::Update(DELTATIME deltaTime)
{
}

// Runs every frame post-update
void WEntry::Render(DELTATIME deltaTime)
{
	// NOTE: Gradient Background renders before all the controls!
	Graphics()->FillRectLinear(clientRegion,
		Graphics()->FromRGBA(128, 128, 128, 0.7F),
		Graphics()->FromRGBA(0, 0, 0, 0.7F),
		WLinearGradientDirection::WLG_Bottom_Top);
}

// Runs before the application quits 
void WEntry::End(void)
{
	// Free your resources here!

	myFirstButton->Free();
	mySecondButton->Free();
	myFirstTextBox->Free();
	myDynamicListBox->Free();
}

CONTACT

[email protected]

COPYRIGHT INFO

MIT License

Copyright (c) 2018-2019 nirex0

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

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

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

warp-framework's People

Contributors

nirex0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.