Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

meet the green fire

18 views
Skip to first unread message

fir

unread,
Sep 30, 2017, 6:43:22 AM9/30/17
to
i once said i was coding some library for win32
that grants acces to making easy (old school in spirit)
per pixel graphics apps in windows (win32)

i was quite not touched it for 2 years or so but its functional and i am quite pleased by that lib though it is
not polished and even in design state as o some elements

you may check some example how to use it

minddetonator.htw.pl/gfe.zip

you need windows and mngw installed and thats all
here i showed how with few lines of code you cold create a windows and make something like small raw paint
appplication

this code is


#include<windows.h>

#include "green-fire.h"

int background_color = 0x00400020;
int drawing_color = 0xffffff;

int pen_size = 5;

void RunFrame(int no_advance)
{

if(frame_number==0)
ClearFrameData(background_color);


if(lmb_pressed)
FillCircle( mouse_x, mouse_y, pen_size, drawing_color);

if(rmb_pressed)
FillCircle( mouse_x, mouse_y, pen_size, background_color);


}

void ProcessMouseMove(int x, int y)
{


}

void ProcessKeyDown(int key)
{
if(key=='1') drawing_color = 0x00ffffff;
if(key=='2') drawing_color = 0x00551188;
if(key=='3') drawing_color = 0x00115088;
if(key=='4') drawing_color = 0x0015e078;
if(key=='5') drawing_color = 0x00256048;
if(key=='6') drawing_color = 0x00358098;
if(key=='7') drawing_color = 0x00e5c098;
if(key=='8') drawing_color = 0x003530a8;
if(key=='9') drawing_color = 0x0085c0f8;


if(key==VK_SPACE)
SaveFrameAsBMP("saved.bmp");

}

void OnResize()
{

RunFrame(1);

}



int main(void)
{
SetupWindow(" fir's Green fire usage example ", "2D", "notrace", 515, 415, 30, 20, RunFrame, 9, OnResize, ProcessMouseMove, ProcessKeyDown);

return 0;
}


separate topic is in fact i could and should to redesign it a bit (removing windows.h dependency (which is slight and probably not needed) and redesign the callbacks maybe for better usage


my goal (which probably fail as i know life though its good imo) would be to interest some people here to write some per pixel snippets and make some fun of it , mayb some contests and discussion (the contexts and discusion based on console are boring and my ap makes coding per pixel c snippeds real easy and potential fun is quite big)

fir

unread,
Sep 30, 2017, 7:31:15 AM9/30/17
to
getting back to design : here above for example i set all window info in a bit chaotic way, i think this info could be divided on windows setting and callbacks (i also get this needed calbasks set quite limited as it shows)

so i think maybe i should do

int main()
{
//...

SetupWindow(window_settings, window_callbacks);
ret 0;
}


where

int main()
{
WindowSettings ws;

ws.title = "firs example app over green fire lib" ;

ws.pos_x = 20;
ws.pos_y = 20;
ws.size_x = 400;
ws.size_y = 300;

ws.mode3d = 0;
ws.trace_info = 0;

WindowCallbacks wc;

wc.RunFrame = RunFrame;
wc.MouseMove = ProcesMouseMove;
wc.KeyDown = OnKeyDown;
wc.Resize = OnResize;


SetupWindow(window_settings, window_callbacks);
ret 0;
}

quite longer though, other alternative is to hide structures and give some api calls to set it

int main()
{

SetWindowsTitle("firs example app over green fire lib") ;

SetWindowSize(20, 30, 400, 300);
SetWindowMode3d(0);
SetWindowTraceInfoOn(0);

SetRunFrameCallback(RunFrame);
SetMouseMoveCallback(ProcesMouseMove);
SetKeydawnCallback(OnKeyDown);
SetOnResize Callback(OnResize);

SetupWindow();

ret 0;
}

there is also posible a mix of this options - which one is the best here?
0 new messages