Skip to content

Instantly share code, notes, and snippets.

View colesnicov's full-sized avatar

Colesnicov Denis Petrovich colesnicov

  • Czech Republic, Tachov
View GitHub Profile
@colesnicov
colesnicov / main.c
Created December 24, 2016 00:36
Одно из изначальных можных реализаций OSG + IMGUI. НЕДОКОНЧЕНО!! IMGUI не принимает ввод од пользователя!! Есть идеи, кидай в комменты.
// \LICENCE WTFPL
// Denis Colesnicov <eugustus@gmail.com>
#include <GL/glut.h>
#include <iostream>
#include <osg/Config>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
@colesnicov
colesnicov / 2to3to2.h
Created December 28, 2016 12:43
Mozny zpusob prepinani se mezi 2D a 3D zobrazenim. Vyuziti pro GUI?
public static void switchTo2D() {
if (currentRenderDimension != Dimension.DIM_2) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_MODELVIEW);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#pragma once
#include "IconsFontAwesome.h" // from https://github.com/juliettef/IconFontCppHeaders
namespace ImGui
{
inline void SetupImGuiStyle( bool bStyleDark_, float alpha_ )
{
@colesnicov
colesnicov / file.c
Last active January 10, 2017 12:29
Dirty (HARD) text wrapping for ImGui::InputTexImplements
/*
* Considerations on the possible implementation of word-wrap text for ImGui :: InputTextMultiline.
*
* Implements a "hard" line wrapping depending on the length of the text.
*
* Use, copying, modification and distribution without any liability to the author is possible.
*
* The discussion leads here: https://github.com/ocornut/imgui/issues/952
*
* But it is still a problems:
@colesnicov
colesnicov / Singleton.cpp
Created January 18, 2017 20:58
Singleton in C++
/**
* @file Singleton.cpp part of @file Singleton.hpp
* @version 2
*
* @author Denis Colesnicov <eugustus@gmail.com>
* @date 2017/01/15
*
* @copyright WTFPL
*/
@colesnicov
colesnicov / Loader.cpp
Last active January 28, 2017 16:20
Modular system in C++
/**
* @file Loader.cpp part of @file Loader.hpp
*
* @author Denis Colesnicov <eugustus@gmail.com>
* @date 2017/01/15
*
* @copyright MIT
*/
#include "LibraryLoader.h"
@colesnicov
colesnicov / imguiSFML.c
Created March 2, 2017 18:28
ImGui SFML2 bindings
#include "imguiSFML.h"
#include <SFML/OpenGL.hpp>
#include <SFML/Graphics/Color.hpp>
#include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Window/Window.hpp>
@colesnicov
colesnicov / main.cpp
Last active August 25, 2017 13:25
Demonstrate one way to integrate SFML, SFGUI and OSG. It's a problem of input from the user. It would be good if they checked whether the widget is focused SFGUI and if so, the incident would not bubble through to the OSG. If anyone know how to implement it by writing in the comments.
/* OpenSceneGraph example, osgviewerSFML.
*
* 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 SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@colesnicov
colesnicov / Convertrgb.h
Created October 10, 2017 14:07
Convert grb color to adafruit_gfx
short ConvertRGB(byte R, byte G, byte B) {
return (((R & 0xF8) << 8) | ((G & 0xFC) << 3) | (B >> 3));
}
@colesnicov
colesnicov / RotaryEncoder.c
Created November 16, 2017 19:40
Rotary encoder for RPi 2
/**********************************************************************
* Description : Rotacni enkoder pro Raspberry PI 2
* Author : Denis Colesnicov
* E-mail : eugustus@gmail.com
* Notice : Original code https://www.sunfounder.com/learn/Super_Kit_V2_for_RaspberryPi/lesson-8-rotary-encoder-super-kit-for-raspberrypi.html
* Date : 2017/11/17
**********************************************************************/
/**********************************************************************
************************* TODO ***************************************