Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Hemlos

#121
Bug Reports / inline
2008-Oct-27
how do i get this to work?

And how do i get NULL into the declaration?

linking:
gpc_temp0.o:gpc_temp0.cpp:(.text+0x568): undefined reference to `_mciSendString@16'
gpc_temp0.o:gpc_temp0.cpp:(.text+0x2021): undefined reference to `_mciSendString@16'
*** FATAL ERROR - Please post this output in the forum

Code (glbasic) Select
FUNCTION foo:
ENDFUNCTION

INLINE
}
extern "C" int __stdcall mciSendString(const char*,int,int,void*);
namespace __GLBASIC__
{
ENDINLINE

FUNCTION api:


a$="open tabs.mid type mpegvideo alias MediaFile";
b=0
c=0
INLINE
mciSendString(a_Str.c_str(),b,c,GLBASIC_HWND());
ENDINLINE
ENDFUNCTION

#122
FAQ / The Nature of WRITE
2008-Oct-21
When i use openfile(#,$,false#)  is this creating a text file? or a binary?
#123
Bug Reports / musicvolume
2008-Oct-18
i dont think musicvolume is working, i try all ways integer and decimal.

i set to 1, and midis started working incredibly, now they can never be turned back down to 0, its permanently stuck at max volume.
#124
Need to reduce FPS in the second thread, so here it is:

Just put this before your main loop:
Code (BEFORE MAIN LOOP...CALL ONCE) Select

   GLOBAL THREAD_FPS=60  //Second Thread Runs at 60 FPS
   StartThread_()
   LIMITFPS -1



Put This in your main loop:
Code (Main Loop) Select

print magicnumber,10,10




Put this after your main loop..
Code (MultiThread w/FPS Limit) Select

FUNCTION StartThread_:
StartThread_A()
ENDFUNCTION
INLINE
extern "C" unsigned int _beginthread(void*, unsigned int stacksize, void* args);
void ThreadFunc( void *dummy ) {StartThread_B();}
ENDINLINE
FUNCTION StartThread_A:
INLINE
_beginthread((void*)ThreadFunc, 0,NULL);
ENDINLINE
ENDFUNCTION
FUNCTION StartThread_B:
WHILE TRUE //second thread running THREAD_FPS:
magicnumber=RND(1024)
SLEEP 1000/THREAD_FPS
WEND
ENDFUNCTION


Thank you gernot for the original release, ive been intending to play with this, but i never got around to it.
It works really good, and i think i can find a thousand uses for it.
btw i ditched the sub routine, made it all functions with the same-likeness name.
#125
bNOT correct usage is posted at bottom of thread.
#126
QuoteUPDATED: Download is compatible with V10 now. -Hemlos July 3,2012

Heres a freeware program to make objects from images, source included.

Tips and tricks:
In settings: depth 0 for using objects to cast shadows.
In settings: Set normals to 2 for best 3d rendering results(use an x_spotlight)
Using small square images to make an object...if you use a large image, the object will too big of filesize.
Keep images around 64x64 or 128x128.
Be careful when you use 128x128..too many colors will create giant filesizes...
...the less number of black pixels, the smaller the filesize it will be.
World Point of insertion  x/2 y/2 of the image.

To make a colored object:
Draw an image with color 64x64, leave the background black.
A colored one will set the colors into the object vertice map, and you wont need a texture.
I think the colored style may be used for object bumpmapping and cellshading. Test it.
Make sure to set textured=0 to view it without a texture, so you can see the vertice colors.

Non colored object:
Draw image using White pixels, this will make the object white.
Black pixels in the image will not be draw into an object.
This style is good if you want to spheremap it.
If you want to see a texture added to this object, set textured=1

-Hemlos

PS. Theres no 3rd party software, no driver.dlls, and no inlines to fuss with, its all easy 123 Pure GLBasic.

[attachment deleted by admin]
#127
Bug Reports / Math BUG
2008-Oct-14
a=100/93  equals "1",  this should be 1.0752688172043010752688172043011
b=93/100  equals "0" , this should be 0.93

really need decimal math for 3d, with sin and cos, and even for simple 2d operations like a loadbar

EDIT: found 2 solutions

Code (glbasic) Select
LOCAL a=100.0
LOCAL b=93.0
c=a/b
PRINT c,100,100
SHOWSCREEN
MOUSEWAIT
Code (glbasic) Select

a=100.0/93.0
PRINT a,100,100
SHOWSCREEN
MOUSEWAIT
#128
Found multiple bugs with playmovie and loopmovie...

1. MPG and WMV, You must add these 2 to filetypes in Windows Media Player, view / plugin options / filetypes.
Or playmovie and loopmovie will not play mpg and wmv!
Very strange and illogical? It doesnt have this effect on AVI...AVI is ok here.

2.  playmovie and loopmovie does NOT do fullscreen mode..it is a blackscreen and skips past.

3. if the movie doesnt fit in the window properly, you see a white, or black or both colors around the borders of the movie.

4. playmovie doesnt work in viewport? i cant seem to debug this one..i dont know if i am coding it right.

Here is a code for a commandline movie player:
You must compile the program with this variable: -arg1 in the command line options in the editor.
You then right click on a movie file and "open with GLMovie"

Code (glbasic) Select

// --------------------------------- //
// Project: GLMovie Player (i only tested these: wmv, mpg, avi )
// Start: Sunday, October 12, 2008
// IDE Version: 6.034 WIN32
//
//  ADD -arg1 to the options in editor in the commandline textbox.
//make the window 800x600 or 1028x768 for large view, for viewing high res movies.
//you can associate wmv mpg and avi to play in GLmovie by right clicking on one
// of these files in a window and choosing "browse" , and select "GLmovie"...choose checkbox:
// "always run this program" ..if you disassociate them from wmplayer, they will not run..strange thing.


LIMITFPS -1
SYSTEMPOINTER TRUE
VIEWPORT 0,0, 600, 480
loadfile$=REPLACE$(GETCOMMANDLINE$(),CHR$(34),"")  //removes extra quotation marks "

LOOPMOVIE loadfile$





#129
Code Snippets / Rename Files
2008-Oct-11
Code ((DOS styled)) Select

FUNCTION RENAME: filename$,newfilename$
     IF DOESFILEEXIST(filename$) //in=true
          COPYFILE filename$,newfilename$
          KILLFILE filename$
          RETURN 1
     ELSE //in=false
          RETURN -1
          // "The system cannot find the file specified."
     ENDIF
ENDFUNCTION


Code ((Prevents Overwrite)) Select

FUNCTION RENAME_PROTECTED: filename$,newfilename$
IF DOESFILEEXIST(filename$) //filename=true
IF DOESFILEEXIST(newfilename$)
RETURN 0
// overwrite protected
ELSE //filename=true newfilename=false then rename
COPYFILE filename$,newfilename$
KILLFILE filename$
RETURN 1
// file copied
ENDIF
ELSE //filename=false
RETURN -1
//"The system can not find the file specified."
ENDIF
ENDFUNCTION
#130
code=GLBasic V5+6

Code (returns current working directory) Select

FUNCTION DIRECTORY:
// returns current working directory
// FORMAT: dir$=DIRECTORY()
     RETURN REPLACE$(GETCURRENTDIR$(),CHR$(47),CHR$(92))
ENDFUNCTION


dir$=DIRECTORY()+"subdirectory"
EXPLORE(dir$)
Code (opens explorer in specified directory) Select

FUNCTION EXPLORE: dir$
// opens explorer in specified directory
// FORMAT: EXPLORE(dir$)
     SHELLCMD("explorer.exe "+dir$,TRUE,TRUE,rv)
ENDFUNCTION


Combined for simplicity, opens explorer in working directory
Code (opens explorer in working directory) Select

FUNCTION EXPLORER:
// opens explorer in working directory
// FORMAT: EXPLORER()
     ok$=REPLACE$(GETCURRENTDIR$(),CHR$(47),CHR$(92))
     SHELLCMD("explorer.exe "+ok$,TRUE,TRUE,rv)
ENDFUNCTION
#131
This function will build an icon by using internal coding instead of a prebuilt image.
This is good if you dont want users altering the icon.ico with thier own modifications.

Important: Call Icon Function at the top of your code, once, before the main loop .
To change the image design and colors:
Alter the icon image in the function below where sprite$[] is declared.
Alter  Icon_Center_Color and Icon_Edge_Color to change background colors.

Code (glbasic) Select
FUNCTION InitializeWindowIcon:
//- Build A New Window Icon Sprite, with colors and Background!
//- Created By Hemlos@GLBasic.com
//- 2d Window Icon Builder Created By Hemlos@GLBasic.com
//- Additional Credits:
//- Thank you (Schranz0r) for the INLINE C++ Window Icon Draw
// Place Function call before main loop!

//Format: InitializeWindowIcon()

//Background Colors: (Edit Center and Edge color)
LOCAL Icon_Center_Color=RGB(255,0,0)  // red (change this is desired)
LOCAL Icon_Edge_Color=RGB(40,40,40)   // grey (change this is desired)
LOCAL ICON$="icon.ico"                        //temporary icon name(dont need to change this)
DIM SPRITE$ [16]

//Preset Foreground Colors: (Edit Icon Image With Color Presets)
// 0=Black W=White R=Red G=Green B=Blue C=Cyan Y=Yellow P=Purple

SPRITE$[0] ="................"
SPRITE$[1] =".......CC......."
SPRITE$[2] ="......CCCC......"
SPRITE$[3] =".....CCCCCC....."
SPRITE$[4] =".....CCCCCC....."
SPRITE$[5] =".....CCCCCC....."
SPRITE$[6] ="......CCCC......"
SPRITE$[7] =".......CC......."
SPRITE$[8] =".......CC......."
SPRITE$[9] =".......CC......."
SPRITE$[10]="................"
SPRITE$[11]=".......CC......."
SPRITE$[12]="......CCCC......"
SPRITE$[13]=".......CC......."
SPRITE$[14]="................"
SPRITE$[15]="................"

//Build Icon Background -Nothing to edit
ALPHAMODE -1
STARTPOLY -1
POLYVECTOR 7, 7, -1, -1, Icon_Center_Color
POLYVECTOR  0,   0,  -1,  -1, Icon_Edge_Color
POLYVECTOR   0, 15,  -1, -1, Icon_Edge_Color
ENDPOLY
STARTPOLY -1
POLYVECTOR  7,   7,  0,  0, Icon_Center_Color
POLYVECTOR   0, 15,  0, 0, Icon_Edge_Color
POLYVECTOR 15, 15, 0, 0, Icon_Edge_Color
ENDPOLY
STARTPOLY -1
POLYVECTOR  7,   7,  0,  0, Icon_Center_Color
POLYVECTOR   15, 15,  0, 0, Icon_Edge_Color
POLYVECTOR 15, 0, 0, 0, Icon_Edge_Color
ENDPOLY
STARTPOLY -1
POLYVECTOR  7,   7,  0,  0, Icon_Center_Color
POLYVECTOR   15, 0,  0, 0, Icon_Edge_Color
POLYVECTOR 0, 0, 0, 0, Icon_Edge_Color
ENDPOLY

//Build Icon Foreground -You can add more colors in this loop
LOCAL SPRITECOL, SPRITEROW, PixelColor, Pixel$
ALPHAMODE 1
FOR SPRITEROW=0 TO 15
FOR SPRITECOL=0 TO 15
Pixel$=MID$(SPRITE$[SPRITEROW],SPRITECOL,1)
IF Pixel$="."; PixelColor=RGB(0,0,0); ENDIF//black
IF Pixel$="W"; PixelColor=RGB(255,255,255); ENDIF//white
IF Pixel$="R"; PixelColor=RGB(255,0,0); ENDIF//red
IF Pixel$="G"; PixelColor=RGB(0,255,0); ENDIF//green
IF Pixel$="B"; PixelColor=RGB(0,0,255); ENDIF//blue
IF Pixel$="Y"; PixelColor=RGB(255,255,0); ENDIF//yellow
IF Pixel$="P"; PixelColor=RGB(255,0,255); ENDIF//Purple
IF Pixel$="C"; PixelColor=RGB(0,255,255); ENDIF//Cyan
//Add more Colors here, use lines above for example.
SETPIXEL SPRITECOL, SPRITEROW, PixelColor
NEXT
NEXT

//Build and Save Window Icon -Nothing to edit
GRABSPRITE 0, 0,0, 16,16
SAVESPRITE ICON$,0
BLACKSCREEN

//Draw window icon: -Inline Code below, written by Schranz0r -Nothing to edit
LOCAL hwnd,icon
INLINE
DECLARE_C_ALIAS(u32_GetActiveWindow,"user32.dll", "GetActiveWindow",(),int);
DECLARE_C_ALIAS(u32_SetClassLong,"user32.dll", "SetClassLongA",(int,int,int), void);
DECLARE_C_ALIAS(shell32_LoadIcon,"Shell32.dll", "ExtractIconA",(int,const char*,int), int);
hwnd = u32_GetActiveWindow();
icon = shell32_LoadIcon(hwnd,ICON_Str.c_str(),0);
u32_SetClassLong(hwnd,-14,icon);
ENDINLINE

ENDFUNCTION
#132
Bug Reports / Typo's
2008-Sep-01
Typo In the help file for X_OBJ....
The top example shows X_ENDOBJ, where it should be X_OBJEND:
Code ( Help Example) Select

X_OBJSTART num#
X_OBJADDVERTEX x#, y#, z#, tx#, ty#, col#
X_OBJNEWGROUP
X_ENDOBJ


Code ( Help Example APPEND) Select

X_OBJSTART num#
X_OBJADDVERTEX x#, y#, z#, tx#, ty#, col#
X_OBJNEWGROUP
X_OBJEND


#133
Ok guys i ran into an issue with CPRINT and making it into 3d realtime animation.

I need ideas from anyone willing to give thier input to solve a FPS problem...

Heres the issue..

These run fast in 3d..hundreds of FPS:
If Cprint3d uses 2d in the 3d port it runs fast...but you cant turn it or roll it.
If Cprint3d uses X_Dot, same deal, cant turn it or roll it, but runs fast.

This runs slow, less than 60 fps:
If you make the CPRINT pixels into vertices, it runs slow...BUT you CAN turn it and roll it in 3d, while maintaining a realtime update to the String$.

And to sum up the ability of CPRINTS realtime special effects 3d issue:
If you make the CPRINT build an object using frames, you CAN turn and roll, game runs fast, and its turnable..., BUT startup is slow....and you CANT REBUILD the object without dragging the FPS down.
IE, ...using cprint to display in 3d the PLATFORMINFO("TIME") wont be possible without making it run slow....which i dont like that idea.
Building Object Frames defeats the purpose of being able to adjust realtime string$ Text animations.

Anyone have any ideas to make cprint3d, run fast, rotatable objects, realtime, while updating string$?
I think i tried everything, and im stumped with this issue at the moment.
I will not publish CPRINT until i work out this issue, please give your ideas!
#134
2d Desktop clock, and FPS(internal clock timed) added

The clock has a few 2d functions worth adding to your libraries..

These functions make colorable 2d graphics using polyvectoring.

DRAWDISC
DRAWCIRCLE
DRAWRING




The FPs counter uses your PC internal clock for measuring FPS.

Check them out in the math section : MATH
#135
How to use SIN and COS, for Rotational and Circular Math:
Below you will find examples of Trigonometry math...
...Functions for DRAWCIRCLE(), DRAWDISC(), and DRAWRING()
You will also find the code for a Desktop Clock, which uses internal computer clock.  :good:

Here is an example of  "How to do ROTATE"
In this example we will make a circle out of dots.
You need to make presets for the Center Position X,Y, and Radius.
Then, you need to rotate an angle, so declare a variable RotationAngle .
In order to make a circle, you need to draw it out obviously...
...we are making dots , these will need a 2 variables for both planes in XY
So lets get the program started....first declare variables, then begin the main loop:
Code (glbasic) Select

LIMITFPS 60
LOCAL DotX,DotY,RotationAngle //these are variables and dont need to be preset.
LOCAL X,Y,Radius //Circle Presets
X=200 //place the center of circle here
Y=200
Radius=150 // This is the distance from center of circle to be drawn
WHILE TRUE  //start the code


In order to make a point spin around (X,Y), at Radius distance,
1. You multiply the Radius by the cosine of X, and add the distance X .
Always use COS for X plane.
This will always orient angle 0 to point to the right, to the positive x direction.
DotX=Radius*COS(RotationAngle)+X

2. You multiply the Radius by the sine of Y, and add the distance Y . Always use SIN for Y plane.
DotY=Radius*COS(RotationAngle)+Y

Now we're ready to start Rotating the Angle and drawing it out.
FOR, NEXT with a SETPIXEL command will be suitable for this example:
Code ( 0 to 359=360 degrees) Select

FOR RotationAngle=0 to 359 //360 degrees
     DotX=Radius*COS(RotationAngle)+X
     DotY=Radius*SIN(RotationAngle)+Y
     SETPIXEL DotX,DotY,RGB(255,255,255)
NEXT

SHOWSCREEN
WEND


Notes: you can make presets for individual Radius for both X and Y planes....to make globes etc
Make sure you declare,
LOCAL RadiusX,RadiusY

//ellipse
RadiusX=150
RadiusY=100

And include those into the FOR NEXT statement.
     DotX=RadiusX*COS(RotationAngle)+X
     DotY=RadiusY*SIN(RotationAngle)+Y

Now we're done, here is the full code of the example above:
Code (glbasic) Select

LIMITFPS 60
LOCAL DotX,DotY,RotationAngle //these are variables and dont need to be preset.
LOCAL X,Y,Radius //Circle Presets
X=200 //place the center of circle here
Y=200
Radius=150 // This is the distance from center of circle to be drawn
WHILE TRUE  //start the code

FOR RotationAngle=0 to 359 //360 degrees
     DotX=Radius*COS(RotationAngle)+X
     DotY=Radius*SIN(RotationAngle)+Y
     SETPIXEL DotX,DotY,RGB(255,255,255)
NEXT

SHOWSCREEN
WEND


Nice and easy....i have added coded functions to make circles and discs using this math:
To use this function:
DRAWCIRCLE(CircleColor,CircleX,CircleY,CircleRadius)

Code (DRAWCIRCLE() Function draws a circle with lines) Select


FUNCTION DRAWCIRCLE: CircleColor,CircleX,CircleY,CircleRadius
//draws a 36 point circle, using lines
LOCAL Cir,CirXS,CirYS,CirXE,CirYE
FOR Cir=0 TO 359 STEP 10
CirXS=CircleX+CircleRadius*COS(Cir)
CirYS=CircleY+CircleRadius*SIN(Cir)
CirXE=CircleX+CircleRadius*COS(Cir-10)
CirYE=CircleY+CircleRadius*SIN(Cir-10)
DRAWLINE CirXS,CirYS,CirXE,CirYE,CircleColor
NEXT
ENDFUNCTION




and here is a disc using the same exact math, but with polyvectors and images for skin:
To use this function, you need 2 colors, one for the center and one for the outside.
And you can skin it to with BmpSkin="image.bmp"
DRAWDISC(CircleColor1,CircleColor2,CircleX,CircleY,CircleRadius,BmpSkin)

Code (DRAWDISC() Function creates a filled disc of specified radius) Select



FUNCTION DRAWDISC: CircleColor1,CircleColor2,CircleX,CircleY,CircleRadius,BmpSkin
//Function creates a filled disc of specified radius
FOR Cir=0 TO 359 STEP 10
STARTPOLY BmpSkin,0
CirXS=CircleX+CircleRadius*COS(Cir)
CirYS=CircleY+CircleRadius*SIN(Cir)
CirXE=CircleX+CircleRadius*COS(Cir-10)
CirYE=CircleY+CircleRadius*SIN(Cir-10)
POLYVECTOR CirXS,CirYS, CirXS-CircleX-CircleRadius, CirYS-CircleY-CircleRadius, CircleColor1
POLYVECTOR CirXE,CirYE, CirXE-CircleX-CircleRadius, CirYE-CircleY-CircleRadius, CircleColor1
POLYVECTOR CircleX,CircleY, CircleX-CircleX-CircleRadius, CircleY-CircleY-CircleRadius, CircleColor2
ENDPOLY
NEXT

ENDFUNCTION




And finally here is a RING...with 2 radius, an inside radius and outside radius.
It is used exactly like the examples above:
DRAWRING(Color1,Color2,CircleX,CircleY,OutsideRadius,InsideRadius,BmpSkin)

Code (DrawRing() Function draws a ring with adjustable width..  inside and outside radius) Select


FUNCTION DRAWRING: Color1,Color2,CircleX,CircleY,OutsideRadius,InsideRadius,BmpSkin
FOR Cir=0 TO 359 STEP 10
STARTPOLY BmpSkin
CirX1=CircleX+OutsideRadius*COS(Cir)
CirY1=CircleY+OutsideRadius*SIN(Cir)
CirX2=CircleX+OutsideRadius*COS(Cir-10)
CirY2=CircleY+OutsideRadius*SIN(Cir-10)
CirX3=CircleX+InsideRadius*COS(Cir-10)
CirY3=CircleY+InsideRadius*SIN(Cir-10)
CirX4=CircleX+InsideRadius*COS(Cir)
CirY4=CircleY+InsideRadius*SIN(Cir)
POLYVECTOR CirX1,CirY1,CirX1,CirY1,Color1
POLYVECTOR CirX2,CirY2,CirX2,CirY2,Color1
POLYVECTOR CirX3,CirY3,CirX3,CirY3,Color2
POLYVECTOR CirX4,CirY4,CirX4,CirY4,Color2
ENDPOLY
NEXT
ENDFUNCTION





This is a full screen Analog Clock, it is syncronized with your computers time...can be a great screen saver.
Download the rar attached to message(updated for version>=7.144)
Read the readme in the zipfile, for info on how to make it into a screen saver.

Ive been tinkering...its getting bigger and more colorful.
Render At 800x600 fullscreen.
Code (Main Clock Code) Select

// --------------------------------- //
// Project: DesktopClock
// Start: Thursday, August 14, 2008
// IDE Version: 5.341

//compile into fullscreen mode...looks cool
LOCAL sx,sy,h,w
GETSCREENSIZE sx,sy
GETFONTSIZE w,h
LOCAL cx=sx/2
LOCAL cy=sy/2
AUTOPAUSE FALSE
ALPHAMODE -1

WHILE TRUE
SYSTEMPOINTER FALSE
drawwater()
dosfx=dosfx+1
IF dosfx>3 THEN dosfx=0
IF dosfx=0
velx=RND(4)-2
vely=RND(4)-2
cx2=cx
cx=cx2+velx
cy2=cy
cy=cy2+vely
ENDIF
IF cy>400 THEN cy=400
IF cx>600 THEN cx=600
IF cx<200 THEN cx=200
IF cy<200 THEN cy=200
IF fup=0;  fx1=fx1-1; IF fx1<1; fup=1;ENDIF; ENDIF
IF fup=1;  fx1=fx1+1; IF fx1>250; fup=0;ENDIF;ENDIF
    sxf(RGB(1,1,1),RGB(-fx1,1,1),cx,cy,170,66)
DRAWRING(RGB(20,20,fx1),RGB(-fx1,20,20),cx,cy,245,195)
DRAWRING(RGB(-fx1,20,20),RGB(20,20,fx1),cx,cy,195,170)
DRAWCIRCLE(RGB(1,1,1),cx,cy,66)
DRAWCIRCLE(RGB(fx1,1,1),cx,cy,200)
DRAWCIRCLE(RGB(1,1,fx1),cx,cy,240)
  IF KeyBoardIO()>-1 THEN END

//seconds hand
STARTPOLY -1
//DRAWLINE cx,cy,cx+200*COS(secs*6-90),cy+200*SIN(secs*6-90),RGB(RND(200)+20,RND(200)+20,RND(200)+20) //secs
POLYVECTOR cx+200*COS(secs*6-90),cy+200*SIN(secs*6-90),cx+200*COS(secs*6-90),cy+200*SIN(secs*6-90),RGB(255,255,fx1)
POLYVECTOR cx+10*COS(secs*6-180),cy+10*SIN(secs*6-180),cx+10*COS(secs*6-180),cy+10*SIN(secs*6-180),RGB(1,1,1)
POLYVECTOR cx+10*COS(secs*6),cy+10*SIN(secs*6),cx+10*COS(secs*6),cy+10*SIN(secs*6),RGB(1,1,1)
ENDPOLY

//minutes hand
STARTPOLY -1
//DRAWLINE cx,cy,cx+166*COS(mins*6-90),cy+166*SIN(mins*6-90),RGB(RND(200)+20,0,0)//mins
POLYVECTOR cx+150*COS(mins*6-90),cy+150*SIN(mins*6-90),cx+200*COS(mins*6-90),cy+200*SIN(mins*6-90),RGB(255,255,fx1)
POLYVECTOR cx+10*COS(mins*6-180),cy+10*SIN(mins*6-180),cx+10*COS(mins*6-180),cy+10*SIN(mins*6-180),RGB(1,1,1)
POLYVECTOR cx+10*COS(mins*6),cy+10*SIN(mins*6),cx+10*COS(mins*6),cy+10*SIN(mins*6),RGB(1,1,1)
ENDPOLY

// hours hand
STARTPOLY -1
//DRAWLINE cx,cy,cx+122*COS(hrs*30-90),cy+122*SIN(hrs*30-90),RGB(0,0,RND(200)+20) //hours
POLYVECTOR cx+100*COS(hrs*30-90),cy+100*SIN(hrs*30-90),cx+200*COS(hrs*30-90),cy+200*SIN(hrs*30-90),RGB(255,255,fx1)
POLYVECTOR cx+10*COS(hrs*30-180),cy+10*SIN(hrs*30-180),cx+10*COS(hrs*30-180),cy+10*SIN(hrs*30-180),RGB(1,1,1)
POLYVECTOR cx+10*COS(hrs*30),cy+10*SIN(hrs*30),cx+10*COS(hrs*30),cy+10*SIN(hrs*30),RGB(1,1,1)
ENDPOLY


DRAWDISC(RGB(1,1,1),RGB(255,255,fx1),cx,cy,22)
DRAWCIRCLE(RGB(1,1,1),cx,cy,22)


FOR i= 1 TO 12 //draw little lines and numbers
DRAWLINE cx+200*COS(i*30),cy+200*SIN(i*30),cx+210*COS(i*30),cy+210*SIN(i*30),RGB(1,fx1,1)
PRINT i,cx+225*COS(i*30-90)-8,cy+225*SIN(i*30-90)-h/2-2
NEXT

LET secs1=MID$(PLATFORMINFO$("TIME"),18,1)
LET secs2=MID$(PLATFORMINFO$("TIME"),17,1)
LET mins1=MID$(PLATFORMINFO$("TIME"),15,1)
LET mins2=MID$(PLATFORMINFO$("TIME"),14,1)
LET hrs1 =MID$(PLATFORMINFO$("TIME"),12,1)
LET hrs2 =MID$(PLATFORMINFO$("TIME"),11,1)
secs=secs2*10
secs=secs+secs1
mins=mins2*10
mins=mins+mins1
hrs=hrs2*10
hrs=hrs+hrs1
IF hrs=0 THEN hrs=12
  IF hrs>12;
  hrs=hrs-12; pm$="pm"
  ELSE
pm$="am"
ENDIF
PRINT MID$(PLATFORMINFO$("TIME"),0,10),2,2+fx1

IF mins<10
PRINT hrs+":0"+mins+" "+pm$,20,25+fx1
ELSE
PRINT hrs+":"+mins+" "+pm$,20,25+fx1
ENDIF


//tick=ASC(MID$(PLATFORMINFO$("TIME"),18,1))

SHOWSCREEN


WEND


FUNCTION DRAWRING: Col1,Col2,CircleX,CircleY,OutsideRadius,InsideRadius

FOR Cir=0 TO 359 STEP 10
STARTPOLY -1
CirX1=CircleX+OutsideRadius*COS(Cir)
CirY1=CircleY+OutsideRadius*SIN(Cir)
CirX2=CircleX+OutsideRadius*COS(Cir-10)
CirY2=CircleY+OutsideRadius*SIN(Cir-10)
CirX3=CircleX+InsideRadius*COS(Cir-10)
CirY3=CircleY+InsideRadius*SIN(Cir-10)
CirX4=CircleX+InsideRadius*COS(Cir)
CirY4=CircleY+InsideRadius*SIN(Cir)
POLYVECTOR CirX1,CirY1,CirX1,CirY1,Col2
POLYVECTOR CirX2,CirY2,CirX2,CirY2,Col2
POLYVECTOR CirX3,CirY3,CirX3,CirY3,Col1
POLYVECTOR CirX4,CirY4,CirX4,CirY4,Col1
ENDPOLY
NEXT

ENDFUNCTION

FUNCTION sxf: Col1,Col2,CircleX,CircleY,OutsideRadius,InsideRadius
STATIC sf
FOR Cir=0 TO 359 STEP 20
STARTPOLY -1
sf=sf+1
Cir=Cir+sf
CirX1=CircleX+OutsideRadius*COS(Cir)
CirY1=CircleY+OutsideRadius*SIN(Cir)
CirX2=CircleX+OutsideRadius*COS(Cir-10)
CirY2=CircleY+OutsideRadius*SIN(Cir-10)
CirX3=CircleX+InsideRadius*COS(Cir-10)
CirY3=CircleY+InsideRadius*SIN(Cir-10)
CirX4=CircleX+InsideRadius*COS(Cir)
CirY4=CircleY+InsideRadius*SIN(Cir)
POLYVECTOR CirX1,CirY1,CirX1,CirY1,Col2
POLYVECTOR CirX2,CirY2,CirX2,CirY2,Col2
POLYVECTOR CirX3,CirY3,CirX3,CirY3,Col1
POLYVECTOR CirX4,CirY4,CirX4,CirY4,Col1
ENDPOLY
NEXT
FOR Cir=359 TO 0 STEP 20
STARTPOLY -1
sf=sf-1
Cir=Cir+sf+90
CirX1=CircleX+OutsideRadius*COS(Cir)
CirY1=CircleY+OutsideRadius*SIN(Cir)
CirX2=CircleX+OutsideRadius*COS(Cir-10)
CirY2=CircleY+OutsideRadius*SIN(Cir-10)
CirX3=CircleX+InsideRadius*COS(Cir-10)
CirY3=CircleY+InsideRadius*SIN(Cir-10)
CirX4=CircleX+InsideRadius*COS(Cir)
CirY4=CircleY+InsideRadius*SIN(Cir)
POLYVECTOR CirX1,CirY1,CirX1,CirY1,Col2
POLYVECTOR CirX2,CirY2,CirX2,CirY2,Col2
POLYVECTOR CirX3,CirY3,CirX3,CirY3,Col1
POLYVECTOR CirX4,CirY4,CirX4,CirY4,Col1
ENDPOLY
NEXT
IF sf>360 THEN sf=0
ENDFUNCTION


FUNCTION DRAWDISC: CircleColor1,CircleColor2,CircleX,CircleY,CircleRadius
FOR Cir=0 TO 359 STEP 10
STARTPOLY -1
CirXS=CircleX+CircleRadius*COS(Cir)
CirYS=CircleY+CircleRadius*SIN(Cir)
CirXE=CircleX+CircleRadius*COS(Cir-10)
CirYE=CircleY+CircleRadius*SIN(Cir-10)
CirXO=CircleX
CirYO=CircleY
POLYVECTOR CirXS,CirYS,CirXS,CirYS,CircleColor1
POLYVECTOR CirXE,CirYE,CirXE,CirYE,CircleColor1
POLYVECTOR CirXO,CirYO,CirXO,CirYO,CircleColor2
ENDPOLY
NEXT

ENDFUNCTION

FUNCTION DRAWCIRCLE: CircleColor,CircleX,CircleY,CircleRadius
//draws a 36 point circle
LOCAL Cir,CirXS,CirYS,CirXE,CirYE
FOR Cir=0 TO 359 STEP 10
CirXS=CircleX+CircleRadius*COS(Cir)
CirYS=CircleY+CircleRadius*SIN(Cir)
CirXE=CircleX+CircleRadius*COS(Cir-10)
CirYE=CircleY+CircleRadius*SIN(Cir-10)
DRAWLINE CirXS,CirYS,CirXE,CirYE,CircleColor
NEXT
ENDFUNCTION

// ------------------------------------------------------------- //
// ---  KeyBoardIO  --- detect any key press...0 to 299
// returns instance of key pressed..one time...preventing repeated input
// waits till button is released...then returns that keycode.
// its in this program to check if any key is pressed, and end program.
// ------------------------------------------------------------- //
FUNCTION KeyBoardIO:
LOCAL i
STATIC K,SENDKWAIT,SKB
K=-1
FOR i=0 TO 299
IF KEY(i) THEN K=i
NEXT
IF (K=-1) AND (SENDKWAIT=TRUE); SENDKWAIT=FALSE; RETURN SKB; ENDIF
IF K>-1; SENDKWAIT=TRUE; SKB=K; K=-1; ENDIF
RETURN K
ENDFUNCTION


FUNCTION drawwater:

STATIC z1,z2


FOR y = 0 TO 600 STEP 60
FOR x= 0 TO 800 STEP 80
y1=y-3
STARTPOLY -1
POLYVECTOR x+RND(3)-3,y1+RND(3),x,y,RGB(RND(99),x/9+y/9,x/9+y/9)
POLYVECTOR x+RND(3)-3,y1+60+RND(3)+3,x,y,RGB(RND(99),x/9+y/9,x/7+y/9)
POLYVECTOR x+80+RND(3)+3,y1+60+RND(3)+3,x,y,RGB(RND(99),x/9+y/9,x/9+y/7)
POLYVECTOR x+80+RND(3)+3,y1+RND(3)-3,x,y,RGB(RND(99),x/9+y/9,x/9+y/9)
ENDPOLY
NEXT
NEXT
ENDFUNCTION







Bonus code from clock program:
Want to detect a key pressed AND Released ? Once?
Reports only once...after key is released...fantastic for user inputs.
This code prevents key press getting reported multiple times.
It only reports back which key is pressed one time, and only after the key is released.
If no keys are pressed then KeyBoardIO() = -1
Check for keys pressed like this:
KeyPressed=KeyBoardIO()
if KeyPressed > -1 then key was pressed and released, and afterwards resets back to value=-1
if KeyPressed = -1 then no keys has been pressed and released
Code (  key detection function ) Select

// ------------------------------------------------------------- //
// ---  KeyBoardIO  --- detect any key press...great for user inputs
// waits till button is released...then returns that keycode.
// ------------------------------------------------------------- //
FUNCTION KeyBoardIO:
LOCAL i
STATIC K,SENDKWAIT,SKB
K=-1
FOR i=0 TO 299
IF KEY(i) THEN K=i
NEXT
IF (K=-1) AND (SENDKWAIT=TRUE); SENDKWAIT=FALSE; RETURN SKB; ENDIF
IF K>-1; SENDKWAIT=TRUE; SKB=K; K=-1; ENDIF
RETURN K
ENDFUNCTION


[attachment deleted by admin]
#136
Bug Reports / Bug: Autopause
2008-Aug-14
Regardless if autopause is declared....

If you minimize it works fine, ..pauses...
but sometimes when you click into the window is auto pauses...thats one issue with it

and another thing is...
when you click the task on taskbar for the window...and the program minimizes...
sometimes even when it loses "focus", it wont pause.

Ive been having problems with this, and its causing crashes to my tool.
#137
Ok Gernot ive been trying to debug the 100% core usage, even after the fix...
The latest fix for core speed works for some and for other computers it doesnt..

Observations:
1.
If you compile a project, and use LIMITFPS 60 ...and if program does 60 fps
result...low report of 1-5% core load.

2.
If you compile a project, and use LIMITFPS 60 ..and if the program does < less than 60fps
result...it overloads the cpu to 100%.

More Observations:
I have 2 programs,
3.
Program #1 does full speed and limitfps is 60, it reports 1% cpu load....no problem.

4.
The second program does 2/3 speed...limitfps 60, and it runs at about 40 fps. (its big, alot of data)
This program reports 100% cpu usage, even if i set the LIMITFPS to 1, and force it to run 1 fps.

Hope this helps to debug, i know its been an issue for a few users, including the quad core users.


#138
Sorry this project is closed for now, unfortunetly the source is gone due to a crash.

You can still use the image2object creator for making similiar objects.
The source in image2object was the core code for this project.

This program did everything including circular words, and texture mapping it with 3 styles of overlay.
It stretched it evenly, or it tiled each letter with the map, or it stretched it to fit x y.
The texture was directly inputed into the vertice xyz points color data...no need for x_settexture.

The way it worked was it read in a smalfont.png, then with some math it built an object out of the text input.
It made a cube for each pixel in the sentance$ input.
You were able to select a color for the object with a color map.
It was scalable, and it was able to make the words go into a circle, the font downside pointing inwards of the circle. And the circle was scalable too.

Making this object flat or thick with a scalar was possible...also if you made it 0 thickness..it was set to make shadows too.
All the 3d object creation options were available.

Im sad i lost this code :(
If someone wants to try whipping up a new one....you may have the image2object code to do so freely.
Just let me know youre going to give it a shot, ill help you.



[attachment deleted by admin]
#139
I made a tool and i would like to sell it to people who use the game it is for.
I didnt make the game, only the tool.

1. How do i pack and sell the program so people cant copy it and share it?
2. How do i go about doing this legally, without infringing on the original developers rights?

Maybe these sound like stupid questions, but ive never actually considered this till now, because ive actually created something useful, and would like to profit from it....residual income would nice ;)

-Hem

#140
3D-snippets / 3D GRAVITY!
2007-Jul-11
June 14, 2012:
Arg...years later, i TOTALLY forgot about this thread.
I attached a 3d galactic simulator to this message...play with the file called "Profile"...youll be able to affect the gravity and shape of the formations.
I made a bunch of different formations..these buttons will start them:
`1234567890-=[backspace]

I APPOLOGIZE from the bottom of my heart, really, im sorry for not keeping up with this thread.
It is sloppy, on the fly recoding, to keep up with the IDE...i have too much on my plate.
If you need help with your own program handling 3d gravity, i can help you by reviewing code.

Here is how you do 3d gravity...
Basically...i just used isaac newtons formula on each dimension, then divided by the number of dimensions.
You must alter the ALL forces on every object, which is induced by all other objects with mass.
In other words...if theres 100 objects...you must change the force applied to each object, 99 times(indices of all masses affect each one)
...and then do it for the second(third, fourth,etc) object...so this would be 100x99 loops(not 100x100 because you dont calculate the gravity of an object on itself X)

In order to explain the gravity, i ripped the most important code and splattered it here below as neatly as i could:
Code (glbasic) Select

//Predefine Gravity and masses:
G=1.615 //Gravitational constant...this must not change. The value can be anything you want.

//All objects must have predefined MASS(size), and Position.
// In other words, one object might have the mass of 3 while another object can be size of 10.


//so you begin with a loop calculating each object separately:
//You apply all the forces of all objects onto the first object.....then again for the second and third...etc
M = mass of the object 1

//xyz of object, which gravity force will be applied to:
X=ObjPos[Object1][0] // xyz of Object(next in indices) being affected
Y=ObjPos[Object1][1]
Z=ObjPos[Object1][2]

//this is the beginning of the SECOND loop...apply force to first object according to all the other forces in the indices
//Define position of next objects force:

//Object #2 xyz position (next XYZ)
nX=ObjPos[Object2][0] // xyz of Obj2 of next object in list
nY=ObjPos[Object2][1]
nZ=ObjPos[Object2][2]

//vector distance(Range):
//R must be > 1...i limited my test to 1.001 as a minimum..or else i forced a collision event here.
//You will experience a [numerical terminal velocity] of objects colliding, when the vector distance drops to 1.0
RX=(MAX(X,nX)-MIN(X,nX))
RY=(MAX(Y,nY)-MIN(Y,nY))
RZ=(MAX(Z,nZ)-MIN(Z,nZ))
R2=(RX*RX)+(RY*RY)+(RZ*RZ)
R=SQR(R2)
R3=(R*R*R)

//Now you must apply the gravity to the force being put on the first object(XYZ affected by xforce)
// you keep altering this xforce until all indices are read.
Gravity=G*M2 //this is force being applied to the current force...not really gravity..variables need names.
IF X>nX THEN XForce=XForce-Gravity*RX/R3
IF X<nX THEN XForce=XForce+Gravity*RX/R3
IF Y>nY THEN YForce=YForce-Gravity*RY/R3
IF Y<nY THEN YForce=YForce+Gravity*RY/R3
IF Z>nZ THEN ZForce=ZForce-Gravity*RZ/R3
IF Z<nZ THEN ZForce=ZForce+Gravity*RZ/R3

//end of loop....by this point, first object will calculated, because you applied the forcee from all other objects on the first one
//the loop will now run through and affect the force applied to the second object in the indices of objects.
// after all objects are calculated
//now you must move the object according to the forces applied onto it:
ObjPos[Object1][0]=X+XForce
ObjPos[Object1][1]=Y+YForce
ObjPos[Object1][2]=Z+ZForce

//and dont forget, you must record into memory the force applied onto the object you are moving here.
//this data will be used again....in the next program frame.
ObjPos[Object1][3]=XForce
ObjPos[Object1][4]=YForce
ObjPos[Object1][5]=ZForce


I know..its hard to understand...im not a very good teacher, but someone might 'get it'.


[attachment deleted by admin]