GithubHelp home page GithubHelp logo

samizzo / pixie Goto Github PK

View Code? Open in Web Editor NEW
26.0 26.0 4.0 863 KB

Pixie - a minimal, cross-platform pixel framebuffer library for Windows and macOS.

License: MIT License

C++ 77.51% Objective-C++ 20.72% C 1.77%
c cpp framebuffer imgui library macos pixel windows

pixie's People

Contributors

samizzo avatar therealmolen 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

pixie's Issues

Please add MinGW support

I made a very quick attempt.
makefile_win.zip

with the following errors.

Unfortunately, it wasn't fixable with adding #include <algorithm> and using namespace std; to imgui.cpp

$ make -f makefile_win
g++ -I. -Wall -DUNICODE -D_UNICODE -g -c imgui.cpp -o obj/imgui.o
imgui.cpp: In static member function 'static void Pixie::ImGui::Input(char*, int, int, int, int, int
)':
imgui.cpp:166:46: error: 'min' was not declared in this scope
  166 |             s_state.keyboardCursorPosition = min((mouseX - textX) / s_state.font->GetCharact
erWidth(), textLength);
      |                                              ^~~
imgui.cpp:211:50: error: 'max' was not declared in this scope
  211 |                 s_state.keyboardCursorPosition = max(s_state.keyboardCursorPosition - 1, 0);

      |                                                  ^~~
imgui.cpp:215:50: error: 'min' was not declared in this scope
  215 |                 s_state.keyboardCursorPosition = min(s_state.keyboardCursorPosition + 1, tex
tLength);
      |                                                  ^~~
imgui.cpp:278:50: error: 'min' was not declared in this scope
  278 |                 s_state.keyboardCursorPosition = min(s_state.keyboardCursorPosition + 1, tex
tBufferLength);
      |                                                  ^~~
make: *** [makefile_win:17: obj/imgui.o] Error 1

Framebuffer does not actually display on Mojave

Code:

#include "pixie/pixie.cpp"
#include "pixie/imgui.h"
#include "pixie/font.h"

using Pixie::ImGui;

int main() {
	Pixie::Font font;

	if (!font.Load("../pixie/font.bmp", 9, 16)) {
		return 1;
	}

	Pixie::Window window;

	if (!window.Open("Hello, World!", 640, 480)) {
		return 1;
	}

	while (!window.HasKeyGoneUp(Pixie::Key_Escape)) {
		ImGui::Begin(& window, & font);

		if (ImGui::Button("Hello, World!", 0, 0, 9 * 13, 16)) {
			ImGui::Label("Hello, World!", 0, 16, 0);
		}

		ImGui::End();

		if (!window.Update()) {
			break;
		}
	}

	window.Close();
}

CMakeLists.txt (don't kill me for using CMake):

cmake_minimum_required(VERSION 3.12)
project(pixie_test)

set(CMAKE_CXX_STANDARD 11)

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreGraphics -framework AppKit")

add_library(pixie pixie/pixie.cpp)
add_library(pixie_osx pixie/pixie_osx.mm)
add_library(pixie_imgui pixie/imgui.cpp)
add_library(pixie_font pixie/font.cpp)

add_executable(pixie_test main.cpp)

target_link_libraries(pixie_test pixie pixie_osx pixie_imgui pixie_font)

Window:

image

That's it.

No display.

However, I CAN still press the button, and if I add a print in there (actually std::cout << ...) it will display something in the terminal. I just... can't see the button. Yay.

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.