Browse Source

new files

undefined
Odilitime 4 years ago
parent
commit
d8d361fc34

+ 30
- 0
browser.ntrml View File

@@ -0,0 +1,30 @@
<body color=000000FF bgcolor=CCCCCCCC>
<layer>
<img name="mascot" src="anime.pnm" width=512 height=512 left=60% bottom=0>
</layer>
<layer>
<box color=888888FF top=0 height=64 left=0 right=0></box>
<!--
>what beyond the colors of the tabs would you want to change?
- The shape of the outline
- how close they stand together
- Something I've really taken a liking to in firefox is how you can disable/enable sound from tabs with the icon in it's title. So perhaps a way to customize what kind of buttons (along with their functions) a tab can have would be nice too. Of course, that's not exactly something that should be prioritized.
-->
<tabSelector color=000000FF hover=888888FF left=0 width=100% top=64 bottom=0>
</tabSelector>
</layer>
<layer>
<box color=000000FF hover=880000FF left=32 width=32 top=16 height=32
onClick="back">
</box>
<box color=000000FF hover=008800FF left=74 width=32 top=16 height=32
onClick="forward">
</box>
<box color=000000FF hover=000088FF left=116 width=32 top=16 height=32
onClick="refresh">
</box>
<input color=000000FF bgcolor=FFFFFFFF left=192 right=192 top=16 height=24
onClick="address" fontSize=12>
<font top=16 height=16 right=0 width=192 src="DejaVuSerif.ttf" family="san-serif" size=12 color=000000FF bgcolor=FF0000>NetRunner</font>
</layer>
</body>

+ 0
- 13
src/graphics/components/AnimeComponent.h View File

@@ -1,13 +0,0 @@
#ifndef ANIMECOMPONENT_H
#define ANIMECOMPONENT_H

#include <GL/glew.h>
#include "BoxComponent.h"

class AnimeComponent : public BoxComponent {
public:
AnimeComponent(const float rawX, const float rawY, const float rawWidth, const float rawHeight, const int passedWindowWidth, const int passedWindowHeight);
unsigned char data[1024][1024][4];
};

#endif

src/graphics/components/AnimeComponent.cpp → src/graphics/components/ImageComponent.cpp View File

@@ -1,4 +1,4 @@
#include "AnimeComponent.h"
#include "ImageComponent.h"
#include <cmath>
#include <iostream>
#include "../../pnm.h"
@@ -6,8 +6,8 @@
#include "../../../anime.h"
#endif

AnimeComponent::AnimeComponent(const float rawX, const float rawY, const float rawWidth, const float rawHeight, const int passedWindowWidth, const int passedWindowHeight) : BoxComponent(rawX, rawY, rawWidth, rawHeight, 0x00000000, passedWindowWidth, passedWindowHeight) {
//std::cout << "AnimeComponent::AnimeComponent" << std::endl;
ImageComponent::ImageComponent(std::string filename, const float rawX, const float rawY, const float rawWidth, const float rawHeight, const int passedWindowWidth, const int passedWindowHeight) : BoxComponent(rawX, rawY, rawWidth, rawHeight, 0x00000000, passedWindowWidth, passedWindowHeight) {
//std::cout << "ImageComponent::ImageComponent" << std::endl;

windowWidth = passedWindowWidth;
windowHeight = passedWindowHeight;
@@ -18,6 +18,7 @@ AnimeComponent::AnimeComponent(const float rawX, const float rawY, const float r
height = rawHeight;
#ifdef __MINGW32__ // the old "huge string" works fine with mingw
//
for (int py = 0; py < 1024; py++) {
for (int px = 0; px < 1024; px++) {
for (int i = 0; i < 4; i++) {
@@ -26,20 +27,30 @@ for (int py = 0; py < 1024; py++) {
}
}
#else // this is either non-Windows or Microsoft C/C++
RGBAPNMObject *anime = readPPM("anime.pnm");
RGBAPNMObject *anime = readPPM(filename.c_str());
if (!anime) {
std::cout << "Can't set up anime component, couldn't read anime.pnm" << std::endl;
std::cout << "Can't set up image component, couldn't read " << filename << std::endl;
}
int loadWidth = anime->width, loadHeight = anime->height;
if (loadWidth > 1024 || loadHeight > 1024) {
std::cout << "Can't set up image component, " << filename << " resolution too large " << std::endl;
loadWidth = 1024;
loadHeight = 1024;
tlsf_free(anime->m_Ptr);
delete anime;
anime = nullptr;
}
std::cout << "loading " << filename << " at " << loadWidth << "," << loadHeight << std::endl;
for (int py = 0; py < 1024; py++) {
for (int px = 0; px < 1024; px++) {
for (int py = 0; py < loadHeight; py++) {
for (int px = 0; px < loadWidth; px++) {
if (anime) {
for (int i = 0; i < 4; i++) {
//data[1023 - py][px][i] = anime.pixel_data[((px * 4) + (py * 4 * 1024)) + i];
data[1023 - py][px][i] = static_cast<unsigned char>(anime->m_Ptr[((px * 4) + (py * 4 * 1024)) + i]);
data[loadWidth - 1 - py][px][i] = static_cast<unsigned char>(anime->m_Ptr[((px * 4) + (py * 4 * loadWidth)) + i]);
}
} else {
data[1023 - py][px][3] = 0x00; // just make it all transparent for now
data[loadWidth - 1 - py][px][3] = 0x00; // just make it all transparent for now
}
}
}
@@ -82,7 +93,7 @@ for (int py = 0; py < 1024; py++) {
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1024, 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, loadWidth, loadHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);

#ifndef __MINGW32__

+ 14
- 0
src/graphics/components/ImageComponent.h View File

@@ -0,0 +1,14 @@
#ifndef IMAGECOMPONENT_H
#define IMAGECOMPONENT_H

#include <GL/glew.h>
#include "BoxComponent.h"

class ImageComponent : public BoxComponent {
public:
ImageComponent(std::string filename, const float rawX, const float rawY, const float rawWidth, const float rawHeight, const int passedWindowWidth, const int passedWindowHeight);
// FIXME: dynamically allocate this
unsigned char data[1024][1024][4];
};

#endif

Loading…
Cancel
Save