Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > pl.comp.programming > #30710 > unrolled thread

meet the green fire

Started byfir <profesor.fir@gmail.com>
First post2017-09-30 03:42 -0700
Last post2017-09-30 11:20 -0700
Articles 5 — 2 participants

Back to article view | Back to pl.comp.programming


Contents

  meet the green fire fir <profesor.fir@gmail.com> - 2017-09-30 03:42 -0700
    Re: meet the green fire fir <profesor.fir@gmail.com> - 2017-09-30 04:31 -0700
      Re: meet the green fire wół, wół roboczy, wół dojno roboczo obronny 'POPIS/EU <NOSPAMtestowanije@go2.pl> - 2017-09-30 17:16 +0200
        Re: meet the green fire fir <profesor.fir@gmail.com> - 2017-09-30 08:31 -0700
      Re: meet the green fire fir <profesor.fir@gmail.com> - 2017-09-30 11:20 -0700

#30710 — meet the green fire

Fromfir <profesor.fir@gmail.com>
Date2017-09-30 03:42 -0700
Subjectmeet the green fire
Message-ID<652c3426-e2c7-4bb1-9e43-4b377fd61a98@googlegroups.com>
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) 

[toc] | [next] | [standalone]


#30711

Fromfir <profesor.fir@gmail.com>
Date2017-09-30 04:31 -0700
Message-ID<e487a41f-c85b-47e2-ba44-ce5e8f399b04@googlegroups.com>
In reply to#30710
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? 

[toc] | [prev] | [next] | [standalone]


#30715

Fromwół, wół roboczy, wół dojno roboczo obronny 'POPIS/EU <NOSPAMtestowanije@go2.pl>
Date2017-09-30 17:16 +0200
Message-ID<oqocg6$685$2@node2.news.atman.pl>
In reply to#30711
muszę to wiedzieć: jakie ideały Profesorowi przyświecały, aby napisać 
newsa w jedynie uznawanym przez grupę języku?

[toc] | [prev] | [next] | [standalone]


#30716

Fromfir <profesor.fir@gmail.com>
Date2017-09-30 08:31 -0700
Message-ID<0324115b-6645-415c-8f74-8b583fd305a4@googlegroups.com>
In reply to#30715
W dniu sobota, 30 września 2017 17:16:23 UTC+2 użytkownik wół, wół roboczy, wół dojno roboczo obronny 'POPIS/EU napisał:
> muszę to wiedzieć: jakie ideały Profesorowi przyświecały, aby napisać 
> newsa w jedynie uznawanym przez grupę języku?

pisalem na comp.lang.c i glupio by bylo wysilac sie by to tlumaczyc skoro juz raz napisane a kazdy normalny user zna angielski (bewnie lepiej niz ja bo robie mase bledow)

[toc] | [prev] | [next] | [standalone]


#30719

Fromfir <profesor.fir@gmail.com>
Date2017-09-30 11:20 -0700
Message-ID<fc0c894c-89d1-4c6a-8224-266610484e7d@googlegroups.com>
In reply to#30711
nieco poprawiona wersja

minddetonator.htw.pl/gfe2.zip 

[toc] | [prev] | [standalone]


Back to top | Article view | pl.comp.programming


csiph-web