Giter VIP home page Giter VIP logo

pyro's Introduction

*.ini

; wnd.ini
name = WindowTitle
icon = custom.ico
width = 1280
height = 720
; glsl.ini
version = 430
include = shader_macros.h

*.rc

# include <rc.h>
ICO(custom.ico)
RC(wnd.ini)
RC(glsl.ini)
RC(shader_macros.h)

main

main, WinMain both are compiled in main.cpp choose one of those mains with MSC (visual c++) link option ... either /SUBSYSTEM:CONSOLE or /SUBSYSTEM:WINDOWS

user-defined highlevel

// user-defined.h
class Gamepad
{
  float x, y
  bool A, B
  bool X, Y
  bool L, R
}
# include <pyro/io.h> // abstract template
class Object : public io<Gamepad>
{
	static constexpr float jump_momentum = 42.f
	float x = 0.f
	float y = 0.f
	float z = 0.f
public:
	Gamepad * flush(size_t count, Gamepad * gamepad)override
	{
		while( count )
		{
			if( gamepad->A )
				this->z += jump_momentum
			this->x += gamepad->x
			this->y += gamepad->y
			-- count
		}
		return nullptr
	}
	void render(void)
	{
		... render object here
	}
};

WNDPROC

extern LRESULT WND(HWND, UINT, WPARAM, LPARAM) decl in wnd.h there is no wnd.cpp impl yet existing (do it your own way)

// wnd.cpp
# include <wnd.h>
# include <glrc.h> // OpenGL
# include <hid.h> // InputDevice
# include "user-defined.h" // Gamepad, Object
GLRC         OpenGL
HID<GAMEPAD> InputDevice
# include <pyro/unique.h> // global inline singleton-container
using namespace pyro
LRESULT WINAPI WND(HWND, UINT, WPARAM, LPARAM)
{
  case WM_CREATE:
    InputDevice = HID<Gamepad>(HWND, ...)
    OpenGL = GLRC(4, 3) // core profile
    ...initialize highlevel
    pyro::unique<Object>.init(...)
    ShowWindow(HWND, SW_SHOW) // following WINAPI convention here.
    return
  case WM_DESTROY:
    ...release highlevel
    pyro::unique<Object>.release( )
    OpenGL = GLRC( )              // release
    InputDevice = HID<GAMEPAD>( ) // release
    PostQuitMessage(0) // following WINAPI convention here.
    return
  case WM_INPUT:
    if( size_t n = InputDevice(WPARAM, LPARAM) )
    	pyro::unique<Object>.flush(n, &InputDevice[0])
    return
  case WM_PAINT:
    pyro::unique<Object>.render( ) // draw scene
    SwapBuffers(OpenGL.DC) // following WINAPI convention here.
    return
}

extern const LONG WS decl in wnd.h

extern const DWORD WS_EX decl in wnd.h

extern const UINT CS decl in wnd.h

there is no impl yet existing (do it your own way)

const LONG WS = WS_OVERLAPPED // WND
const DWORD WS_EX = WS_EX_APPWINDOW // WND
const UINT CS = CS_OWNDC // WNDCLASS

alt text

pyro's People

Contributors

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