MINI v.0.9.64d:
- [NEW] origin(x,y) sets the origin of the coordinate system. - [FIX] false extern declaration removed. - MINI_VERSION has its own header file.
This commit is contained in:
@@ -17,7 +17,9 @@ function normal_update()
|
||||
view(10,10,140,100)
|
||||
cls(3)
|
||||
prnt("HOLA",0,0)
|
||||
prnt(text,x,60)
|
||||
origin(70,50)
|
||||
prnt("ORIGIN",0,0)
|
||||
prnt(text,x,10)
|
||||
if btnp(keyRight) then x=x+1 end
|
||||
if btnp(keyLeft) then x=x-1 end
|
||||
if btnp(KEY_SPACE) then
|
||||
|
||||
8
lua.cpp
8
lua.cpp
@@ -291,6 +291,13 @@ extern "C" {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_origin(lua_State *L) {
|
||||
int x = luaL_checknumber(L, 1);
|
||||
int y = luaL_checknumber(L, 2);
|
||||
origin(x, y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_circ(lua_State *L) {
|
||||
int x = luaL_checknumber(L, 1);
|
||||
int y = luaL_checknumber(L, 2);
|
||||
@@ -855,6 +862,7 @@ void push_lua_funcs() {
|
||||
lua_pushcfunction(L,cpp_clip); lua_setglobal(L, "clip");
|
||||
lua_pushcfunction(L,cpp_camera); lua_setglobal(L, "camera");
|
||||
lua_pushcfunction(L,cpp_view); lua_setglobal(L, "view");
|
||||
lua_pushcfunction(L,cpp_origin); lua_setglobal(L, "origin");
|
||||
lua_pushcfunction(L,cpp_circ); lua_setglobal(L, "circ");
|
||||
lua_pushcfunction(L,cpp_circfill); lua_setglobal(L, "circfill");
|
||||
lua_pushcfunction(L,cpp_oval); lua_setglobal(L, "oval");
|
||||
|
||||
7
mini.cpp
7
mini.cpp
@@ -9,7 +9,7 @@
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
|
||||
extern DECLSPEC int SDLCALL (*event_handler_ptr)(SDL_Event*) = &SDL_PollEvent;
|
||||
DECLSPEC int SDLCALL (*event_handler_ptr)(SDL_Event*) = &SDL_PollEvent;
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
@@ -671,6 +671,11 @@ void view() {
|
||||
ds::clp[0] = ds::clp[1] = 0; ds::clp[2] = screen_width-1; ds::clp[3] = screen_height-1;
|
||||
}
|
||||
|
||||
void origin(int x, int y) {
|
||||
ds::cam[0] = -(ds::clip[0]+x);
|
||||
ds::cam[1] = -(ds::clip[1]+y);
|
||||
}
|
||||
|
||||
void _drawcirc(int xc, int yc, int x, int y) {
|
||||
pset(xc+x, yc+y);
|
||||
pset(xc-x, yc+y);
|
||||
|
||||
3
mini.h
3
mini.h
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#define MINI_VERSION "0.9.32d"
|
||||
#include "version.h"
|
||||
|
||||
#define KEY_UNKNOWN 0
|
||||
#define KEY_A 4
|
||||
@@ -170,6 +170,7 @@ void clip();
|
||||
void camera(int x, int y);
|
||||
void view(int x, int y, int w, int h);
|
||||
void view();
|
||||
void origin(int x, int y);
|
||||
|
||||
void circ(int x, int y, uint8_t r = 4);
|
||||
void circ(int x, int y, uint8_t r, uint8_t color);
|
||||
|
||||
Reference in New Issue
Block a user